Storage Functions
How to use Storage model using mitumjs SDK.
(Supported from SDK version 2.1.13 and above)
Create a contract-account first using function of contract class. The account must be deployed on the Mitum network. (use the function
contract.touch()
orcontract.createWallet()
&operation.sign()
)Create a new storage model using the
registerModel()
function.Sign and send the operation to Mitum network. (You can check whether the model information has been properly registered using the
getModelInfo()
function.)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.)Sign and send the operation to Mitum network.
Check current data information with a dataKey through
getData()
.When you want to update existing data, create an update-data operation with the
updateData()
function.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 withupdateData()
.)You can search all history for certain data with
getDataHistory()
.
Last updated