Skip to main content

Using the REPL

Start the amadeusd node as an offline CLI, point it at mainnet or testnet, and run API and RPC.API commands from its interactive shell.

The Amadeus node, amadeusd, starts with an interactive Elixir shell: a (R)ead (E)valuate (P)rint (L)oop. You type a command at the iex(1)> prompt and the node runs it. The CLI pages in this section use that shell to create keys and send transactions without writing a program.

Download the node​

Download the latest amadeusd release from github.com/amadeusprotocol/node/releases/latest. The release binary is built for Linux x86-64 (the node is tested on Ubuntu 24.04).

wget https://github.com/amadeusprotocol/node/releases/latest/download/amadeusd
chmod +x amadeusd

Start an offline node​

For the CLI you don't need a synced node. Start it in offline mode:

OFFLINE=true ./amadeusd

An offline node does not join the network and does not sync the chain. It builds and signs transactions locally and sends them, with all other RPC.API.* calls, to the HTTP API at RPC_URL. RPC_URL defaults to https://mainnet-rpc.ama.one.

The node only checks whether OFFLINE is set, not its value, so OFFLINE=false also turns offline mode on. Leave the variable out to run a normal node.

Use the testnet​

To work against the public testnet, set TESTNET and point RPC_URL at the testnet RPC:

OFFLINE=true TESTNET=true RPC_URL=https://testnet-rpc.ama.one ./amadeusd
  • TESTNET makes the node sign transactions under the testnet signing domain. Without it, the testnet rejects your transactions.
  • Write RPC_URL without /api. The node appends the /api/... path itself.
  • Keep OFFLINE set. Without it, TESTNET starts a private Local Testnet instead of connecting to the public one.

See Connect to Testnet for the testnet endpoints and the faucet.

API and RPC.API​

The shell exposes two groups of commands:

ModuleTalks toUse it on
API.* (for example API.Chain.stats(), API.Wallet.balance(pk))The node's own databaseA synced, online node
RPC.API.*The HTTP API at RPC_URLAn offline node

An offline node does not sync, so API.* queries on it don't return live chain data. Use these RPC.API commands instead:

CommandWhat it does
RPC.API.get(path)GET any HTTP API path, for example "/api/chain/stats", and decode the JSON
RPC.API.Wallet.balance(pk, symbol \\ "AMA")Balance of an address
RPC.API.Wallet.transfer(seed64, receiver, amount, symbol \\ "AMA")Sign a transfer and submit it (see Broadcast Transaction)
RPC.API.Wallet.transfer_bulk(seed64, list)Send several transfers, one transaction each
RPC.API.Chain.tx(txid)Look up a transaction by hash
RPC.API.Vault.*Lockup vault operations (create, unlock, set_validator, set_commission and others)

Example: query the chain​

On an offline node, fetch the chain statistics from the RPC:

iex(1)> RPC.API.get("/api/chain/stats")
%{
error: "ok",
stats: %{
burned: 2276198.333172394,
circulating: 598612457.2121049,
cur_validator: "6V44oh2coxjmWTwY6h9jgu5iYJikkaeEADBCQ5SBwv95dfSPJBLB6LbtT9LPBP7ejN",
diff_bits: 22,
emission_for_epoch: 186174.39864689,
height: 90323946,
next_validator: "5ithX2bx9psU7e1VF25UMAQmZQgEFgcifMHJXWafvYoqhPvntyymfus2KF2j6GVssa",
pflops: 0.4447944748157712,
pruned_below_height: 0,
rooted_height: 90323946,
tip: %{
consensus: %{finality_reached: true, mut_hash: "JBVDrQBofpox4qLGWUXjK9vaaWG5zhTE8koyhWrQCT9g", score: 0.7},
hash: "6BMESof1etPvJbBtfG6t2bhGCspS429rz7QG3ogAFtcX",
header: %{height: 90323946, slot: 90323946, ...},
in_main_chain: true,
seen_time_ms: 1794240321341,
tx_count: 5
},
tip_hash: "6BMESof1etPvJbBtfG6t2bhGCspS429rz7QG3ogAFtcX",
total_locked: 111000000.0,
total_supply: 709612457.2121049,
tx_pool_size: 1,
txs_per_sec: 6.58,
validators: %{...},
...
}
}

The output is shortened. The full response has more fields, including supply_computed_at_height, segment_vr_hash and one entry per validator under validators. It is the same data that GET /api/chain/stats returns over HTTP.

On a synced, online node, API.Chain.stats() returns the same map from the node's own database, without the error/stats envelope.

Next steps​