Show / Hide Table of Contents

NEO.BalanceOf Method (UInt160)

Gets the NEO balance in the account.

Namespace: Neo.SmartContract.Framework.Native

Assembly: Neo.SmartContract.Framework

Syntax

public static extern BigInteger BalanceOf(UInt160 account);

Parameters:

  • account: Script hash of the account

Example

public class Contract1 : SmartContract.Framework.SmartContract
{
    private static readonly UInt160 account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();

    public static object Test()
    {
        BigInteger result = NEO.BalanceOf(account);
        return result;
    }
}

Response body:

{
    "Type":"Integer",
    "value":"100000000"
}

Response description:

  • Integer type: The account balance is obtained successfully.

  • Others: failed.

Back