Command Line Tools

more API detail: API Reference

create-key

FunctionDescription
create-key(alias,password)create key
Parameters
aliaskey alias
passwordkey password
Returns
aliaskey alias
xpubpublic key
filekey file path

Example
./bytomcli create-key wen 123456

list-keys

FunctionDescription
list-keysacquire all the keys in node
Parameters
Returnsreturn the object array
aliaskey alias
xpubpublic key
filekey file path

Example
./bytomcli list-keys

delete-key

FunctionDescription
delete-key(xpub,password)delete key
Parameters
xpubpublic key
passwordpassword
Returns
Successfully delete keydelete success
key not found or wrong passwordpublic error or not found
could not decrypt key with given passphrasewrong password

Example

./bytomcli delete-key 7b328361cb360a2dbd289b4fcc94f38b6dcf4b1f1469a96489950146e8d7feb2d8d5254c3d2f6bd0c6cd6ea7be08d5f7672e8bc49c3a9c3b67ad3f8190d1be79 123456`

create-account

FunctionDescription
create-accountcreate account
Parameters
aliasaccount alias
xpub(s)public key
Returns
aliasaccount alias
idaccount id
key_indexthe index of account in node
quorumnumber of signatures
xpubspublic key

Example

./bytomcli create-account test 81b6150ee90b7936a8b21f7f3e5028d9060aef1cc633c13cbbb21183bbf66f3b484bf876468b4278f1421f9b66d55d6a4d71542e20faf908590a39d4e96cc0ed`

list-accounts

FunctionDescription
list-accountsget all accounts in your node
Parameters
Returnsreturn obj array below
id帐户id
alias账户名
key_index帐户在钱包节点中的索引值
quorom签名数,即发送交易时所需的密钥数
xpubs公钥数组

Example./bytomcli list-accounts

delete-account

FunctionDescription
delete-account(alias | accountID)delete account
Parameters
alias or accountIDaccount alias or account id
Returns
Successfully delete accountthe success prompt of delete
fail to find accountthe error of delete

Example

./bytomcli delete-account test  or  ./bytomcli delete-account 0E96GEA9G0A04`

create-account-receiver

FunctionDescription
create-account-receiver(alias | accountID)create new address for account
Parameters
aliasmandatory:account alias
accountIDoptional, account id
Returns
addressaddress
control_programused for transaction

Example

./bytomcli create-account-receiver zhang or ./bytomcli create-account-receiver zhang 0DV0J74K00A02`

list-addresses

FunctionDescription
list-addresses(alias | id)get all addresses in a account
Parameters
alias \ idaccount alias or id
Returnsreturn the object array below
account_aliasaccount alias
account_idaccount id
addressaddress
changeif addresschange when the account change,default true

Example

./bytomcli list-addresses --alias zhang or ./bytomcli list-addresses --id 0DV0J74K00A02`

validate-address

FunctionDescription
validate-address(address)whether the checkout address is legitimate
Parameters
addressaddress
Returns
validlegitimate or not,true is legitimate
is_localwhether the node is local

Example

./bytomcli validate-address sm1qrztgvhxgfy2njgewdhk524uhzhdw03g9l63u48`

create-asset

FunctionDescription
create-assetcreate asset
Parameters
aliasasset alias
xpub(s)public key group
Returns
aliasasset alias
definitionasset definition
idasset id
issuance_programcontrol program of issue asset
quorumnumber of signatures
keysJSONObject,parameter below
asset_derivation_path
asset_pubkey
root_xpub

Example

./bytomcli create-asset GODS 81b6150ee90b7936a8b21f7f3e5028d9060aef1cc633c13cbbb21183bbf66f3b484bf876468b4278f1421f9b66d55d6a4d71542e20faf908590a39d4e96cc0ed`

get-asset

FunctionDescription
get-assetget asset information
Parameters
assetIDasset id
Returns
aliasasset alias
idasset id
issue_programcontrol program of issue asset
key_indexindex of public key
quorumnumber of signatures
raw_definition_bytebyte of asset definition
typeasset type
vm_versionthe version of VM
xpubspublic key group
definitiondefinition of asset, JSONObject below
decimalsprecise digits
descriptiondescription of asset
nameasset alias
symbolasset symbol

Example

./bytomcli get-asset ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`

