To begin with, you need to build the project.
Then, we can start echo_node
and interact with this node using RPC requests over HTTP or WebSocket. For it, you can use echo_wallet
or a third-party program like curl
or wscat
.
You can start a node with different parameters. The parameters are passed using the command-line or the configuration file.
./echo_node --key1=value1 --key2 value2 -k v --key3=["value1", "value2"]
# this is commentkey = value
key
is the argument without a dash
Registrar account have opportunity to register other accounts. For lauching should be specified --account-info
argument with pair of account id and public key and specified --registrar-account
argument with account id.
> ./echo_node --account-info ["1.2.6", "5JwnAdjJWufcv5c2xiEy1Ht8JUfND3o232JTbL2kze4TLhCJEcC"] --registrar-account "1.2.6"
To decrese memory usage specify some history
plugin arguments.
For example you may track only certain contracts or accounts and store not all their history, but only last certain number of operations. Also history
plugin stores the least information about transactions(block number, inxed in block, id of transaction). --max-transaction-ids-to-store
is used to regulate amount of stored transaction_info.
> ./echo_node --track-contract "1.11.1" --track-contract "1.11.2" --track-account "1.2.18" --max-ops-per-contract 100 --max-ops-per-account 100 --max-transaction-ids-to-store 1000
By default echo_node
track all accounts and contracts and store all history and all transactions.
> ./echo_node -h
The data directory contains the configure file, databases, and more.
> ./echo_node -d /tmp/echo_dir> ./echo_node --datadir /tmp/echo_dir
> ./echo_node --testnet
> ./echo_node --devnet
> ./echo_node -v> ./echo_node --version
Run interactive mode to encrypt keys and save them in keys file.
> ./echo_node --configure-keys
Use the config seed only (do not use built-in and received seeds).
> ./echo_node --config-seeds-only
Create a genesis.json at corresponding datadir. Depending on which options preset is selected (mainnet or testnet) it will output different Genesis State.
> ./echo_node --testnet --create-genesis-json --data-dir datadir
Path to create an example Genesis State at. If a well-formed JSON file exists at the path, it will be parsed and any missing fields in a Genesis State will be added, and any unknown fields will be removed. If no file or an invalid file is found, it will be replaced with an example Genesis State.
> ./echo_node --example-genesis-json /tmp/echo_dir
Rebuild object graph by replaying all blocks.
> ./echo_node --replay-blockchain
Delete all blocks and re-sync with network from scratch.
> ./echo_node --resync-blockchain
Force validation of all transactions.
> ./echo_node --force-validate
Replace timestamp from genesis.json with current time plus this many seconds (experts only!).
> ./echo_node --genesis-timestamp 10
Endpoint for P2P node to listen on.
> ./echo_node --p2p-endpoint 127.0.0.1:13375
P2P nodes to connect to on startup (may specify multiple times).
> ./echo_node --seed-node "127.0.0.1:13376" -s "127.0.0.1:13377"
JSON array of P2P nodes to connect to to on startup.
> ./echo_node --seed-nodes "[127.0.0.1:13376, 127.0.0.1:13377]"
Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
> ./echo_node --checkpoint "[10, 0000004184e6200e609bca12f8f54a1cf55704cb]"
Endpoint for websocket RPC to listen on.
> ./echo_node --rpc-endpoint "127.0.0.1:8090"
Domains from which to accept cross origin requests.
> ./echo_node --rpccorsdomain example.com
File to read Genesis State from.
> ./echo_node --genesis-json /tmp/echo_dir/genesis.json
JSON file specifying API permissions.
> ./echo_node --api-access /tmp/echo_dir/api.json
Comma-separated list of plugins which will be activated in addition to default.
> ./echo_node --plugins="sidechain,registration,shapshot"
Generate address in operations for Bitcoin testnet
> ./echo_node --sidechain-btc-testnet
Compress communication channels for this P2P node.
> ./echo_node --p2p-compress
Encrypt communication channels for this P2P node.
> ./echo_node --p2p-encrypt
Enable Echorand, even if the chain is stale.
> ./echo_node --start-echorand
Pairs of [AccountID, WIF private key] (may specify multiple times).
> ./echo_node --account-info ["1.2.6", "5JwnAdjJWufcv5c2xiEy1Ht8JUfND3o232JTbL2kze4TLhCJEcC"]
Sidechain: Pair of [account_id, eth_private_key] that should correspond to committee account (may be specified multiple times).
> ./echo_node --sidechain-eth-committeeman ["1.2.6", "8da4ef21b864d2cc526dbdb2a120bd2874c36c9d0a1fb7f8c63d7f7a8b41de8f"]
> ./echo_node --sidechain
> ./echo_node --eth-rpc-ip 127.0.0.1
> ./echo_node --eth-rpc-port 183332
> ./echo_node --sidechain-eth-disable
Sidechain: Tuple of [account_id, WIF BTC private key] (may specify multiple times).
> ./echo_node --sidechain-btc-committeeman ["1.2.6", "5HueCGU8rMjxEXxiPuD5BDk_SAMPLE_PRIVATE_KEY_DO_NOT_IMPORT_u4MkFqeZyd4dZ1jvhTVqvbTLvyTJ"]
> ./echo_node --btc-rpc-ip 127.0.0.1
> ./echo_node --btc-rpc-port 183332
> ./echo_node --btc-rpc-user user
> ./echo_node --btc-rpc-user password
> ./echo_node --sidechain-btc-disable
ID of registrar account on this node (should be imported as account-info).
> ./echo_node --registrar-account "1.2.6"
Complexity of POW task to register account.
> ./echo_node --registration-difficulty 10
> ./echo_node --ethrpc-registration-task-lifetime 20
Account ID to track history for (may specify multiple times).
> ./echo_node --track-account "1.2.6"
Maximum number of operations per account will be kept in memory.
> ./echo_node --max-ops-per-account 1000
Contract ID to track history for (may specify multiple times).
> ./echo_node --track-contract "1.11.1"
Maximum number of operations per contract will be kept in memory.
> ./echo_node --max-ops-per-contract 1000
Maximum number of transaction info to store in memory.
> ./echo_node --max-transaction-ids-to-store 1000
Keep only those operations in memory that are related to history tracking.
> ./echo_node --partial-operations
Endpoint for EthRPC to listen on.
> ./echo_node --ethrpc-endpoint 0.0.0.0:9091
> ./echo_node --snapshot-at-block 10
> ./echo_node --snapshot-at-time 2020-08-09T18:31:42
> ./echo_node --snapshot-to /tmp/echo/snap.json
To perform operations, we need to connect to the node. Below we consider connecting via curl
.
Example:
curl --data '{"jsonrpc": "2.0", "params": ["database", "get_account_by_name", ["nathan"]], "method": "call", "id": 1}' http://localhost:8090/rpc
Here, we request the Database API using the method get_account_by_name
with the argument "nathan"
Response:
{"id":1,"jsonrpc":"2.0","result":{"id":"1.2.26","registrar":"1.2.4","name":"nathan","active":{"weight_threshold":1,"account_auths":[],"key_auths":[["ECHO6XS3BMVnEHAzo1PhHWt9vndrZn2P27tCbU9WdqCM8sJu",1]]},"echorand_key":"ECHO6XS3BMVnEHAzo1PhHWt9vndrZn2P27tCbU9WdqCM8sJu","active_delegate_share":2000,"options":{"delegating_account":"1.2.5","delegate_share":2000,"extensions":[]},"statistics":"2.5.26","whitelisting_accounts":[],"blacklisting_accounts":[],"whitelisted_accounts":[],"blacklisted_accounts":[],"active_special_authority":[0,{}],"top_n_control_flags":0,"accumulated_reward":[],"extensions":[]}}
In the API methods description, you can find the RPC request body.
To stop the node, send it the SIGINT signal (use Ctrl + C shortcut).