Forge provides two sets of APIs : gRPC and graphQL, which implement a similar set of interface. This guide uses gRPC API as examples.
Chain APIs
APIs to access the chain / node / validator information.
get_chain_info
: retrieve the current status of the chainget_node_info
: retrieve the current status of the nodeget_net_info
: retrieve the network infoget_validators_info
: retrieve the current validator infoget_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.
Wallet APIs
declare_node
: declare a new node
State APIs
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.
Statistics APIs
Forge provides different ways to check related statistics:
get_forge_states
: return statistics about Forgelist-transactions
: list out transactions based on filter providedlist-assets
: list out assets based on filter providedlist-account
: list out accounts based on filter providedlist-top-accounts
: list out accounts with highest balancelist-asset-transactions
: list out transactions related to certain assetslist-blocks
: list out blocks based on filter providedget-health-status
: get health status of Forge
Subscription APIs
In forge you can subscribe to events that exposed by the system, mainly consensus events like begin_block
, end_block
, 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.
Transaction APIs
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.
-
account
declare
: declare a wallet to the chainaccount_migrate
: migrate a wallet from old address (as well as pk, sk) to a new address.
-
asset
create_asset
: create a new assetcreate_asset_factory
: create a new asset factoryupdate_asset
: update an existing assetacquire_asset
: acquire an asset from an existing asset factoryconsume_asset
: consume an asset. e.g. use a movie ticket in cinema
-
governance:
deploy_protocol
: deploy a new protocol into the chain at a given block heightupgrade_node
: upgrade the node to a new version at a given block height
-
trade:
transfer
: transfer tokens or/and assets from one wallet to another.exchange
: exchange tokens or/and assets between two parties.