Skip to main content

How to get transaction signatures

Prerequisites

Before getting started, make sure you have the following ready:

  • Node v.14+
  • NPM

Step 1: Setup Blocklens

First register your Blocklens account and get your Blocklens API Key.

Once you have your Blocklens API Key, install the Blocklens SDK in your project.

npm i blocklens-sdk

Step 2: Get transaction signatures

In order to get transaction signatures, Blocklens provides you a getTransactionSignatures endpoint to do so.

import Blocklens from "blocklens-sdk";

const blocklens = new Blocklens();
blocklens.init({ apiKey: "YOUR_API_KEY" });

const runApis = async () => {
const response = await blocklens.APTOS_MAINNET.getTransactionSignatures();
console.log(response);
};

runApis();

Step 3: Run the script

ts-node index.ts

In your terminal, you should see the following JSON response with the data: In your terminal, you should see the following JSON response with the data blocks:

{
"cursor": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjgzMzMyMTk0LCJwYWdlIjoxLCJpYXQiOjE2OTcwNjEyMDZ9.tenHDfH3TIkTUJo01UojmnY1rB8p2pAE7IPKCdPlico",
"page": 1,
"limit": 20,
"total_items": 1,
"data": [
{
"block_height": 98983173,
"transaction_version": 283332247,
"transaction_hash": "0xda8bb6f92dfdc93bca750bfe79807a0020457981d9e3cfd7cf9d63e229b9b9d5",
"transaction_type": "user_transaction",
"type": "ed25519_signature",
"public_key": "null",
"signature": "0x0ad45972298c4124c1408ce8e55b474460824b7313ea357b37dfcba19cee38733838f1c2eb6e3e4d818124c6f54e5ac6378378c9b81a209273eb67bd4fee4909",
"timestamp": 1696299683
}
]
}

Congratulations 🥳 you just found the get transaction signatures on multiple chains with only a few lines of code using the Blocklens Wallet API!

API Reference

If you want to know more details on the endpoint and optional parameters, check out:

Support

If you face any trouble following the tutorial, feel free to reach out to our community engineers in our Discord or Forum to get 24/7 developer support.