Client
Last updated
Was this helpful?
Last updated
Was this helpful?
Please see for downloading or creating a SCDO client.
Command
Full
Light
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
Type
Template
Console
client call --address <string> --payload <string> --to <string> --height <int>
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 10000
payload
:string
- bytecodes containing information of which function to call and function inputs
to
:string
- contract address
contract
:string
- contract address
failed
:bool
- contract executes successfully or not
poststate
:string
- state trie root hash after transaction execution
result
:string
- transaction result
totalFee
:int64
- transaction fee
txhash
:string
- transaction hash
usedGas
:int64
- transaction gas
When using the example below, the contract must be deployed first. The solidity code file:
As you can see, the example is testing the get function.
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>
file
:string
keystore file
Account
:string
- account address
Private key
:string
- private key
This method returns the balance of the given account.
Type
Template
Console
client getbalance --account <string> --address <string>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
account
:string
- account address
hash
:string
- hash value in hex
height
:int64
- block height or current block height for negative value (default: -1)
Account
:string
- account
Balance
:big.Int
- account balance
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>
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
height
:string
- block height
fulltx
:bool
- whether to include detailed transaction information; can use -f
instead of --fulltx
debts
:array
- debts in block
Hash
:string
- debts hash
Data
:json
- debts data
TxHash
:string
- txhash in debt
Shard
:int
- shard number of SCDO node where debts on
Account
:array
- debt account
Amount
:int64
- debt amount
Fee
:int64
- debt fee
Code
:string
- debt code
hash
:string
- block hash
header
:json
- block header
CreateTimestamp
:uint64
- create timestamp
Creator
:string
- creator address
DebtHash
:string
- debts hash
Difficulty
:big.Int
- block difficulty
ExtraData
:string
- extra data
Height
:unit64
- block height
Nonce
:unit64
- block nonce
PreviousBlockHash
:string
- previous block hash
ReceiptHash
:string
- Receipts hash
stateHash
:string
- state tree hash
TxDebtHash
:string
- debts hash
TxHash
:string
- tx hash
totalDifficulty
:big.Int
- total difficulty
transactions
:array
- transaction array
accountNonce
:unit64
- account nonce
amount
:Int
- transaction amount
gasLimit
:Int
- transaction gas limit
gasPrice
:Int
- transaction gas price
from
:string
- transaction provider
hash
:string
- transaction hash
payload
:array
- transaction payload
timestamp
:big.Int
- timestamp
to
:string
- transaction receiver
txDebts
:array
- transaction debts
Data
:json
- txDebts data
Account
:string
- transaction account
Amount
:int
- transaction amount
Code
:string
- transaction code
Fee
:int
- transaction fee
Shard
:int
- transaction shard number
TxHash
:string
- transaction hash
Hash
:string
- txDebts hash
This method is used to obtain the height of the blockchain.
Type
Template
Console
client getblockheight --address <string>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
result
:uint64
- current block height
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>
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
height
:string
- block height
result
: transaction array
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>
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
height
:int64
- block height (default: -1)
result
:int
- number of transaction
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>
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 hex
height
:int64
- block height
account count
:int64
- the count of the changed accounts
accounts
:array
- a list of the changed accounts
blockHash
:string
- block hash
This method is used to obtain the content of a debt based on its hash.
Type
Template
Console
client getdebtbyhash --hash <string> --address <string>
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
blockHash
:string
- block hash of the block that includes the debt
blockHeight
:int64
- block height of the block that includes the debt
debt
:json
- debt json
Data
:json
- debt data
Account
:string
- debt account
Amount
:int64
- debt amount
Code
:string
- debt code
Fee
:int64
- debt fee
Shard
:int
- shard number of SCDO node where the debt is in
TxHash
:string
- txhash in debt
Hash
:string
- debt hash
debtIndex
:json
- debt index json
BlockHash
:string
-block hash of the block that includes the debt
Index
:string
- index of the debt in the block
status
:string
- debt status
This method returns the pending debts in the debt pool
Type
Template
Console
client getdebts --address <address>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
result
:json
- a list of pending debts
This method returns node information.
Type
Template
Console
client getinfo --address <address>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
BlockAge
:int64
- the age of the current block
Coinbase
:string
- the coinbase of the node
CurrentBlockHeight
:uint64
- the current block height
HeaderHash
:string
- block hash of the current block
MinerStatus
:string
- miner status
PeerCnt
: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 node
Version
:string
- the version of SCDO node
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>
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 address
abi
:string
- the abi file of contract
event
:string
- the event name of contract
response
:struct
- response parameter struct
Txhash
:string
- transaction hash
LogIndex
:uint
- log index in receipt's logs
Log
:string
- log json
When using the example below, the contract must be deployed first. The solidity code file:
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.
This method is used to obtain the nonce of the account.
Type
Template
Console
client getnonce --address <string> --account <string>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
account
:string
- account address
hash
:string
- hash value in hex
height
:uint64
- block height or current block height for negative value (default: -1)
result
:uint64
- nonce
This method is used to obtain the receipt contents based on transaction hash.
Type
Template
Console
client getreceipt --hash <string> --abi <string> --address <string>
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
abi
:string
- the abi file of contract
contract
:string
- contract address
failed
:bool
- transaction executes successfully or not
poststate
:string
- state trie root hash after transaction execution
result
:string
- transaction result
totalFee
:int
- transaction fee
txhash
:string
- transaction hash
usedGas
:int
- transaction gas
This method is used to get the shard number of the specified account.
Type
Template
Console
client getshardnum --account <string>
account
:string
- account address
shard number
:uint64
- shard number
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>
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
height
:int
- block height (default: -1)
index
:int
- transaction index, start with 0 (default: 0)
accountNonce
:unit64
- account nonce
amount
:Int
- transaction amount
gasLimit
:Int
- transaction gas limit
gasPrice
:Int
- transaction gas price
from
:string
- transaction provider
to
:string
- transaction receiver
hash
:string
- transaction hash
payload
:array
- transaction payload
timestamp
:string
- transaction timestamp
This method returns tx information by hash.
Type
Template
Console
client gettxbyhash --hash <string> --address <string>
hash
:string
- hash value in hex
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
blockHash
:string
- block hash
blockHeight
:int
- block height
status
:string
- transaction status
accountNonce
:unit64
- account nonce
amount
:Int
- transaction amount
gasLimit
:Int
- transaction gas limit
gasPrice
:Int
- transaction gas price
from
:string
- transaction provider
to
:string
- transaction receiver
hash
:string
- transaction hash
payload
:array
- transaction payload
timestamp
:int64
- transaction timestamp
txIndex
:int
- transaction index in block
This method is used to obtain the transaction pool content.
Type
Template
Console
client gettxpoolcontent --address <string>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
result
:struct
- transaction pool content
This method is used to obtain the number of transactions in the transaction pool.
Type
Template
Console
client gettxpoolcount --address <string>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
result
:uint64
- number of transactions in the transaction pool
This method is used to obtain pending transactions in the transaction pool.
Type
Template
Console
client getpendingtxs --address <string>
address
:string
- node address for client to request (default: "127.0.0.1:8027"); you can use -a
instead of --address
result
:array
- information of pending transactions
This method is used to generate an address/private key pair and print them out.
Type
Template
Console
client key --shard <int>
shard
:uint64
shard number (default: 1)
Account
:string
- account address
Private key
:string
- private key
A collection of commands for miners
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
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
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
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
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
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
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
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
p2p commands
Type
Template
Console
client p2p command [command options] [arguments] --address <string>
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
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
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
This method generates payload which is used to call a contract's methods.
Type
Template
Console
client payload --abi <string> --method <string> --args <string>
abi
:string
the abi file of the contract
method
:string
the method name in the contract
args
:string
the parameters of the contract method
payload
:string
payload data
This method saves the private key.
Type
Template
Console
`client savekey --privatekey --file --shard
privatekey
:string
- private key of the account
file
:string
- keystore file name
shard
:uint64
- shard number of the account (default: 1)
none
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>
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 sender
from
:string
- the keystore file of the sender's account
to
:string
- the receiver's address
amount
:uint64
- the amount to transfer
price
: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
Hash
:string
- transaction hash
Data
: transaction data
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>
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 sender
privatekey
:string
private key of the sender
to
:string
account address of the receiver
amount
:uint64
the amount to transfer
price
: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
result
: transaction data with signature
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 for more details.
Similar to .
Similar to .