>

>

1. Who’s Who on the Blockchain?

Exploring VeChain Accounts

On VeChainThor, every interaction happens through an account. But not all accounts are the same! 🧙‍♂️

There are two main flavors:

  1. Externally Owned Accounts (EOA): These are typical user wallets controlled by private keys.

  2. Smart Contracts: These are automated programs deployed with specific code.

How do you tell them apart? It's easy! Check the hasCode flag. If it's true, you're looking at a smart contract. Nice!

To start reading data, we initialize our ThorClient:

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

VeChain uses a dual-token system. When you look up an account, you'll see:

balance: This is your VET (Value-transfer token).

energy: This is your VTHO (Transaction/Gas token).

Both tokens use 18 decimals. This means the raw data looks like a giant number! To make it human-readable, we convert the hex-encoded BigInt and divide it by 10^18.

const account = await thor.accounts.getAccount('0x...');
console.log('VET:', BigInt(account.balance) / 10n**18n);
console.log('VTHO:', BigInt(account.energy) / 10n**18n);
const account = await thor.accounts.getAccount('0x...');
console.log('VET:', BigInt(account.balance) / 10n**18n);
console.log('VTHO:', BigInt(account.energy) / 10n**18n);
const account = await thor.accounts.getAccount('0x...');
console.log('VET:', BigInt(account.balance) / 10n**18n);
console.log('VTHO:', BigInt(account.energy) / 10n**18n);


You’re getting it! Now let’s add some "human" touch with Aliases. Aliases (like alice.vet) are human-readable names stored on-chain. They make it much easier to identify wallets than long hexadecimal strings!