Looking for the upgradable avatars? Meta Blocks Avatars are now called 3moji.Learn more
🏛

10. Architecture

What is Metablocks

With MetaBlocks protocol, you could build a system for upgrading existing NFTs. In this blog we will go through the fundamentals of MetaBlocks Protocol and how to start building on it. With this explanation, you should be able to understand how Metablocks work.

Overview

Metablocks Protocol is an upgradable NFT protoocl built on Solana blockchain. Any one could use the protocol to build the upgradable NFTs for their projects.

How does an end-user deposit an NFT

  • First users connect their wallet to an upgradable NFT Dapp.
  • When connected with the wallet, users should be able to see all the NFTs in their wallet
  • Next, user chooses which NFTs to deposit and deposits the NFT.
  • Users can deposit as many NFTs as they like
  • Then after 8 minutes, user should see an upgraded NFT(Meta NFT). This NFT is generated by combining all the NFT deposited into the protocol.

How does an end-user withdraw an NFT

This is straight-forward, the users can withdraw the NFT whenever they want. Once withdrawn, the Meta-NFT is updaded accordingly.

Architecture

There are 3 main programs from which MetaBlocks protocol is built.

  1. Meta Blocks - This is the main program where instructions are residing
  2. Meta Treasury - The treasury where treasury wallets are initialized and updated
  3. Meta NFT - Program to create meta-nfts

Diagram

add diagram here

How does MetaBlocks work ?

Prerequisite - Universe

Users can deposit to any universe they want to. You could imagine universe as a collection from a creator. A create can create universe and ask the NFT holders to deposit their NFTs so they upgrade their NFTs.

Metablocks - Deposit

Before depositing into the Metablocks Protocol, there are a few things required

First create a MetaBlocks Authority -

This is a PDA(Program Derived Address) , this address is used to deposit and withdraw into the Metablocks protocol, hence making the MetaBlocks program as the owner of all the deposited NFTs.

Create Meta-NFT mint -

  • A meta-nft mint is created using mint address of the depositing NFT. If a Meta-NFT mint address is already present then already existing mint is used.
  • Then a Meta-NFT is generated by using the above created meta-nft mint address.
  • The program uses the mint address of the depositing NFT to create a PDA derived mint address
  • The Meta-NFT is then transferred to user's address and is Frozen by default. Meaning, users cannot move their Meta-NFTs out of the wallet.

Init Receipt mint -

  • Again, a mint address is generated using the mint address of the depositing NFT.
  • The program uses the mint address of the depositing NFT to create a PDA derived mint address

Deposit NFT -

  • First, user's NFT is deposited into the vault.
  • Then, a counter is increased in the meta-nft program. This is used to track the number of NFTs deposited into the vault by an user.
  • User gets a receipt NFT in turn for depositing the NFT into the vault. The receipt NFT is generated using the receipt mint that is generated previously. This receipt NFT is frozen by default to prevent the transfer of receipt nfts.

Withdraw NFT -

  • To withdraw the deposited NFT, the user must hold the Receipt-NFT.
  • The Receipt-NFT is burned from the user's wallet.
  • The count is decreased in Meta-NFT program. If there is no more User NFTs are deposited, then Meta-NFT is also burnt
  • All the balance lamports due to burning of NFTs are transferred to user's wallet. (This will be distributed to end user's who hold Metablocks protocol tokens)

Meta Blocks Logo
© 2021
Meta Blocks
This open-source site was built with React Static.
Hosting and deployment courtesy of Cloudflare.
Solana LogoPowered by Solana