Show / Hide Table of Contents

getwalletbalance Method

Returns the balance of the corresponding asset in the wallet, based on the specified asset number. This method applies to the contract assets that conform to NEP-17 standards.

Before you can invoke this method you must:

  1. Install the plugin RpcServer

  2. Call the RPC method openwallet to open the wallet first.

Parameter Description

Asset_id: Asset ID (asset identifier), which is the script hash of the contract for contract assets.

For example, NEO is 0xf61eebf573ea36593fd43aa150c055ad7906ab83

Gas is 0x70e2301955bf1e74cbb31d18c2f96972abadb328

You can query asset ID using the CLI command list asset or using the blockchain browser.


Make sure your client has been fully synchronized to the latest block height before using this API, otherwise the balance returned may not be up-to-date.

Example: querying the balance of NEP-17 assets.

Request body:

  "jsonrpc": "2.0",
  "method": "getwalletbalance",
  "params": ["0x70e2301955bf1e74cbb31d18c2f96972abadb328"],
  "id": 1

Response body:

    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "balance": "3000000830000920"

Response Description:

balance: the balance of the asset in the wallet. Since the NEP-17 assets adopt the balance system rather than the UTXO system, there is no confirmed in the returned result and the balance is the actual available balance.

  • Only when your client synchronizes to the block that the contract was deployed, execution of this API will return the correct value, otherwise execution of the API will result in an error.

  • When the input parameter is a script hash of a non-NEP-5 smart contract, execution of the API will result in an error.