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 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.

Wallet APIs

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:

Statistics APIs

Forge provides different ways to check related statistics:

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 chain
    • account_migrate: migrate a wallet from old address (as well as pk, sk) to a new address.
  • asset

    • 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
  • governance:

    • 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
  • trade:

    • transfer: transfer tokens or/and assets from one wallet to another.
    • exchange: exchange tokens or/and assets between two parties.