Root query

These are read-only api to get information from blockchain. These apis don't change the blockchain data.

Fields
blockApi: BlockQuery

Provides few high-level methods to get block information easily. The implementation internally uses adminApi to get block information

txnApi: TxnQuery

Provides transaction specific methods. All methods in this api are read-only. That means they don't change the blockchain state. Please refer to txnApi in Mutation for methods that are used to change blockchain's state.

accountApi: AccountQuery

Provides account related information For account manipulation, use accountApi in Mutation.

adminApi: AdminQuery

Provides methods to contact with Aion kernel for certain purpose. It provides read-only apis. For manipulation, refer to adminApi in Mutation.

chainApi: ChainQuery

Provides methods for fetching blockchain specific details such as blocks and transactions.

netApi: NetQuery

Provides methods for fetching the Aion blockchain network status and the specific information.

walletApi: WalletQuery

This api is an interface for the class Wallet. Assists in account related interactions.

contractApi: ContractQuery

This api provides the user with convenient methods of encoding and decoding contract calls and transactions from the Aion Kernel. This api can be used to deploy a smart contract and invoke smart contract's method.

Mutations

Using Mutation queries, user can change the state in blockchain. e.g; post transaction, account unlock, contract deploy and more.

Fields
accountApi: AccountMutator

Provides methods to manipulate accounts.

walletApi: WalletMutator

Provides methods specific to Wallet mutation.

txnApi: TxnMutator

Provides transaction specific mutation methods.

contractApi: ContractMutator

Provide contract specific methods like contract deploy, contract method execution.

BlockQuery

Fields
blocks(first: Long = 10, before: Long = -1): [Block]

Get blocks starting from the block number passed through "before" parameter. Returns: If first=n & before=blkNumber, n number of blocks before specified blkNumber If before = -1, n number of recent blocks.

Arguments: first - No of blocks to return, before - start block number

block(number: Long!): Block

Get block details for the given block number

TxnQuery

Fields
transaction(txHash: String!): TxDetails

Transaction details for a given transaction hash. Arguments txHash- Transaction Hash

transactions(before: Long = -1, first: Long!): [TxDetails]

Get transactions starting from the block number passed through "before" parameter. Returns: If first=n & before=blkNumber, n number of transactions before specified blkNumber If before = -1, n number of recent transactions.

Arguments: before - Start block number, first - number of transactions to fetch

estimateNrg(code: String!): Long

Estimates the Nrg required to execute transaction.

Arguments: code- Contract source code

estimateNrgByTxArgs(txArgs: TxArgsInput!): Long

Estimates the Nrg required to execute transaction.

Arguments: txArgs - Object of TxArgsInput

code(address: String!, blockNumber: Long = -1): String

Retrieves the compiled code for a given contract at given blockNumber or the compiled code with checking latest block if blockNumber is not passed.

Agruments: address - Deployed contract address, blockNumber - Block number of which the contract by long value was committed on. Ignore this argument or indicate -1L to check for the latest block.

msgStatus(msgHash: String!): MsgResp

Check the transaction progress given by the api session hash value.

Arguments: msgHash - The session hash the api client sent.

nrgPrice: Long

Returns a Long value representing the recommended energy price.

solcVersion: String

Get the kernel contained solidity compiler version.

txReceipt(txnHash: String!): TxReceipt

Retrieves the transaction receipt given a transaction hash.

Arguments: txnHash - Transaction hash

AccountQuery

Fields
account(publicKey: String!, blockNumber: Long = -1): Account

Get account object with attributes like "balance" for a given publicKey/address at the specified blockNumber. If blockNumber=-1 or missing, returns the account object at th latest block.

Argument: publicKey - PublicKey of the account, blockNumber - Block number

AdminQuery

Fields
accountsByAddressString(addresses: String!): [Account]

Get detailed account information, given a string of addresses

Arguments: addresses - the class String represent by the list of accounts separated by comma [,]. eg. 0xA,0xB,0xC ...

accounts(addresses: [String]!): [Account]

Get detailed account information, given a list of addresses.

Arguments: addresses - List of addresses

blockByNumber(number: Long!): Block

blockByHash(hash: String!): Block Get detailed block information include all transactions by given the block number.

Arguments: number - Block number

blocksByLatest(count: Long!): [Block]

