A guide for builders on how to properly create and manage inscriptions on MultiversX

A guide for builders on how to properly create and manage inscriptions on MultiversX

MultiversX is a decentralized blockchain network that aims to revolutionize the way we interact with payments, DeFi, NFTs, AI and everything in real world applications and virtual worlds. Inscriptions could play a crucial role in the vision, enabling the creation of a rich and immersive virtual environment. Also, they are a powerful tool in order to keep track of history, ownership and existence of authenticated data. Everything that is saved and authenticated on blockchain, cannot be rewritten further in the line. So history is going to be safe. Think about safely saving hashes/cryptographic proofs of videos, audios, books, any official documents. All of those are inscriptions, and are in such a form that complete data and verification is off-chain. Practically speaking inscriptions are already on the MultiversX chain, almost from day 1, we have serious companies using txData to save into history tracking (packets, data, certificates).

Specifications

  • Inscriptions are unique and indivisible tokens that can store arbitrary data, such as text, images, audio, or even other inscriptions. The storage should be kept on the txData, not saved into the trie, making it cheaper. Authentication of the data will come from indexers or a set of smart contracts.
  • Inscriptions have a unique identifier, such as a UUID or a random number. This prevents duplication and ensures the integrity of data. The validity of uniqueness is the job of an off-chain process, or at creation time, the job of a Smart Contract.
  • Inscriptions are stored on the blockchain, ensuring immutability and tamper-proof data storage. When a transaction containing an inscription is executed on the chain (it might mean only a transfer from user A to B), the complete transaction is saved in the blockchain database as executed transactions. And using the txHash which can be seen on the blockHeader, any off-chain application can identify the inscription. This ensures that the data stored in inscriptions cannot be altered or deleted.
  • Inscriptions can be owned by users, allowing them to control and manage the data within.
  • Inscriptions can be transferred between users, enabling the sharing and exchange of data. The ownership history of inscriptions can be traced back to their creation, ensuring transparency and provenance. This is essential for tracking the ownership and usage of digital assets.
  • Inscriptions can be used to create sophisticated applications, such as provenance tracking, ownership verification, and smart contracts. They can be programmed to interact with other smart contracts, enabling a wide range of functionalities. This allows for the creation of sophisticated applications that leverage the power of the blockchain. Or inscriptions can even act as self executing programs as well.

Let’s get more technical and go step by step:

1. Create an inscription:

  • Data Preparation: prepare the data that will be stored in the inscription. This can be of any type of data, such as text, images, audio, or even other inscriptions. The data should be in a format that can be serialized into a JSON object.

    • Ensure the data is in a format that can be serialized into a JSON object.
    • Sanitize the data to remove any malicious or invalid characters.
    • Encode the data into a Base64 string for compatibility with the blockchain protocol.
  • Signature Generation: generate a cryptographic signature for the inscription data. This signature will be used to prove that the inscription was created by the owner. It is generated using the owner’s private key.

    • Obtain the owner’s private key.
    • Create a hash of the inscription data using a cryptographic hash function, such as SHA-256.
    • Sign the hash using the owner’s private key.
    • Convert the signature into a Base64 string for storage on the blockchain.
    • Save the hash as an inscription identifier.
  • Inscription Creation: submitting the inscription data, signature, and other metadata to the blockchain network. The blockchain will verify the signature and store the inscription on the ledger.

    • Prepare a transaction object that includes the inscription data, signature, and other metadata.
    • Sign the transaction object using the owner’s private key.
    • Broadcast the transaction to the MultiversX blockchain network.

    Once the transaction is confirmed on the blockchain, the inscription is considered to be created and stored on the ledger. The creator becomes the owner of the inscription, and the inscription can be retrieved and transferred using the owner’s public key.

2. Retrieval/validity of inscriptions:

Once an inscription is created, an off-chain application needs to be created, to monitor the history and track the validity of such information. (Later, we can speak about how this tracking could be created in a smart contract, but that will mean more development, right now it is better to go through the off-chain process as it is needed anyway).

Technically speaking, we need to use the INDEXER data, add a set of validity functions and create the new database of inscriptions. This database can always be recreated by running an import-db, meaning reprocessing the transactions as they were done by the validators. The order of transactions even right now can be taken from indexer/bigQuery implementations which are open sourced.

As the transaction is indexed, the new program has to check whether it is an inscription (is tx.Data an JSON with the needed 3 fields: identifier, data and signature). Owner check: owner field is equal with sender, Signature check: inscription data signed by owner. Also check in case of new inscription creation (sender == destination), that identifier (which is hash of Data) is unique. Only if all these checks go through, then you can add the inscription to the inscriptions DataBase.

Furthermore, every inscription has to keep all its tracking data. From their original owner, to the latest owner. As in the end, this is the way a user can determine whether an InscriptionNFT is the bluechip/official one or not.

3. Transfers of an inscription:

