Forge provides two sets of APIs : gRPC and graphQL, which implement a similar set of interface. This guide uses gRPC API as examples.
APIs to access the chain / node / validator information.
get_chain_info: retrieve the current status of the chain
get_node_info: retrieve the current status of the node
get_net_info: retrieve the network info
get_validators_info: retrieve the current validator info
get_tx: return an already processed transaction by its hash. If this API returns nil, mostly your tx hasn't been included in a block. You need to wait until it is processed.
get_block: get a block by its height. All txs included in this block will be returned.
get_blocks: get a list of blocks between a range.
send_tx: send the given tx to a node. It will return a tx hash immediately once the tx is accepted, or an error.
declare_node: declare a new node
Forge provides different types of the state. You can query a state by its address. We provide several APIs for you to easily access the states:
get_account_state: return the state for an array of account, node, validator or application address.
get_asset_state: return the state for an array of assets.
get_forge_state: return global state for forge.
get_protocol_state: return installed protocol state.
Forge provides different ways to check related statistics:
get_forge_states: return statistics about Forge
list-transactions: list out transactions based on filter provided
list-assets: list out assets based on filter provided
list-account: list out accounts based on filter provided
list-top-accounts: list out accounts with highest balance
list-asset-transactions: list out transactions related to certain assets
list-blocks: list out blocks based on filter provided
get-health-status: get health status of Forge
In forge you can subscribe to events that exposed by the system, mainly consensus events like
commit_block or transaction protocol events.
subscribe: subscribe to a topic. You can event set a filter for the event that you'd listen.
unsubscribe: terminate the subscription by the topic id.
To help client to compose a transaction easily we provided the transaction APIs that could help to generate complicated transactions and send it to a given node. Each SDK might have different implementations. For specific use case, please use the Forge SDK manual.
declare: declare a wallet to the chain
account_migrate: migrate a wallet from old address (as well as pk, sk) to a new address.
create_asset: create a new asset
create_asset_factory: create a new asset factory
update_asset: update an existing asset
acquire_asset: acquire an asset from an existing asset factory
consume_asset: consume an asset. e.g. use a movie ticket in cinema
deploy_protocol: deploy a new protocol into the chain at a given block height
upgrade_node: upgrade the node to a new version at a given block height
transfer: transfer tokens or/and assets from one wallet to another.
exchange: exchange tokens or/and assets between two parties.