Skip to main content

Query the ledger

In this guide, you will learn how to query an Ethereum-based ledger using the MARCO Explorer plugin.

Prerequisites

To complete this guide, you need to have our Postman collection set up.

Configure the environment

To configure your Postman environment to query the Ethereum-based ledger, follow these steps:

  1. Choose a ledger you want to get information from the DLTs list and copy its explorer URL. In this guide, we will use Finboot's Ethereum network explorer https://api-marco.finboot.com/resource-proxy/PLG-e336dc31463.

    note

    Explorers are not included in the Core API. Instead, they are distributed as plugins because each ledger has its own implementation published at a unique URL. Nevertheless, all explorers adhere to the same API contract, meaning that you can use the same code to query different ledgers.

  2. In Postman, open the Environment tab and choose MARCO Environment.

    Postman environment tab

  3. Set the variable baseUrl to the explorer URL you have choosen.

    Postman environment values

    Make sure that the other variables are set to the values you have obtained in Get your API tokens.

  4. Save your changes with Ctrl + S.

  5. Set MARCO Environment as the default environment.

    Postman default environment

  6. Select the MARCO APIs collection, and make sure the Authorization Type is set to Bearer and Token to {{accessToken}}.

    Postman authentication

Get a transaction status

To get the status of a transaction, follow these steps:

  1. On Postman, open the MARCO APIs collection.

  2. Navigate to the endpoint MARCO Explorer API Library > transaction > get Transaction By Locator.

  3. On the Params tab, configure the parameters as shown in the image below:

    Postman params

    This will retrieve the status of the transaction with locator ID 0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad.

  4. Before making an API call, set ApplicationToken to {{applicationToken}} on the Headers tab.

    Postman headers

  5. Click the Send button to send the request. You will see the response under the Body tab.

    {
    "locator": "0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad",
    "status": true,
    }

    This means, that the transaction with locator ID 0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad has been successfully executed.

    tip

    Alternatively, you can send the same request using cURL from the command line:

    curl --location -g 'https://api-marco.finboot.com/resource-proxy/PLG-e336dc31463/transaction?locator=0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad' \
    --header 'Accept: application/json' \
    --header 'ApplicationToken: <APPLICATION_TOKEN>' \
    --header 'Authorization: Bearer <ACCESS_TOKEN>'

Get transaction details

To get additional information about a transaction, follow these steps:

  1. On Postman, open the MARCO API collection.

  2. Navigate to the endpoint MARCO Explorer API Library > transaction > get Receipt For Transaction By Locator

  3. On the Params tab, configure the parameters as shown in the image below:

    Postman params

    This will retrieve information of the transaction with hash 0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad.

  4. Before making an API call, set ApplicationToken to {{applicationToken}} on the Headers tab.

    Postman headers

  5. Click the Send button to send the request. You will see the response under the Body tab.

    {
    "locator": "0x974e4965d2637489378faa4211f9a9305b2a5f041e31eeb08d3cd37fc9491a73",
    "smartContractAddress": null,
    "status": "succeeded"
    }
    tip

    Alternatively, you can send the same request using cURL from the command line:

    curl --location -g 'https://api-marco.finboot.com/resource-proxy/PLG-e336dc31463/transaction/receipt?locator=0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad' \
    --header 'Accept: application/json' \
    --header 'ApplicationToken: <APPLICATION_TOKEN>' \
    --header 'Authorization: Bearer <ACCESS_TOKEN>'

Get block details

note

This is a brand new set of endpoints, docs will be available shortly!

Get account details

note

This is a brand new set of endpoints, docs will be available shortly!

Next steps

Congratulations! You now have a basic understanding of how to interact with MARCO APIs. To further enhance your knowledge, take a look at the following documentation:

  • Concepts: Gain a deeper understanding of MARCO's architecture and main features.
  • Guides: Learn how to use the MARCO Platform to build blockchain applications.
  • Clients: Interact with MARCO APIs using your preferred programming language.
  • References: Discover the REST APIs that allow you to integrate MARCO into your own applications and services.