Search...

⌘K

>

>

1. VET: The Native Currency

The Native Pulse

Did you know VET is a bit special? 🌟

Unlike other tokens on VeChainThor (like B3TR or other ERC20 tokens), VET doesn't have a smart contract address.

Think of VET as the "cash" of the network. Because it's built directly into the blockchain's core, you can't query it through standard smart contract event logs.

In JavaScript, this means we use a dedicated native method: thor.logs.filterTransferLogs.

Nice! To get started, we connect our ThorClient to the network:

import { ThorClient } from '@vechain/sdk-network';
const thor = ThorClient.at('https://mainnet.vechain.org');

// Let's find the latest transfers!
const logs = await thor.logs.filterTransferLogs({
  range: { unit: 'block', from: 0, to: 20000000 },
  options: { offset: 0, limit: 5 }
});
import { ThorClient } from '@vechain/sdk-network';
const thor = ThorClient.at('https://mainnet.vechain.org');

// Let's find the latest transfers!
const logs = await thor.logs.filterTransferLogs({
  range: { unit: 'block', from: 0, to: 20000000 },
  options: { offset: 0, limit: 5 }
});
import { ThorClient } from '@vechain/sdk-network';
const thor = ThorClient.at('https://mainnet.vechain.org');

// Let's find the latest transfers!
const logs = await thor.logs.filterTransferLogs({
  range: { unit: 'block', from: 0, to: 20000000 },
  options: { offset: 0, limit: 5 }
});

You're getting it! You can even narrow your search by filtering for a specific sender, recipient, or the txOrigin (the person who started the whole transaction).

Wait, what if you need to read the amount? Native tokens use 18 decimals! 📏

To turn that giant number into something human-readable, we use BigInt to handle the large value and divide it by $10^{18}$.

Almost there! Monitoring these native pulses is the first step to building interactive heatmaps and interaction maps for your users.


Technical Note: Don't look for a contract address for VET—there isn't one! Also, remember that limit and offset are crucial for pagination if you're searching through millions of blocks.