How to get the history of a wallet

What is the history of a wallet?

The history of a wallet refers to the complete record of all transactions, including both credits and debits, associated with a crypto wallet.

How to do it with Moralis

Moralis has a Wallet API that you can make use of, and they even provide a code sample for the wallet history use-case:

To adapt their code sample, replace the reference to Ethereum with their ID for Chiliz Chain, 0x15b38:

import Moralis from 'moralis';

try {
  await Moralis.start({
    apiKey: "YOUR_API_KEY"
  });

  const response = await Moralis.EvmApi.wallets.getWalletHistory({
    "chain": "0x15b38", // This is for Chiliz Chain Mainnet.
                        // For Spicy Testnet, use "0x15b32".
    "order": "DESC",
    "address": "0xYourWalletAddress"
  });

  console.log(response.raw);
} catch (e) {
  console.error(e);
}

How to do it with Tatum

Tatum has a comprehensive Data API that you can make use of, and they even provide a code sample for the wallet history use-case:

To adapt their code sample, replace the reference to Ethereum with Chiliz Chain:

// yarn add @tatumio/tatum
import {TatumSDK, Network, Chiliz, ResponseDto, AddressTransaction} from '@tatumio/tatum'

const tatum = await TatumSDK.init<Chiliz>({network: Network.CHILIZ})

const txs: ResponseDto<AddressTransaction[]> = await tatum.address.getTransactions({
  address: '0xYourWalletAddress', // replace with your address
})

console.log(txs.data)

How to do it with thirdweb

thirdweb has several short code samples on their docs site, which we can use as an inspiration.

Sadly, they don't seem to have transactions specific functions, so we're going to rely on the Chiliz Scan API.

const { ThirdwebSDK } = require("@thirdweb-dev/sdk");
const axios = require("axios");

const sdk = new ThirdwebSDK("https://rpc.chiliz.com");
const walletAddress = "0xYourWalletAddress";

// ChilizScan API URL and your API key (required)
const CHILIZ_SCAN_API_URL = "https://api.chilizscan.com/api";
const API_KEY = "YourChilizScanAPIKey"; // Optional, if the API requires authentication

async function getTransactionHistory() {
  try {
    const response = await axios.get(`${CHILIZ_SCAN_API_URL}?module=account&action=txlist&address=${walletAddress}&apikey=${API_KEY}`);
    const transactions = response.data.result;

    console.log(`Transaction history of wallet ${walletAddress}:`, transactions);
  } catch (error) {
    console.error("Error fetching transaction history:", error);
  }
}

getTransactionHistory();

How to do it with Nodit

Nodit provides the following code sample in their doc:

const url = 'https://web3.nodit.io/v1/chiliz/mainnet/blockchain/getTransactionsByAccount';
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    'X-API-KEY': 'nodit-demo'
  },
  body: JSON.stringify({
    accountAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
    relation: 'both',
    fromDate: '2025-01-01T00:00:00+00:00',
    toDate: '2025-01-31T00:00:00+00:00',
    withCount: false,
    withLogs: false,
    withDecode: false
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));

Last updated

Was this helpful?