mcp

The following mcp RPCs are removed comparing to Huygens as they already exist in Web3: send_block, send_offline_block, sign_msg, estimate_gas, call, account_create, account_lock, account_unlock, account_list, account_balance, account_code, logs.

And the following RPCs are newly added: epoch_approves, epoch_approve_receipts, epoch_elected_approve_receipts.

Here are the MCP RPC interfaces.

account_remove

Remove an account. The parameter rpc_control need to be true when run the mcp node program.

request fields

  • action:account_remove

  • account:account to be removed

  • password:account password

{
    "action": "account_remove",
    "account": "0xa9d8863d0bf68dbaaacacad4ee0e865a0cc59f28",
    "password": "s4iH1t@hBFtymA"
}

return fields

  • code:error code. The code 0 is success.

  • msg:error message.

account_import

Import an account. The parameter rpc_control need to be true when run the mcp node program.

request fields

  • action:account_import

  • json:account in JSON format to be imported

return fields

  • code:error code. The code 0 is success.

  • msg:error message.

  • account:account imported.

account_export

export an account.

request fields

  • action:account_export

  • account:account to be exported

return fields

  • code:error code. The code 0 is success.

  • msg:error message.

  • json:account in JSON format exported.

account_validate

Validate an account.

request fields

  • action:account_validate

  • account:account to be validated

return fields

  • code:error code. The code 0 is success.

  • msg:error message.

  • valid:validation results (0:invalid format,1:valid format)

account_password_change

Change an account password. The parameter rpc_control need to be true when run the mcp node program.

request fields

  • action:account_password_change.

  • account:account to have password changed.

  • old_password:original password.

  • new_password:new password.

return fields

  • code:error code. The code 0 is success.

  • msg:error message.

account_block_list

List all blocks in an account.

request fields

  • action: account_block_list.

  • account: account to be queried for the blocks.

  • limit: uplimit of the number of returned blocks. The maximum value is 100.

  • index:(optional)the current block query index. It should be derived from the return field next_index in the previous call of account_block_list. The default value is empty.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • blocks: list of blocks.

  • next_index: block query index. Return null if there are no more blocks left.

account_state_list

List all state in an account.

request fields

  • action: account_state_list.

  • account: account to be queried for the blocks.

  • limit: uplimit of the number of returned states. The maximum value is 100.

  • index:(optional)the current state query index. It should be derived from the return field next_index in the previous call of account_state_list. The default value is empty.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • account_states: list of states.

  • next_index: block query index. Return null if there are no more blocks left.

accounts_balances

Check the balance of multiple accounts.

request fields

  • action:accounts_balances.

  • accounts: account to check the balance.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • balances: balance of the accounts.

block

Get details of one block.

request fields

  • action: block

  • hash: block hash

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • block: block details. If the block doesn't exist, this field is null.

    • hash: block hash.

    • from: sender's account

    • previous: hash of the latest block of sender's account before the current block. The value is 0 for the first block of the account.

    • parents: list of the hashes of parent blocks on the DAG.

    • links: list of the hashes of the ordinary blocks that the witness block referenced.

    • last_stable_block: the last stable block of this block on the DAG.

    • last_summary_block: the last_stable_block of the best parent of this block on the DAG.

    • last_summary: the summary of last_summary_block.

    • timestamp: timestamp when the block is generated.

    • gasLimit: string, uplimit of the gas for the transaction.

    • signature: signature from the sender.

block_state

Get state of a block

request fields

  • action: block

  • hash: block hash

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • block_state: state of the block. If the block doesn't exist, this field is null.

    • content:

      • level: the level of the block

      • witnessed_level: the witness level of the block

      • best_parent: the best parent block hash of the block

    • is_stable: is the block stable or not, 0:not stable,1:stable.

    • stable_content: stable block state contents. This field exists after the block is stable, and is empty if the block is not stable.

      • status: block status,0: success,1: double spending,2: invalid,3: contract execution failed.

      • stable_index: stable block index which indicates the order of blocks on DAG. The value starts from genesis block as 0, and keeps increasing.

      • mc_timestamp: main chain time stamp.

      • stable_timestamp: stable time stamp.

      • mci:main chain index

      • is_on_mc: is the block on main chain.

      • is_free: does the block has children.

block_states

Get states of many blocks.

request fields

  • action:blocks.

  • hash: list of block hashes.

result fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • blocks:list of block state contents. See block state contents in the block_state RPC method. If any of the block hashes doesn't exist, the corresponding list element is null.

