4EVERLAND + Lens Protocol
Last updated
Last updated
The Lens Protocol is a Web3 social graph on the Polygon Proof-of-Stake blockchain. It is designed to empower creators to own the links between themselves and their community, forming a fully composable, user-owned social graph. The point of this guide is a focused guide showing how to create and store your post metadata on IPFS/Arweave via 4EVERLAND.For additional information about creating a post on Lens, please visit the lens documents.What you can expect in this tutorial:
Use 4EVERLAND to upload post assets to IPFS/Arweave.
Generate structured metadata for your post and upload it to IPFS/Arweave using 4EVERLAND.
When generating a new Lens Protocol post, use the URL created in the previous step as the content URI.
If your social post involves images, video or audio files, you can upload your files to IPFS/Arweave via 4EVERLAND in a number of optional ways:
CLI: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/index.html
SDK: https://aws.amazon.com/developer/tools/
4EVERLAND API : S3-Compatile API, Pinning Services API
Various tools: https://docs.4everland.org/storage/bucket/bucket-tools
Either way, after you have uploaded the files, you can get the cid/arhash of the files and place them in the metadata.
https://github.com/lensterxyz/lenster/pull/954
https://github.com/lenstube-xyz/lenstube/blob/main/packages/utils/functions/uploadToIPFS.ts
You can find out how to create almost any type of post in the full Lens Protocol metadata specification. In this case, we assume that we have an image post which is stored in IPFS. The metadata is as follows:
The function uuid()
generates a unique post id using the UUID npm package.
If the image is stored in Arweave, please replace the url in the metadata involving the image with the Arweave hash, e.g: https://arweave.net/CO9EpX0lekJEfXUOeXncUmMuG8eEp5WJHXl9U9yZUYA.
Uploading structured JSON data to IPFS/Arweave using 4EVERLAND is a breeze. The following is an example of taking a metadata stringfy and uploading it to the 4EVERLAND Bucket via the AWS-S3 API.
If you want to store your metadata on Arweave, you will need to turn on "Sync to AR" in the Dashboard.
After successfully uploading your metadata, you can convert the cid or arhash of the metadata to contentURI
.The contentURI
can be an IPFS or Arweave hash, formatted as follows:
Lastly, generate a post request with the created content URI and send it to the Lens contract calling via the.post()
or.postWithSig()
functions.
That's it! You have just used a few lines of code to combine 4EVERLAND + Lens Protocol to create and store your post metadata on IPFS and Arweave.