5.4.2.4 FISCO BCOS preset smart contract package
The FISCO preset Smart Contract package is chosen from the Table.sol provided by the FISCO BCOS development team, and can provide developers with basic functions such as insert, remove, update, or query (using Solidity). New DApp developers can learn from this package about FISCO smart contract programming and further extend the functions, if needed. The stored data types supported by this smart contract include int256(int), address, and string, of which string cannot exceed 16MB. To ensure on-chain performance, there is no analysis of duplicate base_id and base_key. This should be handled by the off-BSN system. It is recommended that each base_id has only one corresponding base_key and base_value.
Please click this link to download:
https://github.com/BSNDA/FISCOBaseContract
The preset smart contract functions are as follows:
1. Insert data (insert)
Input parameter description
base_id: the primary key identifier that requires inserting
base_key: the key of the data to be inserted
base_value: the value of the data to be inserted
Example: {"base_id": "1","base_key":1,"base_value":"this is string"}
Of which, base_id and base_value cannot be blank strings and the base_key is in int256 data type.
2. Update data (update)
Input parameter description
base_id: the primary key identifier that requires updating
base_key: the key of the data to be updated
base_value: the value of the data to be updated
Example: {"base_id":"1","base_key":"1","base_value":"this is string"}
Of which, base_id and base_value cannot be blank strings and the base_key is in int256 data type. If the base_id and base_key do not exist, then they cannot be updated; if they already exist, then the data will be updated.
3. Remove data (remove)
Input parameter description
base_id: the primary key identifier that requires removing
base_key: the key of the data to be removed
Example: {"base_id":"1","base_key":"1"}
Of which, the base_id and base_value cannot be blank and must exist, otherwise they cannot be removed.
4. Select data (select)
Input parameter description
base_id: the value of the primary key identifier that requires being selected
Example: {"base_id":"1"}
Of which, the base_id cannot be blank and must exist, otherwise, it is not possible to select the corresponding data.