Get block information, for all blocks in range (latest - n, latest]

Arguments: count - number of blocks from latest for which to retrieve block details

blocksByNumber(numbers: [Long]!): [Block]

Get detailed block information including all transactions by given the List of block numbers.

Arguments: numbers - List of block numbers

blocksByRange(blockStart: Long!, blockEnd: Long!): [Block]

Get detailed block information including all transactions given the starting/end block number

Arguments: blockStart - the start block number. blockEnd - the end of block number.

blocks(first: Long!, before: Long!): [Block]

Get detailed block information starting from the block number passed through "before" parameter. Returns: If first=n & before=blkNumber, n number of blocks before the specified blkNumber If before = -1, n number of recent blocks.

ChainQuery

Fields
blockNumber: Long

Returns the current block number of the Aion Kernel connected.

balance(address: String!): BigInteger

Returns the balance of the account address at latest block number.

Arguments: address - Account address

balanceByBlockNumber(address: String!, blockNumber: Long!): BigInteger

Returns a Long value representing the balance of the account address at a certain block number.

Arguments: address - Account address, blockNumber - the block number by long value at which the balance of the address should be retrieved from.

blockByHash(hash: String!): Block

Retrieves a block given the block hash.

Arguments: hash - 32 bytes hash of the desired block

blockByNumber(number: Long!): Block

Retrieves a block given the block number.

Arguments: number - the block number by long value of the desired block.

blockTransactionCountByHash(hash: String!): Long

Retrieves the total transactions within a block at a given block hash.

Arguments: hash - 32 bytes hash of the desired block.

blockTransactionCountByNumber(number: Long!): Long

Retrieves the total transactions within a block at a given block number.

Arguments: blockNumber - the block number by long value of the desired block.

nonce(address: String!): BigInteger

Returns a BigInteger representing the nonce of the account address at the latest block number.

Arguments: address - Account address

storageAt(address: String!, postion: Int!, blockNumber: Long = -1): String

Get the storage at a specific position of an address by current blockchain database status.

Arguments: address - account address, position - the index position of the storage, blockNumber - the block number by long value of the desired block.

transactionByBlockNumberAndIndex(blockNumber: Long!, index: Long!): TxDetails

Gets a transaction based on the block number and transaction index.

Arguments: blockNumber - The block number by long value of the desired block, index - The transaction position by int value of the transaction been stored into the desired block.

transactionByHash(txHash: String!): TxDetails

Retrieves the transaction given the transaction hash.

Arguments: txHash: 32 bytes hash of the desired transaction

transactionCount(addres: String!, blockNumber: Long!): Long

Retrieves the total transactions committed by a certain account address at a given block number.

Arguments: address - Account address, blockNumber - The block number by long value of the desired block.

NetQuery

Fields
isSyncing: Boolean

Check connected node's sync status.

protocol: Protocol

Returns the current version of the Aion modules.

activeNodes: [NodeInfo]

Returns the current active connected nodes.

peerCount: Int

Returns a int value the connecting peers number of the connecting kernel.

staticNodes: [NodeInfo]

Returns the whole consensus network nodes list.

isListening: Boolean

Returns a boolean value if the client is actively listening for network connections.

syncInfo: SyncInfo

Check connecting node syncing detailed information.

WalletQuery

Fields
accounts: [String]

Retrieves a list of accounts currently available on the local node.

defaultAccount: String

Returns the default account of the user latest set.

minerAccount: String

Returns the default miner account of the backend. miner account refers to the address utilized when isMining.

ContractQuery

Fields
call(from: String!, contractAddress: String!, abi: String!, function: ContractFunction!): ContractResponse

Invoke the contract method

Arguments: from - Sets the message sender address for function be executed, contractAddress - Contract address, abi - AbiDefinition String, function - ContractFunction object which contains function name and other required properties

events(from: String!, contractAddress: String!, abi: String!, events: [String!], contractEventFilter: ContractEventFilterInput, resultTypes: [Output]): [ContractEvent]

AccountMutator

For mutation

Fields
accountCreate(passphrase: [String!], privateKey: Boolean = false): [AccountKey]

Create new accounts by given password.

Arguments: passphrase - The list of String represent the passphrase choose for each new generate account, privateKey - The boolean value represent the key return including the private key or just the account address.

accountExport(keys: [AccountKeyExportInput!]): AccountKeyExport