list-assets

FunctionDescription
list-assetsget all asset information
Parameters
none
Returnsreturn asset array
aliasasset alias
idasset id
issue_programthe control program of issue asset
key_indexindex of public key
quorumnumber of signature
raw_definition_bytebyte of asset definition
typeasset type
vm_versionversion of VM
xpubspublic key group
definitiondefinition of asset, JSONObject below
decimalsprecise digits
descriptiondescription of asset
nameasset alias
symbolasset symbol

Example

./bytomcli list-assets`

list-balances

FunctionDescription
list-balancesget balance in wallet
Parameters
none
Returns
account_aliasaccount alias
account_idaccount id
amountbalance
asset_aliasasset alias
asset_idasset id
asset_definitiondefinition of asset,JSONObject

Example
./bytomcli list-balances

create-access-token

FunctionDescription
create-access-tokencreate token
Parameters
tokenIDtoken id
Returns
created_atcreate time
idid
tokentoken(including password)

Example
./bytomcli create-access-token test

list-access-tokens

FunctionDescription
list-access-tokensget all token
Parameters
none
Returns
created_atcreate time
idtoken id
tokentoken(including password)

Example
./bytomcli list-access-tokens

check-access-token

FunctionDescription
check-access-tokencheck token
Parameters
tokenID
secrettoken password
Returns
Valid access tokenprompt of right token
ERROR invalid tokenprompt of wrong token
ERROR nonexisting access token IDprompt of tokenId doesn't exist

Example

./bytomcli check-access-token test 1061bacc735ae574f84001d617ed17a8302f7c6206481b9f45c7235853e6ab19`

get-block-count

FunctionDescription
get-block-countget current block height number
Parameters
Returns
block_countblock height number

Example./bytomcli get-block-count

get-block-hash

FunctionDescription
get-block-hashthe newest block hash
Parameters
none
Returns
block_hashblock hash

Example./bytomcli get-block-hash

get-block

FunctionDescription
get-block( block_height | block_hash )get block infomation by block height or block hash
Parameters
block_heightblock height
block_hashblock hash
Retruns
hashblock hash
sizeblock size
versionblock version
heightblock height
previous_block_hashprevious block hash
timestamptimetamp of block
transaction_merkle_rootmerkle root value
transaction_status_hashmerkle status
bitsdifficulty bit
noncenonce
difficultydifficulty
idtransaction hash
inputsJSONArray,see below
outputsJSONArray,see below
sizetransaction size
status_failrequest status
time_rangetimetamp of response
versiontransaction version
ParametersDescription
inputs
amoutasset amount
arbitraryexist when coinbase transaction
asset_definitiondefinition of asset, JSONObject
asset_idasset id
typeasset type
ParametersDescription
outputs
addressoutput address
amountamount
asset_definitiondefinition of asset, JSONObject
asset_idasset id
control_programcontrol program of asset
idutxo id
positionoutput position
typeoutput type

Example

./bytomcli get-block 20a31511b7869fc90b849c4d011ccc0b51ee61e742d20034438309236afd78af or ./bytomcli get-block 8031`

get-difficulty

FunctionDescription
get-difficultyget current or specify block difficulty
Parameters
noneif none get current difficulty
hashblock hash(optional)
heightblock height(optional)
Returns
bitsdifficulty bits
difficultydifficulty
hashblock hash
heightblock height

Example

./bytomcli get-difficulty or ./bytomcli get-difficulty --height 8251 or ./bytomcli get-difficulty  --hash 13d8d75dd33fcd277cf9a2d86e71daeab9aac6f8eb06a7505b2766d564720028`

get-block-header

FunctionDescription
get-block-headerget block header detail info by block height or block hash
Parameters
block_heightblock height,optional
block_hashblock hash,optional
Returns
block_headerblock header
rewardblock reward

Example

