Storage Functions

How to use Storage model using mitumjs SDK.

(Supported from SDK version 2.1.13 and above)

  1. Create a contract-account first using function of contract class. The account must be deployed on the Mitum network. (use the function contract.touch() or contract.createWallet() & operation.sign())

  2. Create a new storage model using the registerModel() function.

  3. Sign and send the operation to Mitum network. (You can check whether the model information has been properly registered using the getModelInfo() function.)

  4. The owner of the contract-account or handler of the contract can execute create-data operation by using the function createData() to make new data. (dataKey must be unique string value per storage contract.)

  5. Sign and send the operation to Mitum network.

  6. Check current data information with a dataKey through getData().

  7. When you want to update existing data, create an update-data operation with the updateData() function.

  8. It is also possible to delete existing data through the delete-data operation. Use deleteData() function. (If you want to reverse the deletion, overwrite new data with updateData().)

  9. You can search all history for certain data with getDataHistory().

Last updated