Export accounts by given the password and the account address

Arguments: keys - AccountKeyExportInput object represent the passphrase and the account public address.

accountBackup(keys: [AccountKeyExportInput!]): AccountKeyExport

Export accounts by given the password and the account address

Arguments: keys - AccountKeyExportInput object represent the passphrase and the account public address.

accountImport(privateKey: String!, passphrase: String!): Boolean

Import account by given the password and the private key.

Arguments: privateKey: Private key of the account. passphrase: Passphrase of the account

WalletMutator

Fields
lockAccount(address: String!, passphrase: String!): Boolean

Lock the desired account given the correct passphrase.

Arguments: address - account address, passphrase - Passphrase of the account

unlockAccount(address: String!, passphrase: String!, duration: Int = 60): Boolean

Unlocks the desired account for the specified duration(in seconds) given the correct passphrase,

Arguments: address - Account address, passphrase - Passphrase of the account, duration - Unlock duration in second. Default value is 60 sec.

TxnMutator

Fields
call(args: TxArgsInput!): String

Initiates a call to retrieve the result from a contract.

Arguments: args - Tx arguments

compile(code: String!): Map

Sends the source code to be compiled in the backend, and returns all relevant information about the compiled code. Will throw if backend compiler is unavailable or code is improperly formatted.

Arguments: code - The class String of the source code to be compiled.

contractDeploy(contractDeploy: ContractDeployInput!): [DeployResponse]

Deploys a new contract onto the Aion blockchain.

Arguments: contractDeploy - Contract deploy arguments

eventDeregister(evts: [String], address: String): Boolean

Remove the listening events by given the event name and the contract address.

Arguments: evts - The list of the class String represent the events the user want to listen, address - Contract address

eventRegister(evts: [String]!, eventFilter: ContractEventFilterInput!, address: String!): Boolean

Register the events the user want to listen by given the event name, event filter and the contract address.

Arguments: evts - The list of the class String represent the events the user want to listen, eventFilter - ContractEventFilter, represents the event query conditions, address - Contract address

fastTxBuild(args: TxArgsInput!, call: Boolean!): Boolean

Pre-build TxArgs for increasing sendTransaction speeds if these transaction must been executed repeatedly. This function provides no functionality to assist with encoding or decoding transaction data. Users may choose to either use the more convenient contractApi for contract transactions.

Arguments: args - Tx Arguments, call - The boolean value represent the function of the contract is a call function.

sendRawTransaction(encodedTx: String!): MsgResp

Initiates a transaction given the encoded transaction byte array with the sender's signature. This function provides no functionality to assist with encoding or decoding transaction data. Users may choose to either use the more convenient contractApi class for contract transactions.

Arguments: encodedTx - The encoded transaction byte array with the sender's signature.

sendSignedTransaction(txArgs: TxArgsInput!, privateKey: String!): MsgResp

Initiates a transaction. Send a transaction including the raw transaction data and signed with the sender's key.

Argument: txArgs - Tx arguments, privateKey - Sender's private key

sendTransaction(txArgs: TxArgsInput!): MsgResp

Initiates a transaction.

Arguments: txArgs - Tx arguments

ContractMutator

Fields
createFromSource(source: String!, from: String!, nrgLimit: Long = 0, nrgPrice: Long = 0, value: BigInteger = 0, constructorArgs: [Param] = []): [Contract]!

Multiple contract create method for deploy contracts on the Aion network. When the constructorArgs are passed, api assumes that there is only one contract. To pass constructorArgs for multiple contracts in one call, use "createFromSourceMultipleContracts" method instead.

Arguments: source - The class String represent the contract source code. It could be multiple contracts, from - The sender or the contract owner whom deploy the contract, nrgLimit - The long value represent the maximum energy consume during this contract deploy been allowed, nrgPrice - The long value represent the unit price of the energy the contract deployer want to pay, value - The class BigInteger represent how many balance of the the sender's account want to send during this deploy, constructorArgs - Represent the contract constructor arguments when the contract has the constructor. It assums that there is only one contract.

createMultiContractsFromSource(source: String!, from: String!, nrgLimit: Long = 0, nrgPrice: Long = 0, value: BigInteger = 0, constructorArgsList: [ConstructorArgs]): [Contract]!

