DERO Atlantis RPC API V2.0¶
This document describes the RPC API for the DERO daemon and wallet which are implemented according to the JSON RPC 2.0 standard.
We will give a description of the available RPC methods with their parameters and results and provide code examples for calling the methods and the data returned.
DERO is the first crypto project to combine a Proof of Work blockchain with a DAG (Directed Acyclic Graph) block structure and wholly anonymous transactions. The fully distributed ledger processes transactions with a twelve-second average block time and is secure against majority hashrate attacks.
DERO will be the first CryptoNote blockchain to have smart contracts on its native chain without any extra layers or secondary blockchains.
For more information visit http://www.dero.io
1.1 Data Types¶
DERO is written in Go, so we give the data types of the parameters and results in Go format. It is pretty straightforward to convert them to other languages.
Amounts in DERO have a resolution of 112 decimals and are handled as unsigned 64 bit integers.
As DERO combines DAG and Blockchain, it uses different height information than traditional blockchains. DERO blocks have an additional height value, called the topological height.
The topological height is unique for each block, while at each blockchain height there can be multiple blocks associated. Each blockchain height contains at least a main block and optional side blocks.
1.2 Code Examples¶
The examples provided for each method are written in Python - using the ’request’ package to build the HTTP request and perform the JSON encoding.
2. Quick Overview¶
3. DERO Daemon RPC Interface¶
When launched, the Dero daemon automatically starts the RPC server interface at port 20206.
You can change the port by using the rpc-bind parameter:
3.2 Methods via POST¶
Most RPC methods work by issuing HTTP POST requests and sending the parameters in the payload.
The method “getblockcount” returns the height of the (currently synced) chain. This is also the currenty unstable height. This method is called without parameters
The method “get_info” returns various info about the daemon and the state of the network. This method has no parameters.
Return a block template (used for mining a block).
Submits a processed blocktemplate_blob and blockhashing_blob to the daemon. The parameter is unnamed as the data is transmitted as array and accessed by-position (see https://www.jsonrpc.org/specification#parameter_structures).
The method “getlastblockheader” returns the latest blockheader of the (currently synced) chain. This is equal to the top unstable height. This method is called without parameters.
The method “getblockheaderbyhash” returns the blockheader for the supplied blocks hash.
The method “getblockheaderbytopoheight” returns the blockheader for the supplied topoheight.
The method “getblockheaderbyheight” returns the blockheader for the supplied blockchain topopplied blockchain topoheight, it does the same as the getblockheaderbytopoheight function.
The method “getblock” returns the data of a block from either the given height or hash.
The method “gettxpool” returns the tx hashes that are currently in the mempool. This method has no parameters.
3.3 Methods via GET¶
For compability reasons, some RPC methods work using HTTP GET requests. Thereby the method name is part of the URL and the parameters are transmitted in the payload.
The method “getheight” returns the different heights of the blockchain. It is called without parameters.
The method “gettransactions” returns the transaction data for a list of transaction IDs in hex and JSON format.
The method “sendrawtransaction” takes a transaction as hex data and submits it into the mem-pool if valid. Various checks are performed to ensure the transaction is valid, however the boolean result fields are not used, so you have to check the “status” value.
The method “is_key_image_spent” is used to check the status of a list of key_images.
4 DERO Wallet RPC Interface¶
To the use the RPC interface, the wallet has to be started with the rpc-server function enabled:
If your machine is accessible from the outside, you should setup a rpc login to access the wallet:
The default port number for the wallet is 20209, but this can be also changed:
Note: the Dero daemon has to also be started to sync up the wallet transactions.
4.2 Methods via POST¶
All wallet RPC methods work by issuing HTTP POST requests and sending the parameters in the payload.
The method “getaddress” method is used to the address from the wallet. This method has no parameters.
The method “getbalance” method is used to get the current balance and unlocked from the wallet. This method has no parameters.
The method “getheight” method is used to get the currently synced blockchain height from the wallet. This method has no parameters.
The method “transfer” method is used to create one or multiple transactions from a list of destinations. The optionally returned tx_key can used to prove that the amount was sent to the address using the Dero block explorer.
The method “transfer_split” is equal to the “transfer” method in 4.2.4 and kept for compatibility reasons.
The method “get_bulk_payments” is used to get a bulk of transactions from a list of payment IDs. Note: The method aborts if atleast one payment ID is not found/invalid.
The method “query_key” is used to query either the secret key in mnemonic form or the view_key in hex form from the wallet.
The method “make_integrated_address” is used to combine a payment_id and normal wallet address to create an integrated address.
The method “split_integrated_address” is used to get the payment_id and normal wallet address from an integrated address.
The method “get_transfer_by_txid” is used to get transaction details for a specific transaction ID.