Operations
Blockchain state can be accessed using state access operations. There are two types of operations, read operation and write operation, and they are again classified into two categories: simple operation and composite operation. Simple operations are those that have only one access reference point (i.e., data path in the blockchain database), while composite operations have multiple access reference points.
Read Operations
There is no permission required for read operations.
Simple Operations
Target | Operator | Parameters | Action |
value | GET_VALUE | ref | Get the value on the path reference |
rule | GET_RULE | ref | Get the rule config on the path reference |
owner | GET_OWNER | ref | Get the owner config on the path reference |
function | GET_FUNCTION | ref | Get a triggering function hash on the path reference |
rule | EVAL_RULE | ref, address, value, timestamp | Evaluate the rule config on the path reference |
owner | EVAL_OWNER | ref, address | Evaluate the owner config on the path reference |
Composite Operations
Target | Operator | Parameters | Action | Rule requirements |
value, rule, owner, or function | GET | op_list (list of get operations) | Get multiple path-value, path-rule, path-owner, or path-function pairs | None |
Write Operations
Each write operation has permission requirements depending on its type and path reference.
Simple Operations
Target | Operator | Parameters | Action | Required Permission |
value | SET_VALUE | ref, value | Set the value on the path reference | Value write permission on the path |
value | INC_VALUE | ref, value | Increment the value on the path reference by delta | Value write permission on the path |
value | DEC_VALUE | ref, value | Decrement the value on the path reference by delta | Value write permission on the path |
rule | SET_RULE | ref, rule | Set the rule on the path reference | Rule write permission on the path |
owner | SET_OWNER | ref, owner | Set the owner on the path reference | Owner write permission on the path |
function | SET_FUNCTION | ref, funcHash | Set a triggering function on the path reference | Function write permission on the path |
Composite Operations
There are two composite write operations, SET and BATCH:
Target | Operator | Parameters | Action | Rule requirements |
value, rule, owner, or function | SET | op_list (an array of operations) | Set multiple path-value, path-rule, path-owner, or path-function pairs | Write permission on all the paths |
value, rule, owner, or function | BATCH | tx_list (an array of transactions) | Handle each transaction independently | Write permission on the paths of each transaction |
The SET and BATCH operations can be compared as follows:
Comparison | SET Operation | BATCH Operation |
structure | Has multiple operations in op_list | Has multiple transactions in tx_list |
atomicity | The whole operation fails if one of the operation in op_list fails | The transactions in tx_list are executed independently, i.e., failure of one transaction does not affect other transactions |
order | Broadcasted in a bundle and executed in the given order | Broadcasted in a bundle and executed in the given order |
Last updated