This page will document the API classes and ways to properly use the API. Subsequent new releases also maintain backward compatibility with this class approach. Welcome please submit the issue in Github directly. Bytom-PHP-SDK Issues
Key API
Account API
Asset API
Transaction API
Wallet API
Access Token API
Block API
Mining API
Other API
BytomClient::createKey($alias, $password);
String
- alias, name of the key.String
- password, password of the key.
String
- alias, name of the key.String
- xpub, pubkey of the key.String
- file, path to the file of key.
BytomClient::listKeys();
none
Array of Object
, keys owned by the client.Object
:String
- alias, name of the key.String
- xpub, pubkey of the key.
BytomClient::deleteKey($xpub, $password);
String
- xpub, pubkey of the key.String
- password, password of the key.
none if the key is deleted successfully.
BytomClient::resetKeyPassword($xpub, $old_password, $new_password);
Object
:
String
- xpub, pubkey of the key.String
- old_password, old password of the key.String
- new_password, new password of the key.
none if the key password is reset successfully.
BytomClient::createAccount($root_xpubs = [], $alias, $quorum = 1);
Array of String
- root_xpubs, pubkey array.String
- alias, name of the account.Integer
- quorum, the default value is1
, threshold of keys that must sign a transaction to spend asset units controlled by the account.
Optional:
String
- access_token, if optional when creating account locally. However, if you want to create account remotely, it's indispensable.
String
- id, account id.String
- alias, name of account.Integer
- key_index, key index of account.Integer
- quorom, threshold of keys that must sign a transaction to spend asset units controlled by the account.Array of Object
- xpubs, pubkey array.
BytomClient::listAccounts();
none
Array of Object
, account array.Object
:String
- id, account id.String
- alias, name of account.Integer
- key_index, key index of account.Integer
- quorom, threshold of keys that must sign a transaction to spend asset units controlled by the account.Array of Object
- xpubs, pubkey array.
BytomClient::deleteAccount($account_info);
String
- account_info, alias or ID of account.
none if the account is deleted successfully.
BytomClient::createAccountReceiver($account_alias, $account_id);
Object
: account_alias | account_id
optional:
String
- account_alias, alias of account.String
- account_id, id of account.
String
- address, address of account.String
- control_program, control program of account.
BytomClient::listAddresses($account_alias, $account_id);
String
- account_alias, alias of account.String
- account_id, id of account.
Array of Object
, account address array.Object
:String
- account_alias, alias of account.String
- account_id, id of account.String
- address, address of account.Boolean
- change, whether the account address is change.
BytomClient::validateAddress($address);
string
- address, address of account.
Boolean
- vaild, whether the account address is vaild.Boolean
- is_local, whether the account address is local.
BytomClient::createAsset($root_xpubs = [], $alias, $quorum = 1);
Array of String
- root_xpubs, pubkey array.String
- alias, name of the asset.Integer
- quorum, the default value is1
, threshold of keys that must sign a transaction to spend asset units controlled by the account.
Optional:
Object
- definition, definition of asset.String
- access_token, if optional when creating asset locally. However, if you want to create asset remotely, it's indispensable.
String
- id, asset id.String
- alias, name of the asset.String
- issuance_program, control program of the issuance of asset.Array of Object
- keys, information of asset pubkey.String
- definition, definition of asset.Integer
- quorum, threshold of keys that must sign a transaction to spend asset units controlled by the account.
BytomClient::getAsset($asset_id);
String
- id, id of asset.
String
- id, asset id.String
- alias, name of the asset.String
- issuance_program, control program of the issuance of asset.Integer
- key_index, index of key for xpub.Integer
- quorum, threshold of keys that must sign a transaction to spend asset units controlled by the account.Array of Object
- xpubs, pubkey array.String
- type, type of asset.Integer
- vm_version, version of VM.String
- raw_definition_byte, byte of asset definition.Object
- definition, description of asset.
BytomClient::listAssets();
none
Array of Object
, asset array.Object
:String
- id, asset id.String
- alias, name of the asset.String
- issuance_program, control program of the issuance of asset.Integer
- key_index, index of key for xpub.Integer
- quorum, threshold of keys that must sign a transaction to spend asset units controlled by the account.Array of Object
- xpubs, pubkey array.String
- type, type of asset.Integer
- vm_version, version of VM.String
- raw_definition_byte, byte of asset definition.Object
- definition, description of asset.
BytomClient::updateAssetAlias($asset_id, $alias);
String
- id, id of asset.String
- alias, new alias of asset.
none if the asset alias is updated success.
BytomClient::listBalances($asset_id, $alias);
none
Array of Object
, balances owned by the account.Object
:String
- account_id, account id.String
- account_alias, name of account.String
- asset_id, asset id.String
- asset_alias, name of asset.Integer
- amount, specified asset balance of account.
BytomClient::listUnspentOutPuts($id);
optional:
String
- id, id of unspent output.
Array of Object
, unspent output array.Object
:String
- account_id, account id.String
- account_alias, name of account.String
- asset_id, asset id.String
- asset_alias, name of asset.Integer
- amount, specified asset balance of account.String
- address, address of account.Boolean
- change, whether the account address is change.String
- id, unspent output id.String
- program, program of account.String
- control_program_index, index of program.String
- source_id, source unspent output id.String
- source_pos, position of source unspent output id in block.String
- valid_height, valid height.
BytomClient::buildTransaction($actions = [], $base_transaction = null, $ttl = 0);
String
- base_transaction, base data for the transaction.Integer
- ttl, integer of the time to live in seconds.Arrary of Object
- actions:Object
:String
- account_id | account_alias, alias or ID of account.String
- asset_id | asset_alias, alias or ID of asset.Integer
- amount, the specified asset of the amount sent with this transaction.String
- type, type of transaction, valid types: 'issue', 'spend', 'address'.String
- address, (type is address) address of receiver.String
- receiver, (type is spend) program of receiver.
Object of build-transaction
- transaction, builded transaction.
BytomClient::signTransaction($password, $transaction);
Object
:
String
- password, signature of the password.Object
- transaction, builded transaction.
Object
:
Boolean
- sign_complete, returns true if sign succesfully and false otherwise.Object of sign-transaction
- transaction, signed transaction.
BytomClient::submitTransaction($raw_transaction);
Object
- raw_transaction, raw_transaction of signed transaction.
String
- tx_id, transaction id, hash of transaction.
BytomClient::estimateTransactionGas($transaction_template);
Object
- transaction_template, builded transaction response.
Integer
- total_neu, total consumed neu(1BTM = 10^8NEU) for execute transaction.Integer
- storage_neu, consumed neu for storage transaction .Integer
- vm_neu, consumed neu for execute VM.
BytomClient::getTransaction($tx_id);
Object
:
String
- tx_id, transaction id, hash of transaction.
Object
:
Integer
- block_height, block height where this transaction was in.String
- block_hash, hash of the block where this transaction was in.String
- block_transactions_count, transaction count where this transaction was in the block.String
- tx_id, transaction id, hash of the transaction.Integer
- block_index, position of the transaction in the block.Boolean
- status_fail, whether the state of the request has failed.String
- block_time, the unix timestamp for when the requst was responsed.Array of Object
- inputs, object of inputs for the transaction.Array of Object
- outputs, object of outputs for the transaction.
BytomClient::listTransactions();
Object
:
optional:
String
- tx_id, transaction id, hash of transaction.String
- account_id, id of account.Bool
- detail , flag of required transactions data ,default false (only return transaction summary)
Array of Object
, transaction array.
BytomClient::backupWallet();
none
Object
- account_image, account image.Object
- asset_image, asset image.Object
- key_images, key image.
BytomClient::restoreWallet();
Object
:
Object
- account_image, account image.Object
- asset_image, asset image.Object
- key_images, key image.
none if restore wallet success.
BytomClient::createAccessToken($token_id);
String
- id, token ID.
optional:
String
- type, type of token.
String
- token, access token.String
- id, token ID.String
- type, type of token.Object
- created_at, time to create token.
BytomClient::listAccessTokens();
none
Array of Object
, access token array.Object
:String
- token, access token.String
- id, token ID.String
- type, type of token.Object
- created_at, time to create token.
BytomClient::deleteAccessToken($token_id);
String
- id, token ID.
none if the access token is deleted successfully.
BytomClient::checkAccessToken($token_id, $secret);
String
- id, token ID.String
- secret, secret of token, the second part of the colon division for token.
none if the access token is checked valid.
BytomClient::getBlockCount();
none
Integer
- block_count, recent block height of the blockchain.
BytomClient::getBlockHash();
none
String
- block_hash, recent block hash of the blockchain.
BytomClient::getBlock($block_hash, $block_height);
Object
: block_height | block_hash
optional:
String
- block_hash, hash of block.Integer
- block_height, height of block.
Object
:
BytomClient::getBlockHeader($block_hash, $block_height);
Object
: block_height | block_hash
optional:
String
- block_hash, hash of block.Integer
- block_height, height of block.
Object
- block_header, header of block.Integer
- reward, reward.
BytomClient::getDifficulty($block_hash, $block_height);
Object
:
optional:
String
- block_hash, hash of block.Integer
- block_height, height of block.
Object
:
Integer
- bits, bits of block.String
- difficulty, difficulty of block.String
- hash, block hash.Integer
- height, block height.
BytomClient::getHashRate($block_hash, $block_height);
Object
:
optional:
String
- block_hash, hash of block.Integer
- block_height, height of block.
Object
:
Integer
- hash_rate, difficulty of block.String
- hash, block hash.Integer
- height, block height.
BytomClient::isMining();
none
Boolean
- is_mining, whether the node is mining.
BytomClient::setMining();
Boolean
- is_mining, whether the node is mining.
BytomClient::netInfo();
none
Boolean
- listening, whether the node is listening.Boolean
- syncing, whether the node is syncing.Boolean
- mining, whether the node is mining.Integer
- peer_count, current count of connected peers.Integer
- current_block, current block height in the node's blockchain.Integer
- highest_block, current highest block of the connected peers.String
- network_id, network id.String
- version, bytom version.
BytomClient::gasRate();
none
Integer
- gas_rate, gas rate.
BytomClient::verifyMessage($address, $derived_xpub, $message, $signature);
String
- address, address for account.String
- derived_xpub, derived xpub.String
- message, message for signature by derived_xpub.String
- signature, signature for message.
Boolean
- result, verify result.
BytomClient::getWork();
none
Object
- block_header, raw block header.Object
- seed, seed.
BytomClient::submitWork($block_header);
Object
- block_header, raw block header.
true if success