JSON-RPC API
The Synergeia node exposes a JSON-RPC server for interacting with the blockchain. Below are some of the key methods available.
get_block_height()
Returns the current block height of the chain.
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "get_block_height",
"params": []
}
// Response
{
"jsonrpc": "2.0",
"id": 1,
"result": 12345
}
get_block_hash(height: u64)
Returns the hash of the block at the specified height.
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "get_block_hash",
"params": [12345]
}
// Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0000000000000000000a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e"
}
submit_transaction(tx_hex: String)
Submits a signed, serialized transaction in hexadecimal format to the network.
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "submit_transaction",
"params": ["0100000001..."]
}
// Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "transaction_hash"
}
Command-Line Interface (CLI)
The `synergeia-node` binary includes a set of commands for node operation and wallet management.
start-node
Starts the Synergeia node.
cargo run -- --config local_testnet/miner1/config.toml start-node --mode miner
create-wallet
Creates a new wallet and outputs its address and other information.
cargo run -- --config local_testnet/miner1/config.toml create-wallet
print-chain
Prints the current status of the blockchain, including the block height.
cargo run -- --config local_testnet/miner1/config.toml print-chain
stake
Configures the stake for a staker node.
cargo run -- --config local_testnet/staker1/config.toml stake --asset SYN --amount 100000