Multiple contract create methods for deploy contracts on the Aion network.

Arguments: source - The class String represent the contract source code. It could be multiple contracts, from - The sender or the contract owner whom deploy the contract, nrgLimit - The long value represent the maximum energy consume during this contract deploy been allowed, nrgPrice - The long value represent the unit price of the energy the contract deployer want to pay, value - The class BigInteger represent how many balance of the the sender's account want to send during this deploy, constructorArgsList - Represent the contract constructor arguments for mutiple contract when the contract has the constructor.

execute(from: String!, contractAddress: String!, abi: String!, function: ContractFunction!, nrgLimit: Long = 0, nrgPrice: Long = 0, txValue: Long = 0): ContractResponse

Executes the built transaction to invoke the contract method

Arguments: from - The sender's address, contractAddress - Contract address, abi - AbiDefinition string of the deployed contract, function - ContractFunction object, properties like function name etc, nrgLimit - The long value represent the maximum energy consume during this contract deploy been allowed, nrgPrice - The long value represent the unit price of the energy the contract deployer want to pay, txVAlue - he class BigInteger represent how many balance of the the sender's account want to send during this call if any

deregisterAllEvents: Boolean

This stops all events publisher currently started in graphql subscription layer through websocket. (@experimental feature)

Block

Fields
number: Long
nrgConsumed: Long
nrgLimit: Long
bloom: String
extraData: String
solution: String
hash: String
parentHash: String
nonce: BigInteger
difficulty: BigInteger
totalDifficulty: BigInteger
minerAddress: String
stateRoot: String
txTrieRoot: String
size: Int
txDetails: [TxDetails]
blockTime: Long

TxDetails

Fields
from: String
to: String
txHash: String
value: BigInteger
nonce: BigInteger
nrgConsumed: Long
nrgPrice: Long
data: String
txIndex: Int
contract: String
timestamp: Long
error: String
blockNumber: Long
blockHash: String

TxArgsInput

Txn input

MsgResp

Fields
status: String
msgHash: String
txHash: String
txResult: String
txDeploy: String
error: String

TxReceipt

Fields
blockHash: String
blockNumber: Long
contractAddress: String
cumulativeNrgUsed: Long
from: String
nrgConsumed: Long
to: String
txHash: String
txIndex: String

Account

Fields
publicKey: String
balance: BigInteger

Protocol

Fields
api: String
db: String
kernel: String
miner: String
net: String
txpool: String
vm: String

NodeInfo

Fields
blockNumber: Long
latency: Int
nodeId: String
p2pId: String
p2pPort: Int

SyncInfo

Fields
chainBestBlock: Long
maxImportBlocks: Long
networkBestBlock: Long
startingBlock: Long
isSyncing: Boolean

ContractResponse

Fields
constant: Boolean
data: [Any]
txHash: String
status: String
msgHash: String
error: String

ContractFunction

ContractEvent

Fields
address: String
blockHash: String
txHash: String
data: String
blockNumber: Long
logIndex: Int
eventName: String
removed: Boolean
results: [Any]

ContractEventFilterInput

Output

AccountKey

Fields
publicKey: String
privateKey: String
passphrase: String

AccountKeyExport

Fields
keyfiles: [String]
invalidAddr: [String]

AccountKeyExportInput

DeployResponse

Fields
address: String
txId: String

ContractDeployInput

Arguments
code: String

compileResponse: CompileResponseInput

Contract

contract

Fields
contractName: String
contractAddress: String
from: String
deployTxId: String
encodedData: String
abiDefinition: [ContractAbiEntry]
abiDefToString: String
source: String
code: String
compilerOptions: String
compilerVersion: String
developerDoc: String
languageVersion: String
userDoc: String

Param

ConstructorArgs

SolidityType

Possible Enum Values
_address
_bool
_int
_uint
_bytes
_string

ContractAbiEntry

Fields
anonymous: Boolean
constant: Boolean
name: String
payable: Boolean
type: String
event: Boolean
constructor: Boolean
hashed: String
fallback: Boolean

ContractAbiIOParam

Fields
name: String
paramLengths: [Int]
type: String
indexed: Boolean

Long

Long type

String

Built-in String

BigInteger

Built-in java.math.BigInteger

Int

Built-in Int

Boolean

Built-in Boolean

Map

Any

String | Int | Float | Boolean