Acria Substrate Blockchain implemented in Substrate/Rust
One of the most pressing issues when developing smart contracts is the lack of real-world data. But due to technical limitations, such as the consensus protocol, no blockchain has been able to solve this major limitation. The Acria Network solves exactly this problem with the help of so-called Oracle Nodes that don't require a middleman. In addition to this, it offers cross-chain support to supply various blockchains with real-world data.
Welcome to the Acria Substrate Node documentation.
One of the most pressing issues when developing smart contracts is the lack of real-world data. But due to technical limitations, such as the consensus protocol, no blockchain has been able to solve this major limitation. The Acria Network solves exactly this problem with the help of so-called Oracle Nodes that don't require a middleman. In addition to this, it offers cross-chain support to supply various blockchains with real-world data.
(https://acria.network)[https://acria.network]
Please have a look at the doc directory for more information regarding
- How to do the Rust setup
- How to create accounts
- How to do balance transfers
- More details about running a node
Use Rust's native cargo command to build and launch the Acria node:
cargo run --release -- --dev --tmpThe cargo run command will perform an initial build. Use the following command to build the node
without launching it:
cargo build --releaseFor debugging and testing the node, you can use this (web user interface)[https://ipfs.io/ipns/dotapps.io/].
You should select the connection to your node on top left, for example if your node is installed in the same machine you are connecting from,
it will be ws://127.0.0.1 or ws://localhost.
The node offers the following application programming interfaces, accessible from the user interface above:
-
acria.newOracle(oracleid,oracledata), a function to create a new ORACLE, the oracleid is an integer (u32) not already used and in the oracledata is a json structure with the following fields:
- shortdescription - a short description not longer than 64 bytes
- description - a long description not longer than 6144 bytes
- apiurl - an https address as reference for the API, explaining the possible parameters if any.
- fees - amount of fees applied to the requester.
example: {"shortdescription":"xxxxxxxxxxxxxxxxxx","description":"xxxxxxxxxxxxxxxxxxxxxxxxx","apiurl":"https://api.supplier.com/documentation","fees":0.0000001}
-
acria.removeOracle(oracleid), a function to remove an ORACLE, only the original creator can remove it.
-
acria.requestOracleUpdate(oracleaccount,oracleid,parameters), is the function used to request a data update to the Acria Oracle Node. The fees published in the Oracle data, are settled immediately.
The field "parameters" should be a json string to be used to replace the variable in the Oracle endpoint.
For example sending in the "parameters":
{"currencyfrom":"BTC","currencyto","USD"}
to an Oracle with endpoint:
https://api.coingecko.com/api/v3/simple/price?ids=%currencyfrom%&vs_currencies=%currencyto%
will generate a call to:
https://api.coingecko.com/api/v3/simple/price?ids=BTC&vs_currencies=USD
The variable replacement allows a greater flexibility in how to configure the Oracle endpoint.
-
acria.oracleUpdate(oracleid,oracledata), is the internal function used from the Oracle, to update the data on the blockchain.
-
acria.oracle(AccountId,Oracleid), allows to query the data written from the Oracle matching the AccountId and Oracleid. From the user interface you should select "Chain State","Acria", "Oracle".
-
acria.lockOracleStakes(Accountid,amount), allows to lock Acria tokens to the AccountId of an Oracle. The funds are locked in the reserve of the signer and they are not in the availability of the Oracle.
-
acria.unlockOracleStakes(Accountid), allows to unlock all the Acria tokens locked previously to an Oracle. The funds are placed back in the free balance.
For testing you should:
- start the Blockchain node,
- open the user interface web user interface,
- click on "Developer", "Extrinsics", "acria" and "newOracle",
- select "Alice" account that will be the owner of the Oracle
- insert "1" in the "oracleid" field
- insert:
{"shortdescription":"Coingecko - Price BTC/USD","description":"Coingecko collect in real time the transaction from >20 exchanges and calculcate the average price every 60 seconds.","apiurl":"https://www.coingecko.com/","fees":0.1}
in the field "oracledata",
7) Click on "Submit Transaction" and check for the events shown.
You should have stored a public Oracle in your blockchain.
- now start the (Acria Oracle Node)[./oracle-node/README.md] in another screen
- from the web user interface select "acria" and "requestOracleUpdate",
- insert "1" in the field "oracleid" and "na" in the field "parameters" that could used to send some data to the API, in this case "na" = not applicable.
- click on "Submit Transaction",
- check the log of the AON and you should see that it has received the update request from the events generated and it has update the blockchain with its own data.
