BTFS

The BTFS Developer Hub

Welcome to the BTFS developer hub. You'll find comprehensive guides and documentation to help you start working with BTFS as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Multiple File Pinning

BTFS Key Gen

The btfs key gen command allows users to pin multiple files onto one node, by letting users generate a new keypair for each file to be pinned.

For example, we can generate 4 key pairs using ECDSA, RSA, and ed25519 algorithms:

User-MacBook-Pro:user$ btfs key gen --type=ecdsa pin1
QmfQZaw58AvSAf9Ych8Qtt9GHgq9ET9BsDT5SLuuMnVaZ7

User-MacBook-Pro:user$ btfs key gen --type=ecdsa pin2
QmTwunwcRUjAKSp9gNB79ZZyJ81eiTrWYb3epqbFQpvm5P

User-MacBook-Pro:user$ btfs key gen --type=rsa pin3
QmQqsQHoAATj4U3G5mWeY7dinPERk7tvfzvJMnHrPSWwaA

User-MacBook-Pro:user$ btfs key gen --type=ed25519 pin4
12D3KooWBb5NLt1xTYvD3YaG7F9cXqH1wVjHyuHdoXiMC7ZWcAr7


We first upload four image files to BTFS:

User-MacBook-Pro:pictures user$ btfs add antelopecanyon.jpg
added QmdymbgfUbaQmFo2wShmPZ7z713T5cATTHx229QKBtk8jX antelopecanyon.jpg
 212.55 KiB / 212.55 KiB [=================================================================] 100.00%

User-MacBook-Pro:pictures user$ btfs add yellowstone1.jpg
added QmRGaRVWP9CbkN5SpReMejkbbtuzxHPqQRcexyhFc4jJJB yellowstone1.jpg
 5.64 MiB / 5.64 MiB [=====================================================================] 100.00%
 
User-MacBook-Pro:pictures user$ btfs add angellanding.jpg
added QmNRNVAoXmSEVWVVwbmDiCvbRm7gvzCiHRtwMca5ohjKoV angellanding.jpg
 242.61 KiB / 242.61 KiB [=================================================================] 100.00%
 
User-MacBook-Pro:pictures user$ btfs add hunanmountains.jpg
added QmZEsHXJ3cp1WJbDC321ftLFb4Jymxre2ACrmdQiqLHmif hunanmountains.jpg
 98.36 KiB / 98.36 KiB [===================================================================] 100.00%

We can then pin the antelopecanyon.jpg file hash to a keypair:

// Publish 

User-MacBook-Pro:pictures user$ btfs name publish --key=pin1 QmdymbgfUbaQmFo2wShmPZ7z713T5cATTHx229QKBtk8jX

// Output:
Published to QmfQZaw58AvSAf9Ych8Qtt9GHgq9ET9BsDT5SLuuMnVaZ7: /btfs/QmdymbgfUbaQmFo2wShmPZ7z713T5cATTHx229QKBtk8jX

The output tells the user the antelopecanyon.jpg hashed file has been pinned to keypair name "pin1", which has the hash value of QmfQZaw58AvSAf9Ych8Qtt9GHgq9ET9BsDT5SLuuMnVaZ7. Thus, visiting the URL https://gateway.btfssoter.io/btns/QmfQZaw58AvSAf9Ych8Qtt9GHgq9ET9BsDT5SLuuMnVaZ7 will show:

Let us pin hunanmountain.jpg to our same BTFS node, but using a different keypair. We will use "pin2":

// Publish 

User-MacBook-Pro:pictures user$ btfs name publish --key=pin2 QmZEsHXJ3cp1WJbDC321ftLFb4Jymxre2ACrmdQiqLHmif

// Output:
Published to QmTwunwcRUjAKSp9gNB79ZZyJ81eiTrWYb3epqbFQpvm5P: /btfs/QmZEsHXJ3cp1WJbDC321ftLFb4Jymxre2ACrmdQiqLHmif

Thus, we are able to pin multiple files to our BTFS node, at least up to the maximum storage capacity set in the configuration file.

Multiple File Pinning


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.