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

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 10000

  • payload:string - bytecodes containing information of which function to call and function inputs

  • to:string - contract address

Returns

  • 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

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 address

  • Private 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 address

  • hash:string - hash value in hex

  • height:int64 - block height or current block height for negative value (default: -1)

Returns

  • Account:string - account

  • Balance: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 hash

  • height:string - block height

  • fulltx:bool - whether to include detailed transaction information; can use -f instead of --fulltx

Returns

  • 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

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 hash

  • height: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 hex

  • height: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 hex

  • height:int64 - block height

Returns

  • account count:int64 - the count of the changed accounts

  • accounts:array - a list of the changed accounts

  • blockHash: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 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

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 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

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 address

  • abi:string - the abi file of contract

  • event:string - the event name of contract

Returns

  • response:struct - response parameter struct

  • Txhash:string - transaction hash

  • LogIndex:uint - log index in receipt's logs

  • Log: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 address

  • hash:string - hash value in hex

  • height: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 hex

  • abi:string - the abi file of contract

Returns

  • 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

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 hash

  • height:int - block height (default: -1)

  • index:int - transaction index, start with 0 (default: 0)

Returns

  • 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

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 hex

  • address:string - node address for client to request (default: "127.0.0.1:8027"); you can use -a instead of --address

Returns

  • 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

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 address

  • Private 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