For an introduction to CC in general, see: Using the Contracts on a Komodo based Blockchain
To enable and test contracts:
- The Blockchain must have the parameter
-ac_ccas described in Using the Contracts on a Komodo based Blockchain
- The Blockchain must be started using the parameter
-pubkeywith a pubkey whose privatekey is owned by only you and imported into the wallet of this particular chain.
Oracles contract is useful for making offchain data available on-chain.
The contract can be used as follows:
- Anyone can create an Oracle using
oraclescreatewhich takes a name, description, expected format of the data as arguments.
- Anyone can register as a publisher of data for an Oracle using
oraclesregisterwhich takes the transaction-id of an Oracle already created and datafee (fee required for each upload of data ) as arguments.
oraclessamplescan be used in that specific order to find the available Oracles, their publishers and data samples from any specific publisher.
- Anyone can subscribe to a particular publisher for an Oracle through
- A publisher can publish data using
oraclesdataand collect the
A tutorial describing the usage of Oracles contract is here
The various formats of data that can be registered for an Oracle and their symbols are as follows:
's' -> <256 char string 'S' -> <65536 char string 'd' -> <256 binary data 'D' -> <65536 binary data 'c' -> 1 byte signed little endian number, 'C' if unsigned 't' -> 2 byte signed little endian number, 'T' if unsigned 'i' -> 4 byte signed little endian number, 'I' if unsigned 'l' -> 8 byte signed little endian number, 'L' if unsigned 'h' -> 32 byte hash"
./komodo-cli -ac_name=ORCL oraclescreate "Oracle1" "testing oracle" "L" # "L" is when the data to be submitted is a 8 byte unsigned little endian number