Solana India Fellowship - Week[4]

This post is a part of a series of posts documenting my experience as a fellow in the Solana India Fellowship. You can find other posts in this series here.

Week[4]

This week’s talk was given by Jenil from Coinvise. Coinvise solves the meta level problems of token distribution and creation for existing web3 communities. The talk led to an insightful discussion on how to create communities and how to use NFT’s and tokens to build a sustainable economy around the community.

NFT updates on Solana

If you are working with NFT’s on Solana, it is pretty easy to create and deploy NFT’s using the Metaplex Candy machine. This week’s exercise involved creating an NFT marketplace with dynamic NFT’s. For this, I built a Marketplace where the NFT’s change their image based on the time of day.

Creating the marketplace is very easy, there is a cookie-cutter react app available on the metaplex github, which can be used as is. For storing the data relating to the nft on-chain, metaplex uses a standard data format:

pub struct Metadata {
    pub key: Key,
    pub update_authority: Pubkey,
    pub mint: Pubkey,
    pub data: Data,
    pub primary_sale_happened: bool,
    // Whether or not the data struct is mutable, default is not, we have to set it to true.
    pub is_mutable: bool,
    pub edition_nonce: Option<u8>,
    pub token_standard: Option<TokenStandard>,
    pub collection: Option<Collection>,
    pub uses: Option<Uses>,   
}

This data is modifiable by the owner of the mint. Thus, to update the image of an NFT, we simply have to change the uri field in the Data struct.

#[repr(C)]
pub struct Data {
    pub name: String,
    pub symbol: String,
    pub uri: String,
    pub seller_fee_basis_points: u16,
    pub creators: Option<Vec<Creator>>,
}

As is the case with most NFT’s, the uri is just a link to a image file (usually on arweave). Metaplex’s js library has functions to create transactions which update the metadata, so the code is pretty concise. You can take a look at it here.

Other stuff.

I am still working on the backend for Aureus, expect updates soon. We are halfway through the fellowship! 4 more weeks to go.