The workings of the owner field.

  • To ensure that inscriptions cannot be created or transferred by anyone other than the owner. The owner field is used to validate the signature of the inscription, which ensures that only the owner can create or transfer the inscription.
  • To allow for the tracking of the ownership history of an inscription. The owner field is stored on the blockchain, which allows anyone to see who the current owner of an inscription is. This can be useful for applications such as provenance tracking and ownership verification.
  • To facilitate the creation of smart contracts that manage inscriptions. Smart contracts can use the owner field to determine who is allowed to perform certain actions on an inscription, such as transferring ownership or modifying the data.

The ownership of an inscription is immutably stored on the blockchain, and the owner field is used to verify that the person transferring the inscription is actually the owner. It ensures that inscriptions can only be transferred to authorized recipients, and it provides a tamper-proof record of the ownership history of each inscription.

In transaction 1, Alice creates an inscription and sets herself as the owner. The owner field is set to Alice’s address, which is a unique identifier that can be used to verify her ownership of the inscription.

In transaction 2, Alice transfers the inscription to Bob. The owner field is updated to Bob’s address, which means that Bob is now the owner of the inscription. This change is recorded on the blockchain, and it is impossible to change the owner field without the owner’s private key.

Examining the ownership history of a CryptoPunk inscription is a crucial step in verifying its authenticity. By tracing the provenance of the inscription back to its creation, you can determine whether it was originally created by the official creator of CryptoPunks. If the inscription can be traced back to the original creator, then there is a strong likelihood that it is authentic. However, if the inscription has been transferred or altered in any way, then its authenticity may be compromised. Here are some specific things to look for when examining the ownership history of a CryptoPunk inscription:

  • The identity of the first owner.
  • The consistency of ownership records: The ownership records should be consistent with each other and with the known provenance of the original CryptoPunk.
  • The absence of any suspicious transactions: There should be no suspicious transactions, such as large transfers or activity from unknown wallets.

Next, let’s discuss trading:

Escrow and Payment: An escrow service can be used to facilitate the transaction. The escrow service will hold the ordinal until the buyer has paid the agreed-upon price. Once the payment is received, the escrow service will transfer the ordinal to the buyer. Threshold signature over an account like this can boost its security.

Digital Marketplace:

One of the harder things on the smart contract is that you cannot actually verify the list of ownership of the inscriptions as it was saved only on txStorage which is not accessible by the SC. One developer could rely on oracles to validate every inscription deposit, but it can cost a lot of gas. Instead of this, the SC could accept simply all the inscriptions thrown at him, and in the frontend the user will see the reliable data.

  1. Inscription Listing:
  • Inscription Description: The seller provides a detailed description of the inscription, including its identifier, type, data, and any relevant metadata. This helps potential buyers understand the inscription and its value.
  • Desired Price: The seller sets a desired price for the inscription, which reflects their assessment of its value and the market conditions. This price is displayed on the marketplace for prospective buyers to see.
  • Marketplace saves data as Alice listed Inscription 0x123.
  • If the same inscription is deposited by Bob as well, on withdrawal of inscriptions, each user can only withdraw the inscription they themselves deposited. In this case, on the marketplace both Inscriptions 0x123 can exist, one has the previous Owner of Bob and the other to Alice. So on withdrawal, Alice will withdraw only the inscriptions whose previous owner is herself.
  1. Bidding Process:
  • Buyer’s Interest: Interested buyers can view the listing and express their interest by submitting bids. The bid amount represents the maximum price they are willing to pay for the inscription.
  • The Buyer will not only Bid for inscription 0x123, but for Inscription 0x123 whose previous owner is Bob
  • Bidding Competition: The marketplace automatically compares bids and determines the highest bidder.
  1. Smart Contract Execution:
  • Bid Acceptance: Once the smart contract identifies the highest bidder, it triggers the acceptance of the bid. This initiates the process of transferring ownership of the inscription to the buyer.
  • Payment Processing: The smart contract will facilitate the payment process.
  • Inscription Transfer: Upon successful payment, the smart contract transfers ownership of the inscription to the buyer. This update is recorded on the blockchain, reflecting the change in ownership.
  1. Ownership Transfer and Completion:
  • Updated Ownership Record: The blockchain maintains an updated record of the inscription’s ownership, reflecting the transfer from the seller to the buyer.
  • Transaction Confirmation: The buyer receives confirmation of the transaction, including the inscription identifier, the purchase price, and the updated ownership record.

Conclusion

Inscriptions are poised to reshape the digital landscape, and developers hold the key to unlocking this transformative potential. Inscriptions offer a groundbreaking solution for securely storing and transferring ownership of unique digital assets, opening up a world of possibilities for innovation and creativity.

From revolutionizing the art world to forging new economies within virtual worlds, inscriptions have the power to transform industries and enhance user experiences. Developers, you are at the forefront of this revolution, with the opportunity to build groundbreaking applications that redefine how we interact with the digital world.

The time is now to seize this opportunity. Embrace inscriptions, explore their boundless potential, and unleash your ingenuity to shape the future of the internet. Join the ranks of those who are pioneering this new era of digital innovation, and leave an indelible mark on the landscape of technology.

7 Likes