Developer Fundamentals

-- VI. VET Transfers

Learn how to access native VET token transfers on VeChainThor using logs.filterTransferLogs, including how to filter by sender, recipient, and origin address.

Accessing VET Transfers

The VeChain token (VET) does not have a contract tied to it, so its transfers must be accessed from a different source.

Use logs.filterTransferLogs

Using logs.filterTransferLogs provides access to VET transfers, with the same filter options, but the criteriaSet is specifically tailored for transfer events.

Each criterion may include:

  • recipient: the address that receives VET

  • txOrigin: the address that initiated the transfer transaction

  • sender: the address that sent the VET

A sample request with all filters would appear as follows:

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

const logs = await thor.logs.filterTransferLogs({
  options: {
    offset: 0,
    limit: 3,
  },
  range: {
    unit: 'block',
    from: 0,
    to: 20000000,
  },
  criteriaSet: [
    {
      recipient: '0x000000000000000000000000000000000000dead',

      txOrigin: '0x19135a7c5c51950b3aa4b8de5076dd7e5fb630d4',

      sender: '0x19135a7c5c51950b3aa4b8de5076dd7e5fb630d4',
    },
  ],
  order: 'asc',
});

console.log('Retrieved VET transfer logs:', logs);