Using the REPL
The (R)ead (E)valuate (P)rint (L)oop is a core feature of the CLI node. It allows you to execute direct commands inside a running node without having to code everything into a command or API.
For example you can query the status of the network by executing API.Chain.stats() inside the REPL of a running and online node.
iex(114)> API.Chain.stats()
%{
height: 29984500,
pflops: 27.869284354182614,
circulating: 330546993.68658775,
cur_validator: "6V65RDdHU8T7TbFxGh42sp2hmXrfmRRFbuTjmJv4yysikdNhtdSC2yMxr7L95gDCKn",
emission_for_epoch: 905214.287460235,
next_validator: "7pGZFZpfJbUf8NwqSw84cRvNGabvDdd2SafxvNdTUh7Peus2S1tBv21ETiq46Xg4kb",
tip: %{
hash: "AxUjrFBJQZ4kUac42S6qoELG3iHFwFK4aKwrFVYFfXtU",
tx_count: 1,
header_unpacked: %{
slot: 29984500,
dr: "3UaAR71UXvApB3qCvt6dwwrdgERWKhgcmS68yjSLcKjc",
vr: "22pssGv5SwdJxxD4Q4UwN4upmwQ42ivb8MkY44AW7JczfMTKofjbNirsmAZ6ztAtqdfi1c4w4GZ1MHanqhoRptcKAhU5oTT9P5zboPQ5QKj8sPRigCLmqFAD28cMFMLsDWQT",
prev_hash: "8VHwdFDXYS2LHukKJYa4rxsrTwyrswJ9mYcwtpMoaCom",
signer: "6V65RDdHU8T7TbFxGh42sp2hmXrfmRRFbuTjmJv4yysikdNhtdSC2yMxr7L95gDCKn",
height: 29984500,
prev_slot: 29984499
},
consensus: %{score: 0.848, mut_hash: "4GB4rBv2GGXaQ7TCYPV7THsFzov1KnTkomedKjMW4LN9"}
},
tip_hash: "AxUjrFBJQZ4kUac42S6qoELG3iHFwFK4aKwrFVYFfXtU",
tx_pool_size: 0
}
The future instructions here will all make use of the REPL from an OFFLINE running node. An OFFLINE node does not join the network but can communicate with the RPC API of other nodes.
To run a node in offline mode download the latest amadeusd release from github https://github.com/amadeus-robot/node/releases/latest and run it like:
Last updated