Client
Please see here for downloading or creating a SCDO client.
Command Line Options
Full Node Client
client -h
NAME:
client - interact with a full node
USAGE:
client [global options] command [command options] [arguments...]
COMMANDS:
call call contract
deckeyfile Decrypt key file
domain system domain name commands(in development)
dumpheap dump heap for profiling, return the file path
getbalance get balance info
getblock get block by height or hash
getblockheight get block height
getblocktx get transaction by block height or block hash
getblocktxbyhash get the transactions by block hash
getblocktxbyheight get the transactions by block height
getblocktxcount get block transaction count by block height or block hash
getchangedaccounts get accounts that are modified
getdebtbyhash get debt by debt hash
getdebts get pending debts
getinfo get node info
getlogs get logs
getnonce get account nonce
getpendingtxs get pending transactions
getreceipt get receipt by transaction hash
getscdoforkheight get Scdo fork height
getshardnum get account shard number
gettxbyhash get transaction by transaction hash
gettxfromaccount get transaction from one account at specific height or blockhash
gettxinblock get transaction by block height or block hash with index of the transaction in the block
gettxpoolcontent get transaction pool contents
gettxpoolcount get transaction pool transaction count
gettxtoaccount get transaction to one account at specific height or blockhash
htlc Hash time lock contract commands(in development)
key generate key with or without shard number
miner miner commands
p2p p2p commands
payload generate the payload according to the abi file and method name and args
savekey save private key to a keystore file
sendtx send transaction to node
sign generate a signed transaction and print it out
subchain system sub chain commands(in development)
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
Light Node Client
light -h
NAME:
light - interact with a light node process
USAGE:
light [global options] command [command options] [arguments...]
COMMANDS:
deckeyfile Decrypt key file
getaccounttx get transaction of one account at specific height of blockhash
getbalance get balance info
getblock get block by height or hash
getblockheight get block height
getblocktx get transaction by block height or block hash
getblocktxbyhash get transactions at the specific block hash
getblocktxbyheight get transactions at the specific block height
getblocktxcount get block transaction count by block height or block hash
getchangedaccounts get accounts that are modified
getgasprice get transaction gas price by transaction hash
getnonce get account nonce
getpendingtxs get pending transactions
getreceipt get receipt by transaction hash
getscdoforkheight get Scdo fork height
getshardnum get account shard number
gettxbyhash get transaction by transaction hash
gettxfromaccount get transaction from one account at specific height or blockhash
gettxinblock get transaction by block height or block hash with index of the transaction in the block
gettxpoolcontent get transaction pool contents
gettxpoolcount get transaction count in the transaction pool
gettxtoaccount get transaction to one account at specific height or blockhash
key generate key with or without shard number
p2p p2p commands
payload generate the payload according to the abi file and method name and args
savekey save private key to a keystore file
sendtx send transaction to node
sign generate a signed transaction and print it out
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
Client Command List
Command
Full
Light
Call
This method is used to call the functions of a contract. The functions to be called should not alter the state of the contract. If the functions can alter the state of the contract, you should use sendtx
instead of call
. Please see how to develop and deploy contracts on SCDO for more details.
Type
Template
Console
client call --address <string> --payload <string> --to <string> --height <int>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
height
:int64
- block height (default: -1, indicating the most recent block height); if the height is 10000, then the functions of the contract are called based on the contract state at height 10000payload
:string
- bytecodes containing information of which function to call and function inputsto
:string
- contract address
Returns
contract
:string
- contract addressfailed
:bool
- contract executes successfully or notpoststate
:string
- state trie root hash after transaction executionresult
:string
- transaction resulttotalFee
:int64
- transaction feetxhash
:string
- transaction hashusedGas
:int64
- transaction gas
Example
When using the example below, the contract must be deployed first. The solidity code file:
pragma solidity ^0.4.0;
contract SimpleStorage {
uint storedData=23;
function set(uint x) {
storedData=x;
}
function get() constant returns(uint) {
return storedData;
}
}
As you can see, the example is testing the get function.
// Request
client call --payload 0x6d4ce63c --to 0x9df8ed11ea024183bd584480e80952c9b04e0122 --height -1
// Result
succeeded in calling a contract
{
"contract": "0x",
"failed": false,
"poststate": "0x7c8b22f29b0f9e4db9d61264d3ea6bb8fdff412fc667d411a5e9e98205d36197",
"result": "0x0000000000000000000000000000000000000000000000000000000000000005",
"totalFee": 101,
"txhash": "0x16330ce64136bd756491d4685b4fadd1d81fc36e88eff7987d1784bec466da77",
"usedGas": 424
}
Deckeyfile
This method is used to decode the keystore file to account address and private key. You will be asked to type in the password of the keystore file.
Type
Template
Console
client deckeyfile --file <string>
Parameters
file
:string
keystore file
Returns
Account
:string
- account addressPrivate key
:string
- private key
Example
// Request
client deckeyfile --file .keystore-shard-1-4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21
// Result
Please input your key file password:
Account: 4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21
Private key: 0xf65e40c6809643b25ce4df33153da2f3338876f181f83d2281c6ac4a987b1479
GetBalance
This method returns the balance of the given account.
Type
Template
Console
client getbalance --account <string> --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
account
:string
- account addresshash
:string
- hash value in hexheight
:int64
- block height or current block height for negative value (default: -1)
Returns
Account
:string
- accountBalance
:big.Int
- account balance
Example
// Request
client getbalance --account 4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21
// Result
{
"Account": "4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21",
"Balance": 261899990000
}
GetBlock
This method is used to obtain the block content of given block height or block hash.
Type
Template
Console
client getblock --height -1 --hash <string>(--height <int>) --fulltx=true --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
hash
:string
- block hashheight
:string
- block heightfulltx
:bool
- whether to include detailed transaction information; can use-f
instead of--fulltx
Returns
debts
:array
- debts in blockHash
:string
- debts hashData
:json
- debts dataTxHash
:string
- txhash in debtShard
:int
- shard number of SCDO node where debts onAccount
:array
- debt accountAmount
:int64
- debt amountFee
:int64
- debt feeCode
:string
- debt codehash
:string
- block hashheader
:json
- block headerCreateTimestamp
:uint64
- create timestampCreator
:string
- creator addressDebtHash
:string
- debts hashDifficulty
:big.Int
- block difficultyExtraData
:string
- extra dataHeight
:unit64
- block heightNonce
:unit64
- block noncePreviousBlockHash
:string
- previous block hashReceiptHash
:string
- Receipts hashstateHash
:string
- state tree hashTxDebtHash
:string
- debts hashTxHash
:string
- tx hashtotalDifficulty
:big.Int
- total difficultytransactions
:array
- transaction arrayaccountNonce
:unit64
- account nonceamount
:Int
- transaction amountgasLimit
:Int
- transaction gas limitgasPrice
:Int
- transaction gas pricefrom
:string
- transaction providerhash
:string
- transaction hashpayload
:array
- transaction payloadtimestamp
:big.Int
- timestampto
:string
- transaction receivertxDebts
:array
- transaction debtsData
:json
- txDebts dataAccount
:string
- transaction accountAmount
:int
- transaction amountCode
:string
- transaction codeFee
:int
- transaction feeShard
:int
- transaction shard numberTxHash
:string
- transaction hashHash
:string
- txDebts hash
Example
// Request
client getblock --height 10368 --fulltx=true
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"debts": [
{
"Hash": "0x0da1ed893e7f0ca2558c193b3b82ed20575a6978bea5b14f282309c69fee368e",
"Data": {
"TxHash": "0x58752f8aeb2c69dd2c32059d3ad8b2d3d860c6d92aa2b3b30ff985e564f60fae",
"Shard": 2,
"Account": "0x0ea2a45ab5a909c309439b0e004c61b7b2a3e831",
"Amount": 10000,
"Fee": 0,
"Code": ""
}
}
],
"hash": "0x000002069d9de64bad509239e2a121afbf7de183576457a1d1fb077d19fa3e8c",
"header": {
"PreviousBlockHash": "0x000001cba2c0b82402b3d2d2ad49f50ca0b21aee18c8123486377b2ec93aa0e0",
"Creator": "4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21",
"StateHash": "0x8af14975f636ace27571cfcdcd9a1a1b4a5b15228977cf6207e82f63abf96ffd",
"TxHash": "0xdb00575ff0cc0de89bd6c1799d37e5f600687963785176ca76e81bebfde6a03f",
"ReceiptHash": "0x02fa1d68e7bbf0b833f6e8719efb11b32c7f760e4ae050a4f9b58b8dd8ad1620",
"TxDebtHash": "0x58d7c36b25a715f5076ccb878940920f6bb333ab142287452509f881103960d2",
"DebtHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Difficulty": 6563003,
"Height": 10368,
"CreateTimestamp": 1539050098,
"Nonce": 17825487295277268182,
"ExtraData": ""
},
"totalDifficulty": 68985339754,
"transactions": [
{
"accountNonce": 0,
"amount": 150000000,
"from": "0x0000000000000000000000000000000000000000",
"gasLimit": 0,
"gasPrice": 0,
"hash": "0x6fb17b265260caed33b4e8f58ad84b508dd8950b9bc93dae8518fc96912f76bb",
"payload": "",
"timestamp": 1539931510,
"to": "0xd5a145191b7ca9cb4f3dc850e426c1e853d2a9f1"
},
{
"accountNonce": 280,
"amount": 10000,
"from": "0xec759db47a65f6537d630517f6cd3ca39c6f93d1",
"gasLimit": 21000,
"gasPrice": 1,
"hash": "0xf526dc404145cd409601e951fec4f2222f3abf578381cdaaea9db3a791a79cbd",
"payload": "",
"timestamp": 0,
"to": "0xa00d22dc3624d4696eff8d1641b442f79c3379b1"
}
],
"txDebts": [
{
"Hash": "0xe1c24a636a7c27aea7c384f6eb61eb49168129105f4c081ffa8ca7e77198b3f6",
"Data": {
"TxHash": "0x0b30a6edf95a16933a0a77ffd3eb15680d4e3cb79466f21c1181c013a68eae62",
"Shard": 2,
"Account": "0x0ea2a45ab5a909c309439b0e004c61b7b2a3e831",
"Amount": 10000,
"Fee": 0,
"Code": ""
}
}
]
}
}
// Request
client getblock --hash 0x000002069d9de64bad509239e2a121afbf7de183576457a1d1fb077d19fa3e8c --fulltx=true
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"debts": [
{
"Hash": "0x0da1ed893e7f0ca2558c193b3b82ed20575a6978bea5b14f282309c69fee368e",
"Data": {
"TxHash": "0x58752f8aeb2c69dd2c32059d3ad8b2d3d860c6d92aa2b3b30ff985e564f60fae",
"Shard": 2,
"Account": "0x0ea2a45ab5a909c309439b0e004c61b7b2a3e831",
"Amount": 10000,
"Fee": 0,
"Code": ""
}
}
],
"hash": "0x000002069d9de64bad509239e2a121afbf7de183576457a1d1fb077d19fa3e8c",
"header": {
"PreviousBlockHash": "0x000001cba2c0b82402b3d2d2ad49f50ca0b21aee18c8123486377b2ec93aa0e0",
"Creator": "4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21",
"StateHash": "0x8af14975f636ace27571cfcdcd9a1a1b4a5b15228977cf6207e82f63abf96ffd",
"TxHash": "0xdb00575ff0cc0de89bd6c1799d37e5f600687963785176ca76e81bebfde6a03f",
"ReceiptHash": "0x02fa1d68e7bbf0b833f6e8719efb11b32c7f760e4ae050a4f9b58b8dd8ad1620",
"TxDebtHash": "0x58d7c36b25a715f5076ccb878940920f6bb333ab142287452509f881103960d2",
"DebtHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Difficulty": 6563003,
"Height": 10368,
"CreateTimestamp": 1539050098,
"Nonce": 17825487295277268182,
"ExtraData": ""
},
"totalDifficulty": 68985339754,
"transactions": [
{
"accountNonce": 0,
"amount": 150000000,
"from": "0x0000000000000000000000000000000000000000",
"gasLimit": 0,
"gasPrice": 0,
"hash": "0x6fb17b265260caed33b4e8f58ad84b508dd8950b9bc93dae8518fc96912f76bb",
"payload": "",
"timestamp": 1539931510,
"to": "0xd5a145191b7ca9cb4f3dc850e426c1e853d2a9f1"
},
{
"accountNonce": 280,
"amount": 10000,
"from": "0xec759db47a65f6537d630517f6cd3ca39c6f93d1",
"gasLimit": 21000,
"gasPrice": 1,
"hash": "0xf526dc404145cd409601e951fec4f2222f3abf578381cdaaea9db3a791a79cbd",
"payload": "",
"timestamp": 0,
"to": "0xa00d22dc3624d4696eff8d1641b442f79c3379b1"
}
],
"txDebts": [
{
"Hash": "0xe1c24a636a7c27aea7c384f6eb61eb49168129105f4c081ffa8ca7e77198b3f6",
"Data": {
"TxHash": "0x0b30a6edf95a16933a0a77ffd3eb15680d4e3cb79466f21c1181c013a68eae62",
"Shard": 2,
"Account": "0x0ea2a45ab5a909c309439b0e004c61b7b2a3e831",
"Amount": 10000,
"Fee": 0,
"Code": ""
}
}
]
}
}
GetBlockHeight
This method is used to obtain the height of the blockchain.
Type
Template
Console
client getblockheight --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:uint64
- current block height
Example
// Request
client getblockheight
// Result
1928
GetBlockTx
This method is used to obtain the transactions in the block of given block height or block hash.
Type
Template
Console
client getblocktx --height -1 --hash <string>(--height <int>) --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
hash
:string
- block hashheight
:string
- block height
Returns
result
: transaction array
Example
// Request
client getblocktx --height 10368
// Result
[
{
"transaction 1": {
"accountNonce": 0,
"amount": 600000000,
"from": "0S0000000000000000000000000000000000000000",
"gasLimit": 0,
"gasPrice": 0,
"hash": "0xfdbf16dddfd1267ad97a774cdc937aaf1c64a0219a931a917ac7a8ac37bd0b00",
"payload": "",
"signature": {
"Sig": ""
},
"to": "1S0117411196d28ba12ef3f60e30b2c902ea8e99d1"
}
}
]
GetBlockTxByHash
Similar to GetBlockTx.
GetBlockTxByHeight
Similar to GetBlockTx.
GetBlockTxCount
This method is used to obtain the number of transactions in the block based on block height or hash.
Type
Template
Console
client getblocktxcount --height -1 --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
hash
:string
- hash value in hexheight
:int64
- block height (default: -1)
Returns
result
:int
- number of transaction
Example
// Request
client getblocktxcount --height 4202
// Result
2
// Request
client getblocktxcount --hash 0x0000015592fab87d6efa10e63d7722f6f359d90a1aff9e70930b291931c34922
// Result
2
GetChangedAccounts
This method is used to obtain the accounts that have a change of status in the block of given block height or block hash
Type
Template
Console
client getchangedaccounts --hash <string> (--height <int>) --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
hash
:string
- block hash value in hexheight
:int64
- block height
Returns
account count
:int64
- the count of the changed accountsaccounts
:array
- a list of the changed accountsblockHash
:string
- block hash
Example
// Request
client getchangedaccounts --height 15 --address 127.0.0.1:8027
// Result
{
"account count": 1,
"accounts": [
"1S0119911196d28ba12ef3f60e30b2c302ea8e9961"
],
"blockHash": "0x04a77767ce3224ead593a28b89d3f0c51181dc68e6d2ef90076c5ebf996cdb97"
}
GetDebtByHash
This method is used to obtain the content of a debt based on its hash.
Type
Template
Console
client getdebtbyhash --hash <string> --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
hash
:string
- hash value in hex
Returns
blockHash
:string
- block hash of the block that includes the debtblockHeight
:int64
- block height of the block that includes the debtdebt
:json
- debt jsonData
:json
- debt dataAccount
:string
- debt accountAmount
:int64
- debt amountCode
:string
- debt codeFee
:int64
- debt feeShard
:int
- shard number of SCDO node where the debt is inTxHash
:string
- txhash in debtHash
:string
- debt hashdebtIndex
:json
- debt index jsonBlockHash
:string
-block hash of the block that includes the debtIndex
:string
- index of the debt in the blockstatus
:string
- debt status
Example
// Request
client getdebtbyhash --hash 0x0da1ed893e7f0ca2558c193b3b82ed20575a6978bea5b14f282309c69fee368e
// Result
{
"blockHash": "0x000001a8946d75258f9e269d516e797779ca6bd4b190c701f81456c60958c688",
"blockHeight": 1112,
"debt": {
"Data": {
"Account": "0x0ea2a45ab5a909c309439b0e004c61b7b2a3e831",
"Amount": 10000,
"Code": "",
"Fee": 0,
"Shard": 2,
"TxHash": "0x58752f8aeb2c69dd2c32059d3ad8b2d3d860c6d92aa2b3b30ff985e564f60fae"
},
"Hash": "0x0da1ed893e7f0ca2558c193b3b82ed20575a6978bea5b14f282309c69fee368e"
},
"debtIndex": {
"BlockHash": "0x000001a8946d75258f9e269d516e797779ca6bd4b190c701f81456c60958c688",
"Index": 0
},
"status": "block"
}
GetDebts
This method returns the pending debts in the debt pool
Type
Template
Console
client getdebts --address <address>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:json
- a list of pending debts
GetInfo
This method returns node information.
Type
Template
Console
client getinfo --address <address>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
BlockAge
:int64
- the age of the current blockCoinbase
:string
- the coinbase of the nodeCurrentBlockHeight
:uint64
- the current block heightHeaderHash
:string
- block hash of the current blockMinerStatus
:string
- miner statusPeerCnt
:string
- total peer connections and peer connections for each shard. 8 (1 2 3 2) means the node is connecting to a total number of 8 peers. Among them, 1 peer is in shard 1, 2 peers is in shard 2, 3 peers is in shard 3, 2 peers is in shard 2.Shard
:uint64
- shard number of the nodeVersion
:string
- the version of SCDO node
Example
// Request
client getinfo
// Result
{
"BlockAge": 16,
"Coinbase": "1S01a64ed0a476b1b128e7b196a3ebb34662825231",
"CurrentBlockHeight": 3007759,
"HeaderHash": "0xa3a3aa50801e539f51c6b55b1be9cb6319dc826959d8e6960133dd954211ca95",
"MinerStatus": "Running",
"PeerCnt": "161 (15 80 23 43)",
"Shard": 1,
"Version": "Scdo_V1.0.0"
}
GetLogs
This method gets the event logs by block height, the contract address, and the event name.
Type
Template
Console
client getlogs --height <block height> --contract <string> --abi <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
height
:int64
- block height (default: -1)contract
:string
- contract addressabi
:string
- the abi file of contractevent
:string
- the event name of contract
Returns
response
:struct
- response parameter structTxhash
:string
- transaction hashLogIndex
:uint
- log index in receipt's logsLog
:string
- log json
Example
When using the example below, the contract must be deployed first. The solidity code file:
pragma solidity ^0.4.0;
contract SimpleStorage {
uint storedData;
event getX(uint,uint);
function SimpleStorage() public{
storedData = 5;
}
function set(uint x) public {
storedData = x;
}
function get() public returns (uint) {
emit getX(1,2);
return storedData;
}
}
As you can see, this example is testing the get function. In this situation, the height is the block height of the block containing the get transaction.
// Request
client getlogs --height 299 --address 0x40bdd5ab58a26cf761607684bd0230b1ea8200f2 --topic 0x978acaf30839c63aff19afed19ff8f3a430103773a67e3890aa1639af9a71bc4
// Result
[
{
"Log": {
"address": "0x40bdd5ab58a26cf761607684bd0230b1ea8200f2",
"blockNumber": 299,
"data": "AAAAAAAAAAAAAAAACleicU4ZO3rFBHXOYl8tz7SD10EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKZ2V0IGdldExvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"topics": [
"0x978acaf30839c63aff19afed19ff8f3a430103773a67e3890aa1639af9a71bc4"
],
"transactionIndex": 1
},
"LogIndex": 0,
"Txhash": "0x2a06accc3739845451d50c74bc28a66c6152e9e536e263c3549a404abe8259fc"
}
]
GetNonce
This method is used to obtain the nonce of the account.
Type
Template
Console
client getnonce --address <string> --account <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
account
:string
- account addresshash
:string
- hash value in hexheight
:uint64
- block height or current block height for negative value (default: -1)
Returns
result
:uint64
- nonce
Example
// Request
client getnonce --account 4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21
// Result
3
GetReceipt
This method is used to obtain the receipt contents based on transaction hash.
Type
Template
Console
client getreceipt --hash <string> --abi <string> --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
hash
:string
- hash value in hexabi
:string
- the abi file of contract
Returns
contract
:string
- contract addressfailed
:bool
- transaction executes successfully or notpoststate
:string
- state trie root hash after transaction executionresult
:string
- transaction resulttotalFee
:int
- transaction feetxhash
:string
- transaction hashusedGas
:int
- transaction gas
Example
// Request
client getreceipt --hash 0x9c0e2565b8a0b33c3f69aa6eb9bad4a86c3925a1fe12272e2082091b9b1c5609
// Result
{
"contract": "0x",
"failed": false,
"poststate": "0xef59ced1b06d3ec77aa5c3b0fa1bd7cdd83890961f49d06aabe0a2d57583dd3b",
"result": "0x",
"totalFee": 21000,
"txhash": "0x9c0e2565b8a0b33c3f69aa6eb9bad4a86c3925a1fe12272e2082091b9b1c5609",
"usedGas": 21000
}
GetShardNum
This method is used to get the shard number of the specified account.
Type
Template
Console
client getshardnum --account <string>
Parameters
account
:string
- account address
Returns
shard number
:uint64
- shard number
Example
// Request
client getshardnum --account 4S04693a9ca18d7b0e793865b3cd057cf5baea8601
// Result
shard number: 4
GetTxInBlock
This method is used to obtain the transaction content based on block height/hash and transaction index.
Type
Template
Console
client gettxinblock --height -1 --index 0 --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
hash
:string
- block hashheight
:int
- block height (default: -1)index
:int
- transaction index, start with 0 (default: 0)
Returns
accountNonce
:unit64
- account nonceamount
:Int
- transaction amountgasLimit
:Int
- transaction gas limitgasPrice
:Int
- transaction gas pricefrom
:string
- transaction providerto
:string
- transaction receiverhash
:string
- transaction hashpayload
:array
- transaction payloadtimestamp
:string
- transaction timestamp
Example
// Request
client gettxinblock --hash 0x0000015592fab87d6efa10e63d7722f6f359d90a1aff9e70930b291931c34922 --height -1 --index 1
// Result
{
"accountNonce": 0,
"amount": 150000000,
"from": "0x0000000000000000000000000000000000000000",
"gasLimit": 0,
"gasPrice": 0,
"hash": "0x473ea3667d073491d5896a93fcf84d7dd822988d07482f21e7a875787539e62e",
"payload": "",
"timestamp": 1540178976,
"to": "4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21"
}
GetTxByHash
This method returns tx information by hash.
Type
Template
Console
client gettxbyhash --hash <string> --address <string>
Parameters
hash
:string
- hash value in hexaddress
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
blockHash
:string
- block hashblockHeight
:int
- block heightstatus
:string
- transaction statusaccountNonce
:unit64
- account nonceamount
:Int
- transaction amountgasLimit
:Int
- transaction gas limitgasPrice
:Int
- transaction gas pricefrom
:string
- transaction providerto
:string
- transaction receiverhash
:string
- transaction hashpayload
:array
- transaction payloadtimestamp
:int64
- transaction timestamptxIndex
:int
- transaction index in block
Example
// Request
client gettxbyhash --hash 0x473ea3667d073491d5896a93fcf84d7dd822988d07482f21e7a875787539e62e
// Result
{
"blockHash": "0x0000009c753570436b0bdd4ea1b9cfb1611f181f7aae82d4ba265761c50c8479",
"blockHeight": 3608,
"status": "block",
"transaction": {
"accountNonce": 0,
"amount": 150000000,
"from": "0x0000000000000000000000000000000000000000",
"gasLimit": 0,
"gasPrice": 0,
"hash": "0x473ea3667d073491d5896a93fcf84d7dd822988d07482f21e7a875787539e62e",
"payload": "",
"timestamp": 1540178976,
"to": "4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21"
},
"txIndex": 0
}
GetTxPoolContent
This method is used to obtain the transaction pool content.
Type
Template
Console
client gettxpoolcontent --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:struct
- transaction pool content
Example
// Request
client gettxpoolcontent
// Result
{
"4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21": [
{
"accountNonce": 1,
"amount": 20000,
"from": "4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21",
"gasLimit": 200000,
"gasPrice": 10,
"hash": "0x8beb3b116d3488e8ef53c9f19c9b932f7713200124d47052009745cd9a5b457c",
"payload": "",
"signature": {
"Sig": "9WIUmcU4mAS91jEKOt3qgSihV8spI7hPTht4aLyjaSsWWDk/nLUj2UvM8a2dXd7Nk2dQ/b1QrLW2Qkevnu6I+wA="
},
"to": "4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21"
}
]
}
GetTxPoolCount
This method is used to obtain the number of transactions in the transaction pool.
Type
Template
Console
client gettxpoolcount --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:uint64
- number of transactions in the transaction pool
Example
// Request
client gettxpoolcount
// Result
1
GetPendingTxs
This method is used to obtain pending transactions in the transaction pool.
Type
Template
Console
client getpendingtxs --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:array
- information of pending transactions
Example
// Request
client getpendingtxs
// Result
[
{
"accountNonce": 1,
"amount": 20000,
"from": "1S015d59bc2629fad04ecc6c76f75fe229abebdf11",
"gasLimit": 200000,
"gasPrice": 10,
"hash": "0x8beb3b116d3488e8ef53c9f19c9b932f7713200124d47052009745cd9a5b457c",
"payload": "",
"signature": {
"Sig": "9WIUmcU4mAS91jEKOt3qgSihV8spI7hPTht4aLyjaSsWWDk/nLUj2UvM8a2dXd7Nk2dQ/b1QrLW2Qkevnu6I+wA="
},
"to": "1S01a2a45ab5a909c309439b0e004c61b7b2a3e831"
}
]
gettxfromaccount
gettxtoaccount
Key
This method is used to generate an address/private key pair and print them out.
Type
Template
Console
client key --shard <int>
Parameters
shard
:uint64
shard number (default: 1)
Returns
Account
:string
- account addressPrivate key
:string
- private key
Example
// Request
client key
// Result
Account: 1S01931325c1048ed1b425afd68f84187b930919b1
Private key: 0xa54f27d8bdcca6246f63c84d626e21aab2337ce7866611d2587cf18e8d1e4129
Miner
A collection of commands for miners
Miner Start
This method starts the miner.
Type
Template
Console
client miner start --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
true or false
Example
// Request
client miner start
// Result
true
Miner Stop
This method stops the miner.
Type
Template
Console
client miner stop --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
true or false
Example
// Request
client miner stop
// Result
true
Miner Status
This method returns the miner's status.
Type
Template
Console
client miner status --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
"Running" or "Stopped"
Example
// Request
client miner status
// Result
Running
Miner GetCoinbase
This method is used to obtain the coinbase of miner consensus.
Type
Template
Console
client miner getcoinbase --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:string
- coinbase
Example
// Request
client miner getcoinbase
// Result
"4S04x0f2cd2159bb432094e3be7e17904c2b4aeb21"
Miner SetThreads
This method is used to set the threads of miner.
Type
Template
Console
client miner setthreads --threads <int> --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
threads
:int
- miner threads (default: 0)
Returns
true or false
Example
// Request
client miner setthreads --threads 2
// Result
true
Miner SetCoinbase
This method is used to set the coinbase
Type
Template
Console
client miner setcoinbase --coinbase <string> --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
coinbase
:string
coinbase of the miner
Returns
true or false
Example
// Request
client miner setcoinbase --coinbase 1S01fba5fcb9bc4ee7c3b7fed667e41c9a0248da71
// Result
true
Miner Detrate
This method returns detrate information of the miner
Type
Template
Console
client miner detrate --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:uint64
- number of determinants computed per second by the miner
Example
// Request
client miner detrate
// Result
392363
Miner Threads
This method returns threads number of miner
Type
Template
Console
client miner threads --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
threads
:uint64
Example
// Request
client miner threads
// Result
2
Miner GetWork
Miner GetWorkHeader
Miner SubmitWork
P2P
p2p commands
Type
Template
Console
client p2p command [command options] [arguments] --address <string>
P2P PeersInfo
This method returns the information of peer nodes.
Type
Template
Console
client p2p peersinfo --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
: the information of peers
Example
// Request
client p2p peersinfo
// Result
[
{
"caps": [
"lightScdo_2/1",
"lightScdo_3/1",
"lightScdo_4/1",
"scdo/1",
"lightScdo_1/1"
],
"id": "4S04ff0836d1e01f12ee84667599640fddabe436c1",
"network": {
"localAddress": "74.208.207.184:8057",
"remoteAddress": "171.83.146.5:26948"
},
"protocols": {
"lightScdo_1": {
"difficulty": 365868671432,
"head": "041d6527dd7dc72636f5adfd56dfa95a20a8ed553a7eec40f5c714c23e8f9399",
"version": 1
},
"lightScdo_2": "handshake",
"lightScdo_3": "handshake",
"lightScdo_4": {
"difficulty": 370476326753,
"head": "c6005f47fc54757d9bc8c55bf8d7dd70cb62f1bf0f442a5bb0a02c05ce64be6b",
"version": 1
},
"scdo": {
"difficulty": 370476326753,
"head": "c6005f47fc54757d9bc8c55bf8d7dd70cb62f1bf0f442a5bb0a02c05ce64be6b",
"version": 1
}
},
"shard": 4
}
]
P2P Peers
This method returns the number of peer nodes.
Type
Template
Console
client p2p peers --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:int
- The number of peer nodes
Example
// Request
client p2p peers
// Result
1
P2P ProtocolVersion
This method returns the protocol version.
Type
Template
Console
client p2p protocolversion --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
Returns
result
:uint64
- version number
Example
// Request
client p2p protocolversion
// Result
1
P2P AddTrustNode
P2P GetAddNodeCount
P2P GetBlockListCount
P2P IsListening
P2P NetVersion
P2P NetworkId
Payload
This method generates payload which is used to call a contract's methods.
Type
Template
Console
client payload --abi <string> --method <string> --args <string>
Parameters
abi
:string
the abi file of the contractmethod
:string
the method name in the contractargs
:string
the parameters of the contract method
Returns
payload
:string
payload data
Example
// Request
client payload --abi myabifile --method set --args 10
// Result
payload: 0x60fe47b1000000000000000000000000000000000000000000000000000000000000000a
SaveKey
This method saves the private key.
Type
Template
Console
`client savekey --privatekey --file --shard
Parameters
privatekey
:string
- private key of the accountfile
:string
- keystore file nameshard
:uint64
- shard number of the account (default: 1)
Returns
none
Example
// Request
client savekey --privatekey 0x52117b49022b246ee3921a7ff6771df065594a0dde555e40d8ce940a3ecfb654 --file mykeyfile --shard 1
// Result
Password:
Repeat password:
store key successful
SendTx
This method submits a transaction to the node.
Type
Template
Console
client sendtx --shard <uint64> --from <string> --to <string> --amount <uint64> --price <uint64> --gas <uint64> --nonce <uint64> --payload <string> --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
shard
:uint64
shard number of the senderfrom
:string
- the keystore file of the sender's accountto
:string
- the receiver's addressamount
:uint64
- the amount to transferprice
:uint64
- the gas price in Wen (default: "10")gas
:uint64
- maximum gas for transaction (default: 200000)nonce
:int
- transaction nonce (if not given by the user, it will be retrieved from the blockchain database)payload
:string
- transaction payload, optional
Returns
Hash
:string
- transaction hashData
: transaction data
Example
// Request
client sendtx --from mykeyfile --to 4S04cf0b32593068f2ace7c472d5f127d3422d3b61 --shard 4 --amount 10000 --price 1 --address 127.0.0.1:8026
// Result:
Please input your key file password:
account 4S046776478e64efb72058ac219be0d5b29af402f1 current nonce: 0, sending nonce: 0
transaction sent successfully
{
"Hash": "0x9c0e2565b8a0b33c3f69aa6eb9bad4a86c3925a1fe12272e2082091b9b1c5609",
"Data": {
"From": "4S046776478e64efb72058ac219be0d5b29af402f1",
"To": "4S04cf0b32593068f2ace7c472d5f127d3422d3b61",
"Amount": 10000,
"AccountNonce": 0,
"GasPrice": 1,
"GasLimit": 21000,
"Timestamp": 0,
"Payload": ""
},
"Signature": {
"Sig": "N8XzJ/GEpU73dpzW5t5WShmVPFb8gQOrInGdypul8aBaDakmhbZ2rdqekA5bWslHQBfsoafeMukF5b7A1/6JWQA="
}
}
Sign
This method is used to sign data with your private key.
Type
Template
Console
client sign --shard <uint64> --privatekey <string> --to <string> --amount <uint64> --price <uint64> --gas <uint64> --nonce <uint64> --payload <string> --address <string>
Parameters
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use-a
instead of--address
shard
:uint64
shard number of the senderprivatekey
:string
private key of the senderto
:string
account address of the receiveramount
:uint64
the amount to transferprice
:uint64
transaction gas price in Wen (default: "10")gas
:int64
maximum gas for transaction (default: 200000)nonce
:int
- transaction nonce (if not given by the user, it will be retrieved from the blockchain database)payload
:string
transaction payload, optional
Returns
result
: transaction data with signature
Example
// Request
client sign --shard 1 --privatekey 0x3f3a2bf8d1360292d24a23a84d0fceea17a5d18859e1e280a6ed7c4d7172999f --to 1S01a2a45ab5a909c309439b0e004c61b7b2a3e831 --amount 20000 --nonce 1
// Result
account 1S015d59bc2629fad04ecc6c76f75fe229abebdf11, transaction nonce: 1
{
"Transaction": {
"accountNonce": 1,
"amount": 20000,
"from": "1S015d59bc2629fad04ecc6c76f75fe229abebdf11",
"gasLimit": 200000,
"gasPrice": 10,
"hash": "0x8beb3b116d3488e8ef53c9f19c9b932f7713200124d47052009745cd9a5b457c",
"payload": "",
"signature": {
"Sig": "9WIUmcU4mAS91jEKOt3qgSihV8spI7hPTht4aLyjaSsWWDk/nLUj2UvM8a2dXd7Nk2dQ/b1QrLW2Qkevnu6I+wA="
},
"to": "1S01a2a45ab5a909c309439b0e004c61b7b2a3e831"
}
}
Last updated
Was this helpful?