Client
Please see here for downloading or creating a SCDO client.
Command Line Options
Full Node Client
Light Node Client
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:
As you can see, the example is testing the get function.
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
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
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
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
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
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
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
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
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
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:
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Last updated