Transactions are made to the Asset Register using a messaging standard designed to be human readable and familiar to blockchain users using the Ethereum message standard.
Asset Register Transaction Message
To make changes to the asset register you must make transactions using signed Ethereum messages. An Asset Register Transaction Message (ARTM) can be generated using the ARTM SDK and looks like this:
import { useGetARTM } from'@futureverse/asset-registry-react'constPage= () => {const { data: artm } =useGetARTM({ address:signer.address, operations, })// use artm elsewhere in the component}
The artm object is defined in ARTM SDK. Therefore, signing can be done manually and then sent to the Asset Register API using the Asset Mutation, or it can be used with the useAssetMutation hook directly.
Library - ARTM SDK
Under the hood, the React library uses the ARTM SDK. This library is specifically built to enable the creation, signing, and validation of ARTMs. Creating an ARTM message is described in detail on the NPM page.
Nonce
Like a traditional blockchain, the Asset Register uses nonces to prevent replay attacks. The nonce for a chain address can be queried using the Asset Register API as follows:
{"input": { "transaction":"Asset Registry transaction\n\nAn update is being made to your inventory\n\nOperations:\n\nasset-link create\n- equipWith_asmBrain\n- did:fv-asset:1:evm:0x6bca6de2dbdc4e0d41f7273011785ea16ba47182:1000\n- did:fv-asset:1:evm:0x1ea66a857de297471bc12dd12d93853ff6617284:21\nend\n\nOperations END\n\nAddress: 0x225b5333C2D8EC41F40D6463D44141786C2c4463\nNonce: 0",
"signature": "0x282dbd15e2ef7091c8599ce1073e7c0f94cd7a02526b6bc43b84f01f190b457047b34e0d3bb63797872dffa106f33f914d5e6ff6d2e978f39944c6af6efec7691b"
}}