./bytomcli get-block-header 12 or ./bytomcli get-block-header e3b7cbc56b355cce8f0c827edaa6a154298d5d42ec398b4a47fa4af2f14b0a36`

is-mining

FunctionDescription
is-miningcheck mining or not
Parameters
none
Returns
is_miningtrue mining,false not mining

Example
./bytomcli is-mining

gas-rate

FunctionDescription
gas-rateget gas account when you build this transaction
Parameters
none
Returns
gas_rategas account

Example
./bytomcli gas-rate

set-mining

FunctionDescription
set-miningswitch mining status
Parameters
truestart mining
falsestop mining
Returns
success messagemining status

Example
./bytomcli set-mining true or ./bytomcli set-mining false

build-transaction

FunctionDescription
build-transactionbuild transaction
Parameters
aliasaccount alias
assetasset alias
amounttransaction amount 1BTM = 10^8NEU
addresstransaction target address
typetransaction type
receivercontrol program id,when type = spend
Returns
jsonreturn raw-transaction

Example

./bytomcli build-transaction --alias zhang BTM 1000000000 --type spend --receiver 00145bb44b681e970cf1be37513fe9e39785f56bd72c 
	or ./bytomcli build-transaction --alias zhang BTM 1000000000 --address sm1qtw6yk6q7jux0r03h2yl7ncuhsh6kh4ev92z7pk --type address`

sign-transaction

FunctionDescription
sign-transactionsign for transaction
Parameters
raw-transactionjson data from build transaction
passwordkey password
Returns
jsonsigned json data

Example

【notice:remember add '' in json,or it will show too many parameters】./bytomcli sign-transaction '{"allow_additional_actions":false,"raw_transaction":"070100010161015f65f1a7c13ebd9d687c853dd28fd125702a7d173439969d857cb01b0b98bd4372ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8099c4d5990100011600142412b41a0f48a6dfad726f7b502e557aa39df36b010002013effffffffffffffff   ffffffffffffffffffffffffffffffffffffffffffffffff80ab94ef950101160014a81d7084fcafaa32798e7355284639000aea0d5600013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc03011600145bb44b681e970cf1be37513fe9e39785f56bd72c00","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0100000000000000"],"xpub":"145b584d3de371405e7b6ceba11d69a3ae6f0b22d2ec879f17977f3c51f5f2d14390c20ead68eb2ab4e210ca0958873b28a9635b8c4a29ba74934aa47137c80c"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"9817f7c9a9d8729374cfff24a4b2e400fdfd2cfb4ab09ee339925a9033ab7eb7"}]}]}' --password 12345`

submit-transaction

FunctionDescription
submit-transactionbroadcast transaction
Parameters
jsonthe json return by sign-transaction
Returns
txidtransaction hash

Example

【notice:remember add '' in json,or it will show too many parameters】./bytomcli submit-transaction '{"sign_complete":true,"transaction":{"allow_additional_actions":false,"raw_transaction":"070100010161015fedb1e3ea7fd526a6f5402f95e8b2fd870fa9a766c89b3555b016602aa45197e4ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8099c4d5990100011600142412b41a0f48a6dfad726f7b502e557aa39df36b63024070eb4675106805bd6e72e63d45ee9ff30802106fd11be2d4deac192bc3cb75cbfe5180c9aa1285baae09a93997724d0c8a50cde99c1e619012af7fbce645f809209817f7c9a9d8729374cfff24a4b2e400fdfd2cfb4ab09ee339925a9033ab7eb702013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ab94ef9501011600140478426d17f952005f10a38e6779ecd2dd6bca6500013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc03011600145bb44b681e970cf1be37513fe9e39785f56bd72c00","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0100000000000000"],"xpub":"145b584d3de371405e7b6ceba11d69a3ae6f0b22d2ec879f17977f3c51f5f2d14390c20ead68eb2ab4e210ca0958873b28a9635b8c4a29ba74934aa47137c80c"}],"quorum":1,"signatures":["70eb4675106805bd6e72e63d45ee9ff30802106fd11be2d4deac192bc3cb75cbfe5180c9aa1285baae09a93997724d0c8a50cde99c1e619012af7fbce645f809"],"type":"raw_tx_signature"},{"type":"data","value":"9817f7c9a9d8729374cfff24a4b2e400fdfd2cfb4ab09ee339925a9033ab7eb7"}]}]}}'