ela-cli is an ELA node command line client for managing user wallets, sending transactions, and receiving blockchain information.
NAME:
ela-cli - command line tool for ELA blockchain
USAGE:
ela-cli [global options] command [command options] [args]
VERSION:
v0.3.1-129-gd74b
COMMANDS:
wallet Wallet operations
info Show node information
mine Toggle cpu mining or manual mine
script Test the blockchain via lua script
rollback Rollback blockchain data
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--rpcuser value username for JSON-RPC connections
--rpcpassword value password for JSON-RPC connections
--rpcport <number> JSON-RPC server listening port <number>
--help, -h show help
--version, -v print the version
RPC Client Parameters
--rpcport
The rpcport parameter specifies the port number to which the RPC server is bound. The default value is 20336.
--rpcuser
The rpcuser parameter is used to set the username of the BasicAuth. The default value is "".
--rpcpassword
The rpcpassword parameter is used to set the password of the BasicAuth. The default value is "".
For example, getting the current height of blockchain:
./ela-cli --rpcport 20336 --rpcuser user123 --rpcpassword pass123 info getcurrentheight
Result:
301
You can configure an ela-cli.sh script to simplify the commands:
Wallet management commands can be used to add, view, modify, delete, and import an account. You can use the ./ela-cli wallet -h command to view help information of the wallet management command.
NAME:
ela-cli wallet - With ela-cli wallet, you could control your asset.
USAGE:
ela-cli wallet command [command options] [args]
COMMANDS:
Account:
create, c Create an account
account, a Show account address and public key
balance, b Check account balance
add Add a standard account
addmultisig Add a multi-signature account
delete Delete an account
import Import an account by private key hex string
export Export all account private keys in hex string
depositaddr Generate deposit address
crosschainaddr Generate cross chain address
Transaction:
buildtx Build a transaction
signtx Sign a transaction
sendtx Send a transaction
showtx Show info of raw transaction
OPTIONS:
--help, -h show help
--wallet , -w
The wallet parameter specifies the wallet path. The default value is "./keystore.dat".
--password , -p
The password parameter is used to specify the account password. You can also enter a password when prompted.
1.1 Create Wallet
The "create account" command is used to create a standard account and store the private key encryption in the keystore file. Each wallet has a default account, which is generally the first account added - the default account cannot be deleted.
Command:
./ela-cli wallet create -p 123
Result:
ADDRESS PUBLIC KEY
---------------------------------- ------------------------------------------------------------------
ESVMKLVB1j1KQR8TYP7YbksHpNSHg5NZ8i 032d3d0e8125ac6215c237605486c9fbd4eb764f52f89faef6b7946506139d26f8
---------------------------------- ------------------------------------------------------------------
1.2 View Public Key
./ela-cli wallet account -p 123
Result:
ADDRESS PUBLIC KEY
---------------------------------- ------------------------------------------------------------------
ESVMKLVB1j1KQR8TYP7YbksHpNSHg5NZ8i 032d3d0e8125ac6215c237605486c9fbd4eb764f52f89faef6b7946506139d26f8
---------------------------------- ------------------------------------------------------------------
The "build transaction" command can create/build raw transaction data. Note that before sending to the ela node, the transaction should be signed by the private key.
--from: The from parameter specifies the transfer-out account address. The default value is the default account of the keystore file.
--to: The to parameter specifies the transfer-in account address.
-- tomany: The tomany parameter specifies the file which saves multiple outputs.
--amount: The amount parameter specifies the transfer amount.
--fee: The fee parameter specifies the cost of the transfer fee.
--outputlock: The outputlock parameter specifies the block height when the received asset can be spent.
--txlock: The txlock parameter specifies the block height when the transaction can be packaged.
To build a multi-output transaction, you need to prepare a file in CSV format that specifies the recipient's address and amount. For example: addresses.csv
The first column is the recipient's address, and the second column is the amount (note that the above is sample data, so you need to fill in your own data when sending the real transaction).
Specify the addresses.csv file with the —tomany parameter.
Multi output address: EY55SertfPSAiLxgYGQDUdxQW6eDZjbNbX , amount: 0.001
Multi output address: Eeqn3kNwbnAsu1wnHNoSDbD8t8oq58pubN , amount: 0.002
Multi output address: EXWWrRQxG2sH5U8wYD6jHizfGdDUzM4vGt , amount: 0.003
Hex: 09020001001235353938383739333333353636383730383501b9932e31681c63ce0425eecb50c2dfc8298bb3e1bcf31b1db648c11f65fd2caf0000ffffffff03b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3a0860100000000000000000021a3a01cc2e25b0178010f5d7707930b7e41359d7e00b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3400d0300000000000000000021ede51096266b26ca8695c5452d4d209760385c3600b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3e09304000000000000000000219d7798bd544db55cd40ed3d5ba55793be4db170a00000000000100232103c5b92b875b9820aba064dd1c93007c8a971fc43d318f7dc7fd6ea1509a424195ac
File: to_be_signed.txn
2.1.4 Build special transaction
2.1.4.1 Build activation transaction
NAME:
ela-cli wallet buildtx activate - Build a tx to activate producer which have been inactivated
USAGE:
ela-cli wallet buildtx activate [command options] [arguments...]
OPTIONS:
--nodepublickey value the node public key of an arbitrator which have been inactivated
--wallet <file>, -w <file> wallet <file> path (default: "keystore.dat")
--password value, -p value wallet password
The nodepublickey parameter is used to specify the node public key of an arbiter.
The account associated with node publickey must exist in the specified keystore file. If the nodepublickey parameter is not set, the publickey of the main account in the keystore file is used by default.
NAME:
ela-cli wallet buildtx vote - Build a tx to vote for candidates using ELA
USAGE:
ela-cli wallet buildtx vote [command options] [arguments...]
OPTIONS:
--for <file> the <file> path that holds the list of candidates
--amount <amount> the transfer <amount> of the transaction
--from <address> the sender <address> of the transaction
--fee <fee> the transfer <fee> of the transaction
--wallet <file>, -w <file> wallet <file> path (default: "keystore.dat")
--password value, -p value wallet password
--for
The for parameter is used to specify the file which saves multiple candidates' public keys.
--amount
The amount parameter is used to specify the number of votes.
To build a voting transaction, you need to prepare a file that specifies the candidates' public key.
NAME:
ela-cli wallet buildtx crosschain - Build a cross chain tx
USAGE:
ela-cli wallet buildtx crosschain [command options] [arguments...]
OPTIONS:
--saddress <address> the locked <address> on main chain represents one side chain
--amount <amount> the transfer <amount> of the transaction
--from <address> the sender <address> of the transaction
--to <address> the recipient <address> of the transaction
--fee <fee> the transfer <fee> of the transaction
--wallet <file>, -w <file> wallet <file> path (default: "keystore.dat")
--saddress The saddress parameter is used to specify the locked address on main chain which represents one side chain
--to The to parameter is used to specify the target address on side chain
NAME:
ela-cli info - With ela-cli info, you could look up node status, query blocks, transactions, etc.
USAGE:
ela-cli info command [command options] [args]
COMMANDS:
getconnectioncount Show how many peers are connected
getneighbors Show neighbor nodes information
getnodestate Show current node status
getcurrentheight Get best block height
getbestblockhash Get the best block hash
getblockhash Get a block hash by height
getblock Get a block details by height or block hash
getrawtransaction Get raw transaction by transaction hash
getrawmempool Get transaction details in node mempool
OPTIONS:
--help, -h show help
NAME:
ela-cli mine - Toggle cpu mining or manual mine
USAGE:
ela-cli mine [command options] [args]
DESCRIPTION:
With ela-cli mine, you can toggle cpu mining or discrete mining.
OPTIONS:
--toggle value, -t value use --toggle [start, stop] to toggle cpu mining
--number value, -n value user --number [number] to mine the given number of blocks
4.1 Start CPU Mining
./ela-cli mine -t start
Result:
mining started
4.2 Stop CPU Mining
./ela-cli mine -t stop
Result:
mining stopped
4.3 Discrete Mining
-n
The n parameter is used to specify the number of blocks you want to mine.
NAME:
ela-cli rollback - Rollback blockchain data
USAGE:
ela-cli rollback [command options] [args]
DESCRIPTION:
With ela-cli rollback command, you could rollback blockchain data.
OPTIONS:
--height value the final height after rollback (default: 0)
The height parameter is used to set the final height after rollback.
./ela-cli rollback --height 20
Result:
current height is 22
blockhash before rollback: 74858bcb065e89840f27b28a9ff44757eb904f1a7d135206d83b674b9b68fd4e
blockhash after rollback: 0000000000000000000000000000000000000000000000000000000000000000
current height is 21
blockhash before rollback: 18a38afc7942e4bed7040ed393cb761b84e6da222a1a43df0806968c60fcff8a
blockhash after rollback: 0000000000000000000000000000000000000000000000000000000000000000