Links

Pinning Encrypted Files to IPFS

Learn how to pin encrypted files to IPFS.

What is ipfs-add-from-encrypted?

Ipfs-add-from-encrypted is an open-source tool that can be used to encrypt files and upload them to IPFS. Once uploaded to IPFS, the file must be pinned to persist on IPFS long-term.
Read below to learn how to pin encrypted files to IPFS with Filebase.

Prerequisites:

  • Download and install the Python package ipfsapi with the command pip3 install ipfsapi.
  • Download and install the IPFS daemon.
  • Sign up for a free Filebase account.
  • Have your Filebase Access and Secret Keys. Learn how to view your access keys here.
  • Create a Filebase IPFS Bucket. Learn how to create a bucket here.

1. Clone the ipfs-add-from-encrypted GitHub repository:

git clone https://github.com/TroyWilson1/ipfs-add-from-encrypted.git

2. Navigate inside the new directory:

cd ipfs-add-from-encrypted

3. Start the IPFS daemon with the following command:

ipfs daemon

4. Run the following command to encrypt a single file, then upload it to IPFS. The output file will contain the encryption key to decrypt the file.

./ipfs-add-from-encrypted.py -i file.txt -n output.out
You will get output resembling the following:
File encrypted and added to IPFS with this hash QmUaWLEYyMPYQpxkknuMkrnSYQfdih2z1qZepy9TcnzUJU

5. Then, navigate to the Filebase web console dashboard. Select the Buckets option from the side bar menu, then select an IPFS bucket or create a new IPFS bucket.

6. Select ‘Upload’ in the upper right corner.

7. Then select ‘CID’:

8. Input the CID returned from the command line and provide a file name to be associated with the CID:

9. Once added, the file will be listed in your bucket:

If you have any questions, please join our Discord server, or send us an email at [email protected]