Skip to content

Moonbeam Custom API

Introduction

Moonbeam nodes include support for two custom JSON-RPC endpoints: moon_isBlockFinalized and moon_isTxFinalized. These endpoints provide valuable functionality for checking the finality of on-chain events.

To begin exploring Moonbeam's custom JSON-RPC endpoints, you can try out the provided curl examples below. These examples demonstrate how to query the public RPC endpoint of Moonbase Alpha. However, you can easily modify them to use with your own Moonbeam or Moonriver endpoint by changing the URL and API key. If you haven't already, you can obtain your endpoint and API key from one of our supported Endpoint Providers.

Supported Custom RPC Methods

moon_isBlockFinalized

Checks for the finality of the block given by its block hash.

  • block_hash string - the hash of the block, accepts either Substrate-style or Ethereum-style block hash as its input

Returns a boolean: true if the block is finalized, false if the block is not finalized or not found.

curl -H "Content-Type: application/json" -X POST --data '{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "moon_isBlockFinalized",
  "params": ["INSERT_BLOCK_HASH"]
}' https://rpc.api.moonbase.moonbeam.network
moon_isTxFinalized

Checks for the finality of a transaction given its EVM transaction hash.

  • tx_hash string - the EVM transaction hash of the transaction

Returns a boolean: true if the transaction is finalized, false if the transaction is not finalized or not found.

curl -H "Content-Type: application/json" -X POST --data '{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "moon_isTxFinalized",
  "params": ["INSERT_TRANSACTION_HASH"]
}' https://rpc.api.moonbase.moonbeam.network
Last update: June 10, 2024
| Created: April 17, 2024