Skip to content

Block

Block management RPC interface

For processing block chain partial upper logic

1. blockMgr_sendRawTransaction

  • Usage:

  Send signed transactions

  • Params:

   1. A signed transaction

  • Return:transaction hash

  • Example:

shell:

curl http://localhost:10085 -X POST --data '{"jsonrpc":"2.0","method":"blockmgr_sendRawTransaction","params":["0x40a287b6d30b05313131317a4120dd8c23c40910d038fa43b2f8932d3681cbe5ee3079b6e9de0bea6e8e6b2a867a561aa26e1cd6b62aa0422a043186b593b784bf80845c3fd5a7fbfe62e61d8564"], "id": 3}' -H "Content-Type:application/json"

cli:

drep-cli 127.0.0.1:10085 blockMgr_sendRawTransaction "0x40a287b6d30b05313131317a4120dd8c23c40910d038fa43b2f8932d3681cbe5ee3079b6e9de0bea6e8e6b2a867a561aa26e1cd6b62aa0422a043186b593b784bf80845c3fd5a7fbfe62e61d8564" 3
  • Response:
{"jsonrpc":"2.0","id":3,"result":"0xf30e858667fa63bc57ae395c3f57ede9bb3ad4969d12f4bce51d900fb5931538"}

2. blockMgr_gasPrice

  • Usage:

  Get the recommended value of gasprice given by the system

  • Params:

   1. Query address

  • Return:Price and error message

  • Example:

shell:

curl http://localhost:10085 -X POST --data '{"jsonrpc":"2.0","method":"blockmgr_gasPrice","params":[], "id": 3}' -H "Content-Type:application/json"

cli:

drep-cli 127.0.0.1:10085 blockMgr_gasPrice 3
  • Response:
{"jsonrpc": "2.0", "id": 3, "result": 40000000}

3. blockMgr_getPoolTransactions

  • Usage:

  Get trading information in the trading pool.

  • Params:

   1. Query address

  • Return:All transactions in the pool

  • Example:

shell:

curl http://localhost:10085 -X POST --data '{"jsonrpc":"2.0","method":"blockmgr_getPoolTransactions","params":["0x8a8e541ddd1272d53729164c70197221a3c27486"], "id": 3}' -H "Content-Type:application/json"

cli:

drep-cli 127.0.0.1:10085 blockMgr_getPoolTransactions "0x8a8e541ddd1272d53729164c70197221a3c27486" 3
  • Response:
{
    "jsonrpc": "2.0",
    "id": 3,
    "result": [
        [],
        [{
            "Data": {
                "Version": 1,
                "Nonce": 1681,
                "Type": 0,
                "To": "0xfbc7a8581676be90709d54bfb755b65aa5ae1f81",
                "ChainId": 0,
                "Amount": "0x56bc75e2d63100000",
                "GasPrice": "0x3b9aca00",
                "GasLimit": "0x30000",
                "Timestamp": 1593
                507380,
                "Data": null
            },
            "Sig": "HxnXrTvTtx1XWVkpvvQw9LOg+USDuErDzr7uN61O1pBASmZvnrQ70VgRP5RR94RW8X95UymCtZx0LKO3iLOLsfE="
        }]
    ]
}

4. blockMgr_getTransactionCount

  • Usage:

  Gets the total number of transactions issued by the address

  • Params:

   1. Query address

  • Return:All transactions in the pool

  • Example:

shell:

curl http://localhost:10085 -X POST --data '{"jsonrpc":"2.0","method":"blockmgr_getTransactionCount","params":["0x8a8e541ddd1272d53729164c70197221a3c27486"], "id": 3}' -H "Content-Type:application/json"

cli:

drep-cli 127.0.0.1:10085 blockMgr_getTransactionCount "0x8a8e541ddd1272d53729164c70197221a3c27486" 3
  • Response:
{"jsonrpc": "2.0", "id": 3, "result": 100}

5. blockMgr_getPoolMiniPendingNonce

  • Usage:

  Get the smallest Nonce in the pending queue

  • Params:

   1. Query address

  • Return:The smallest nonce in the pending queue

  • Example:

shell:

curl http://localhost:10085 -X POST --data '{"jsonrpc":"2.0","method":"blockmgr_getPoolMiniPendingNonce","params":["0x8a8e541ddd1272d53729164c70197221a3c27486"], "id": 3}' -H "Content-Type:application/json"

cli:

drep-cli 127.0.0.1:10085 blockMgr_getPoolMiniPendingNonce "0x8a8e541ddd1272d53729164c70197221a3c27486" 3
  • Response:
{"jsonrpc": "2.0", "id": 3, "result": None}

6. blockMgr_getTxInPool

  • Usage:

  Checks whether the transaction is in the trading pool and, if so, returns the transaction

  • Params:

   1. The address at which the transfer was initiated

  • Return:Complete transaction information

  • Example:

shell:

curl -H "Content-Type: application/json" -X post --data '{"jsonrpc":"2.0","method":"blockmgr_getTxInPool","params":["0x3ebcbe7cb440dd8c52940a2963472380afbb56c5"],"id":3}' http://127.0.0.1:10085

cli:

drep-cli 127.0.0.1:10085 blockMgr_getTxInPool "0x3ebcbe7cb440dd8c52940a2963472380afbb56c5" 3
  • Response:
{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "Hash": "0xfa5c34114ff459b4c97e7cd268c507c0ccfcfc89d3ccdcf71e96402f9899d040",
    "From": "0x7923a30bbfbcb998a6534d56b313e68c8e0c594a",
    "Version": 1,
    "Nonce": 15632,
    "Type": 0,
    "To": "0x7923a30bbfbcb998a6534d56b313e68c8e0c594a",
    "ChainId": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "Amount": "0x111",
    "GasPrice": "0x110",
    "GasLimit": "0x30000",
    "Timestamp": 1559322808,
    "Data": null,
    "Sig": "0x20f25b86c4bf73aa4fa0bcb01e2f5731de3a3917c8861d1ce0574a8d8331aedcf001e678000f6afc95d35a53ef623a2055fce687f85c2fd752dc455ab6db802b1f"
  }
}