RaiEx v0.2.0 RaiEx View Source
This module contains the definitions of all the RaiBlocks node RPC calls.
Usage
All functions in this module return tuples. The best way to extract the return values is with pattern matching. Keep in mind that the values are all encoded as strings. If a rpc call times out, it will be resent after a short delay.
Examples
{:ok, %{"wallet" => wallet}} = RaiEx.wallet_create()
{:ok, %{"frontier" => frontier}} = RaiEx.account_info(account)
# All functions come with two matching clauses
{:ok, %{"frontiers" => frontiers}} = RaiEx.accounts_frontiers([account], 1)
{:ok, %{"frontiers" => frontiers}} = RaiEx.accounts_frontiers(accounts: [account], count: 1)
# Node is unreachable
iex> RaiEx.wallet_create()
{:error, :econnrefused}
# RPC returns an error
iex> RaiEx.wallet_create()
{:error, reason}
Link to this section Summary
Functions
Returns how many RAW is owned and how many have not yet been received by account
Gets the number of blocks for a specific account
Creates a new account, insert next deterministic key in wallet
Get account number for the public key
Reports send/receive information for an account
Returns frontier, open block, change representative block, balance,
last modified timestamp from local database & block count for account
Get the public key
for account
Lists all the accounts inside wallet
Moves accounts from source
to wallet
Remove account
from wallet
Returns the representative for account
Sets the representative for account
in wallet
Returns the voting weight for account
Returns how many RAW is owned and how many have not yet been received by accounts list
Returns a list of pairs of account and block hash representing the head block for accounts
Returns a list of block hashes which have not yet been received by these accounts
Returns how many rai are in the public supply
Retrieves a json representation of block
Returns the account
containing the block
Reports the number of blocks in the ledger and unchecked synchronizing blocks
Reports the number of blocks in the ledger by type (send, receive, open, change)
Retrieves a json representations of multiple blocks
Retrieves a json representations of blocks
with transaction amount
& block account
Initialize bootstrap to specific IP address and port
Initialize multi-connection bootstrap to random peers
Returns a list of block hashes in the account chain starting at block
up to count
Used to connect to a different endpoint
Returns a list of pairs of delegator names given account
a representative and its balance
Get number of delegators for a specific representative account
Derive deterministic keypair from seed
based on index
Reports the number of accounts in the ledger
Returns a list of pairs of account and block hash representing the head block starting at account up to count
Reports send/receive information for a chain of blocks
Tells the node to send a keepalive packet to address:port
Generates an adhoc random keypair
Derive public key and account number from private key
Divide a raw amount down by the krai ratio
Multiply an krai amount by the krai ratio
Divide a raw amount down by the Mrai ratio
Multiply an Mrai amount by the Mrai ratio
Changes the password for wallet to password
Enters the password in to wallet
Checks whether the password entered for wallet is valid
Begin a new payment session. Searches wallet for an account that’s marked as available and has a 0 balance. If one is found, the account number is returned and is marked as unavailable. If no account is found, a new account is created, placed in the wallet, and returned
End a payment session. Marks the account as available for use in a payment session
Marks all accounts in wallet as available for being used as a payment session
Wait for payment of ‘amount’ to arrive in ‘account’ or until ‘timeout’ milliseconds have elapsed
Returns a list of pairs of peer IPv6:port and its node network version
Returns a list of pending block hashes with amount more or equal to threshold
Check whether block is pending by hash
Posts some json to the RaiBlocks rpc. If the POST is unsuccessful,
it is re-sent @retry_count
many times with a delay of @wait_time
between retries. Callback implementation for RaiEx.RPC
Publish block
to the network
Divide a raw amount down by the rai ratio
Multiply an rai amount by the rai ratio
Receive pending block for account in wallet
Returns receive minimum for node
Set amount
as new receive minimum for node until restart
Returns a list of pairs of representative and its voting weight
Additionally rebroadcast source chain blocks for receive/open up to sources
depth
Tells the node to look for pending blocks for any account in wallet
Tells the node to look for pending blocks for any account in all available wallets
Send amount
from source
in wallet
to destination
enable_control must be set to true
Returns a list of block hashes in the account chain ending at block up to count
Returns a list of pairs of unchecked synchronizing block hash and its json representation up to count
Clear unchecked synchronizing blocks
Retrieves a json representation of unchecked synchronizing block by hash
Retrieves unchecked database keys, blocks hashes & a json representations of unchecked pending blocks starting from key up to count
Check whether account is a valid account number
Retrieves node versions
Add an adhoc private key key to wallet
Returns the sum of all accounts balances in wallet
Returns how many rai is owned and how many have not yet been received by all accounts in
Changes seed for wallet to seed
Check whether wallet contains account
Creates a new random wallet id
Destroys wallet and all contained accounts
Return a json representation of wallet
Returns a list of pairs of account and block hash representing the head block starting for accounts from wallet
Returns a list of pending block hashes with amount more or equal to threshold
Returns the default representative for wallet
Sets the default representative for wallet
Rebroadcast blocks for accounts from wallet starting at frontier down to count to the network
Returns a list of pairs of account and work from wallet
Stop generating work for block
Generates work for block
Retrieves work for account in wallet
Add specific IP address and port as work peer for node until restart
Retrieves work peers
Clear work peers node list until restart
Set work for account in wallet
Check whether work is valid for block
Link to this section Functions
Returns how many RAW is owned and how many have not yet been received by account
.
Gets the number of blocks for a specific account
.
Creates a new account, insert next deterministic key in wallet
.
Get account number for the public key
.
Reports send/receive information for an account
.
Returns frontier, open block, change representative block, balance,
last modified timestamp from local database & block count for account
.
Get the public key
for account
.
Lists all the accounts inside wallet
.
Moves accounts from source
to wallet
.
Node must have enable_control set to ‘true’
Remove account
from wallet
.
Returns the representative for account
.
Sets the representative for account
in wallet
.
Node must have enable_control set to ‘true’
Returns the voting weight for account
.
Returns how many RAW is owned and how many have not yet been received by accounts list.
Returns a list of pairs of account and block hash representing the head block for accounts
.
Returns a list of block hashes which have not yet been received by these accounts
.
Optional threshold
, only returns hashes with amounts >= threshold.
Returns how many rai are in the public supply.
Retrieves a json representation of block
.
Returns the account
containing the block
.
Reports the number of blocks in the ledger and unchecked synchronizing blocks.
Reports the number of blocks in the ledger by type (send, receive, open, change).
Retrieves a json representations of multiple blocks
.
Retrieves a json representations of blocks
with transaction amount
& block account
.
Initialize bootstrap to specific IP address and port
.
Initialize multi-connection bootstrap to random peers.
Returns a list of block hashes in the account chain starting at block
up to count
.
Used to connect to a different endpoint.
Returns a list of pairs of delegator names given account
a representative and its balance.
Get number of delegators for a specific representative account
.
Derive deterministic keypair from seed
based on index
.
Reports the number of accounts in the ledger.
Returns a list of pairs of account and block hash representing the head block starting at account up to count.
Reports send/receive information for a chain of blocks.
Tells the node to send a keepalive packet to address:port.
Generates an adhoc random keypair
Derive public key and account number from private key
.
Divide a raw amount down by the krai ratio.
Multiply an krai amount by the krai ratio.
Divide a raw amount down by the Mrai ratio.
Multiply an Mrai amount by the Mrai ratio.
Changes the password for wallet to password.
enable_control must be set to true
Enters the password in to wallet.
Checks whether the password entered for wallet is valid.
Begin a new payment session. Searches wallet for an account that’s marked as available and has a 0 balance. If one is found, the account number is returned and is marked as unavailable. If no account is found, a new account is created, placed in the wallet, and returned.
End a payment session. Marks the account as available for use in a payment session.
Marks all accounts in wallet as available for being used as a payment session.
Wait for payment of ‘amount’ to arrive in ‘account’ or until ‘timeout’ milliseconds have elapsed.
Returns a list of pairs of peer IPv6:port and its node network version.
Returns a list of pending block hashes with amount more or equal to threshold.
Check whether block is pending by hash.
Posts some json to the RaiBlocks rpc. If the POST is unsuccessful,
it is re-sent @retry_count
many times with a delay of @wait_time
between retries. Callback implementation for RaiEx.RPC
.
Examples
iex> post_json_rpc(%{"action" => "wallet_create"})
{:ok, %{"wallet" => "0000000000000000"}}
iex> post_json_rpc(%{"action" => "timeout"})
{:error, reason}
Publish block
to the network.
Divide a raw amount down by the rai ratio.
Multiply an rai amount by the rai ratio.
Receive pending block for account in wallet
enable_control must be set to true
Returns receive minimum for node.
enable_control must be set to true
Set amount
as new receive minimum for node until restart
Returns a list of pairs of representative and its voting weight.
Additionally rebroadcast source chain blocks for receive/open up to sources
depth.
Tells the node to look for pending blocks for any account in wallet
.
Tells the node to look for pending blocks for any account in all available wallets.
Send amount
from source
in wallet
to destination
enable_control must be set to true
Returns a list of block hashes in the account chain ending at block up to count.
Returns a list of pairs of unchecked synchronizing block hash and its json representation up to count.
Clear unchecked synchronizing blocks.
enable_control must be set to true
Retrieves a json representation of unchecked synchronizing block by hash.
Retrieves unchecked database keys, blocks hashes & a json representations of unchecked pending blocks starting from key up to count.
Check whether account is a valid account number.
Retrieves node versions.
Add an adhoc private key key to wallet.
enable_control must be set to true
Returns the sum of all accounts balances in wallet.
Returns how many rai is owned and how many have not yet been received by all accounts in .
Changes seed for wallet to seed.
enable_control must be set to true
Check whether wallet contains account.
Creates a new random wallet id.
enable_control must be set to true
Destroys wallet and all contained accounts.
enable_control must be set to true
Return a json representation of wallet.
Returns a list of pairs of account and block hash representing the head block starting for accounts from wallet.
Returns a list of pending block hashes with amount more or equal to threshold.
enable_control must be set to true
Returns the default representative for wallet
.
Sets the default representative for wallet.
enable_control must be set to true
Rebroadcast blocks for accounts from wallet starting at frontier down to count to the network.
enable_control must be set to true
Returns a list of pairs of account and work from wallet.
enable_control must be set to true
Stop generating work for block.
enable_control must be set to true
Generates work for block
enable_control must be set to true
Retrieves work for account in wallet.
enable_control must be set to true
Add specific IP address and port as work peer for node until restart.
enable_control must be set to true
Retrieves work peers.
enable_control must be set to true
Clear work peers node list until restart.
enable_control must be set to true
Set work for account in wallet.
enable_control must be set to true
Check whether work is valid for block.