block_traces

Get the trace of internal transactions in a smart contract.

request fields

  • action: block_traces.

  • hash: block hash.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • block_traces:list of block traces

    • fields in a trace:

      • type: 0:call,1:create,2:suicide。

      • action: subjective to the type of a trace

        • call: - call_type: type of call. - from: sender's account. - to: receiver's account. - gas: string,gas limit. - data: input data. - amount: string,amount in the unit of 10-18 CCN.

        • create: - from: sender's account. - gas: string,gas limit. - init: the code that creates the contract. - amount: string,amount in the unit of 10-18 CCN.

        • suicide: - contract_account: contract account. - refund_account: refund account after suicide. - balance: the total amount that is refunded in suicide.

      • result: subjective to the type of a trace. If the execution of the contract failed,this field is empty.

        • call:

          • gas_used:used gas.

          • output:output.

        • create:

          • gas_used:used gas.

          • contract_account: address of the contract created.

          • code:code of the contract created.

        • suicide:result field is null

      • error: error message. This field is null if the contract execution is successful.

      • subtraces:number of subtraces.

      • trace_address:the layer of trace.

block_summary

Retrieve the summary for a specific block.

request fields

  • hash: block hash

return fields

  • code: error code. The code 0 is success.

  • msg: error message

  • summary: summary hash value.

  • previous_summary: previous summary hash value.

  • parent_summaries: parent summary hash array.

  • link_summaries: linked summary hash array.

  • skiplist_summaries: skipped summary hash array.

  • status: block state.

stable_blocks

Retrieve the stabled blocks for a specific mci value.

request fields

  • action: stable_blocks.

  • limit: uplimit of the number of blocks returned. Maximum value is 100.

  • index: (optional) the index of the first block to retrieve. It can be set to be the value of next_index from the result of previous stable_blocks call. The default value is 0.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • blocks: the list of blocks

  • next_index:the stable index for next block. This value is null if there is no subsequent blocks.

status

Retrieve the current status of DAG on the node

request fields

  • action:status.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • syncing: if the node is syncing to the other nodes,0:not syncing,1:syncing.

  • last_stable_mci: the mci of the last stable block.

  • last_mci: the mci of the last block on the main chain.

  • last_stable_block_index:the stable index of the last stable block. stable index starts from value 0 and keep increasing. It indicates the order of stable blocks on DAG.

  • epoch: the current epoch number of mcp.

  • epoch_period: the number of blocks in main chain included in each epoch.

peers

List the peers connected to the node.

request fields

  • action:peers.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • peers: list of peers.

nodes

List the nodes connected to the node.

request fields

  • action:nodes.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • nodes: list of nodes.

witness_list

Retrieve the list of witnesses.

request fields

  • action:witness_list。

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • witness_list:list of witnesses.

version

Acquire the current node version, rpc interface version, and database version.

request fields

  • action:version.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

debug_trace_transaction

Interface for debugging transaction. Returns the opcode of a transaction and the stack and memory information when it is executesd.

request fields

  • action: debug_trace_transaction.

  • hash: hash of a block.

  • options: (optional)options for debug tracing, including disable_storage (default is true) and disable_memory,disable_stack,full_storage (defaults are false).

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • gas: string, uplimit of gas usage for the transaction.

  • return_value: return value of the transaction.

  • struct_logs: traces of the transacton.

debug_storage_range_at

Acquire the data in storage after executing a transaction in a contract.

request fields

  • action: debug_storage_range_at.

  • hash: block hash.

  • account: contract to debug.

  • begin: begin address of the storage to fetch data.

  • max_results: uplimit of the amount of data to fetch.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • next_key:the key of the first record in the storage beyond max_results records.

  • storage:contract data in the storage.

epoch_approves

List the all approval messages that have been processed in the specified epoch.

request fields

  • action: epoch_approves.

  • epoch: the epoch number.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • epoch_approves:the array of epoch approval messages.

epoch_approve_receipts

List the approve receipts for all approval messages that have been processed in the specified epoch.

request fields

  • action: epoch_approve_receipts.

  • epoch: the epoch number.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • epoch_approve_receipts:the array of epoch approve receipts.

epoch_elected_approve_receipts

Get the election result corresponding to the epoch.

request fields

  • action: epoch_elected_approve_receipts.

  • epoch: the epoch number.

return fields

  • code: error code. The code 0 is success.

  • msg: error message.

  • epoch_elected_approve_receipts:the election result.

Last updated