- JSFiddle Examples
- /Neo:v2.9.0/ API Reference
- Asset Identifiers
- Get Account State
- Get Asset State
- Get Balance (not implemented)
- Get Best Block Hash
- Get Block
- Get Block Count
- Get Block Header
- Get Block Sys Fee
- Get Connection Count
- Get Contract State
- Get Peers
- Get Raw Memory Pool
- Get Raw Transaction
- Get Storage
- Get Transaction Output
- Get Validators
- Get Version
- Subscribe to Notifications
- Invoke
- Invoke Function
- Invoke Script
- Validate Address
- Other Examples
- Utilities
- /Neo:v2.9.0/ API Reference
This section provides links to JSFiddle examples of the neon-js implementation of the /Neo:v2.9.0/ API.
See https://docs.neo.org/en-us/node/cli/2.9.0/api.html for more information.
NOTES:
- In most cases, the '0x' prefix for hashes is optional.
- If an API endpoint isn't implemented by neon-js, a generic query is built and executed using neon-js RPC query.execute().
Neo: 0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b
Gas: 0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7
getaccountstate(address)
Get the account state for a wallet address.
JSFiddle: getaccountstate
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getaccountstate.html
getassetstate(asset_id_hash)
Queries the asset information, based on the specified asset number.
JSFiddle: getassetstate
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getassetstate.html
getbalance(asset_id_hash)
Returns the balance of the corresponding asset in the wallet according to the specified asset number.
NOTE: getBalance is not currently implemented as an RPC call in neon-js as the Neo API requires a wallet to be open to access it. Balances for arbitrary addresses can be queried with getaccountstate. This reference is here to educate and provide reminder to future implementation using an API like Neoscan.
JSFiddle: getbalance
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getbalance.html
getbestblockhash()
Get the hash of the highest (most recent) block.
JSFiddle: getBestBlockHash
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getbestblockhash.html
getblock(hash)
getblock(index)
Get block data by its hash or index.
JSFiddle: getBlock
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getblock.html
getblockcount()
Get the number of blocks on a chain.
JSFiddle: getBlockCount
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getblockcount.html
getblockheader(hash)
Returns the corresponding block header information according to the specified script hash. This method builds a custom request and executes it using the neon-js RPC query facility.
JSFiddle: getblockheader
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getblockheader.html
getblocksysfee(blockIndex)
Returns the system fees of the block, based on the specified index.
JSFiddle: getblocksysfee
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getblocksysfee.html
getconnectioncount()
Gets the current number of connections for the node.
JSFiddle: getconnectioncount
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getconnectioncount.html
getcontractstate(hash)
Queries contract information, according to the contract script hash.
JSFiddle: getcontractstate
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getcontractstate.html
getpeers()
Gets a list of nodes that are currently connected/disconnected by this node.
JSFiddle: getpeers
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getpeers.html
getrawmempool()
Gets a list of unconfirmed transactions in memory.
JSFiddle: getrawmempool
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getrawmempool.html
getrawtransaction(hash)
Returns the corresponding transaction information based on the specified hash value.
JSFiddle: getrawtransaction
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getrawtransaction.html
getstorage(hash, key)
Returns the stored value, according to the contract script hash and the stored key.
JSFiddle: getstorage
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getstorage.html
gettxout(txid, index)
Returns the corresponding unspent transaction output information (returned change), based on the specified hash and index. If the transaction output is already spent, the result value will be null.
JSFiddle: gettxout
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/gettxout.html
getvalidators()
Returns the current NEO consensus nodes information and voting status.
JSFiddle: getvalidators
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getvalidators.html
getversion()
Gets version information of this node.
JSFiddle: getversion
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/getversion.html
subscribe(scriptHash, callback)
Subscribe to receive event notifications from a contract.
JSFiddle: invoke
API Ref: https://github.com/corollari/neo-PubSub
invoke(scriptHash, params)
Invokes a smart contract at specified script hash with the given parameters.
neon-js wraps invoke with a helper called doInvoke.
JSFiddle: invoke
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/invoke.html
invokefunction(scriptHash, operation, params)
Invokes a smart contract at specified script hash, passing in an operation and its params.
JSFiddle: invokefunction
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/invokefunction.html
invokescript(script)
Runs a script through the virtual machine and returns the results.
JSFiddle: invokescript
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/invokescript.html
validateaddress(address)
Verify that the address is a correct NEO address.
JSFiddle: validateAddress
API Ref: https://docs.neo.org/en-us/node/cli/2.9.0/api/validateaddress.html