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

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

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

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

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 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

Likewise, the URL will show:

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.

Updated 11 months ago

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.