Client (Blockchain)

This is the main class that interact with IOST blockchain and IOST smart contracts to get informations from them.

GetChainInfo


Client client = new Client("http://13.52.105.102:30001");
ChainInfo ci = client.GetChainInfo();
                

get chain info from blockchain

Returns

ChainInfo object instance.

Field Type Description
net_name String the name of network, such mainnet or testnet
protocol_version String the iost protocol version
head_block String head block height
head_block_hash String head block hash
lib_block String last irreversible block number
lib_block_hash String last irreversible block hash
witness_list String Array the current witness list

GetBlockByHash


Client client = new Client("http://13.52.105.102:30001");
BlockResponse r = client.GetBlockByHash("FxmCKUyumipwmZNvcRX1NXaZDRWqqHzL5uy76a1zoi4E", true);
                

get block info from blockchain by hash

PARAMETERS

Field Type Description
hash String the hash of the block
complete Boolean complete means whether including the full transactions and transaction receipts

Returns

BlockResponse object instance.

Field Type Description
status String transaction status
block Object BlockResponse Object

GetBlockByNum


Client client = new Client("http://13.52.105.102:30001");
BlockResponse r = client.GetBlockByNumber("1", true);
                

get block info from blockchain by num

PARAMETERS

Field Type Description
num Number the number of the block
complete Boolean complete means whether including the full transactions and transaction receipts

Returns

Returns BlockResponse object. check getBlockByHash

GetBalance


Client client = new Client("http://13.52.105.102:30001");
TokenBalance tb = client.GetBalance("admin", "iost", true);
                

get account balance

PARAMETERS

Field Type Description
account String account name
token String token name
useLongestChain Boolean get account by longest chain's head block or last irreversible block

Returns

Returns TokenBalance object.

GetToken721Balance


Client client = new Client("http://13.52.105.102:30001");
TokenBalance tb = client.GetToken721Balance("admin", "my721token", true);
                

get account token721 balance

PARAMETERS

Field Type Description
address String account name
tokenSymbol String token721 symbol
useLongestChain Boolean get account by longest chain's head block or last irreversible block

Returns

Returns TokenBalance object.

GetToken721Metadata


Client client = new Client("http://13.52.105.102:30001");
TokenBalance tb = client.GetToken721Metadata("tokenSymbol", "id", true);
                

get token721 metadata

PARAMETERS

Field Type Description
tokenSymbol String token name
tokenID String token id
useLongestChain Boolean get account by longest chain's head block or last irreversible block

Returns

Field Type Description
metadata String metadata

GetToken721Owner


Client client = new Client("http://13.52.105.102:30001");
TokenBalance tb = client.GetToken721Owner("tokenSymbol", "id", true);
                

get token721 owner

PARAMETERS

Field Type Description
tokenSymbol String token name
tokenID String token id
useLongestChain Boolean get account by longest chain's head block or last irreversible block

Returns

Field Type Description
owner String metadata

GetContract

get contract from blockchain

PARAMETERS

Field Type Description
id String contract id
useLongestChain Boolean get account by longest chain's head block or last irreversible block

Returns

Returns Json string of contract info.

GetContractStorage

get contract storage from blockchain

PARAMETERS

Field Type Description
contractID String contract id
key String the key in the StateDB
field String get the value from StateDB, field is needed if StateDB[key] is a map.(we get StateDB[key][field] in this case)
byLongestChain Boolean get account by longest chain's head block or last irreversible block

Returns

Returns Json string of contract storage info.

GetAccountInfo

get account info from blockchain

PARAMETERS

Field Type Description
name String account name
byLongestChain Boolean get account by longest chain's head block or last irreversible block

Returns

Return returns Account object.

Field Type Description
name String account name
balance String account balance
gas_info Object GasInfo Object
ram_info Object RAMInfo Object
permissions Dictionary Dictionary<String, Permission>
groups Dictionary Dictionary<String, Group>
frozen_balances Array array of FrozenBalance Object