SOCI4L

Balances, and the wei problem

Step 1 of 3
0 of 1 goals

Read a raw balance

Ask for Ada's balance:

const raw = await client.getBalance({ address: '0x1111111111111111111111111111111111111111' })
console.log(raw)

That enormous number is correct. Chains do not store decimals — a balance is an integer count of the smallest unit, and for AVAX that unit is wei, one quintillionth (10^-18) of an AVAX.

So 250.5 AVAX is stored as 250500000000000000000.

// Ada:  0x1111111111111111111111111111111111111111
// Cleo: 0x3333333333333333333333333333333333333333

Press Run, or hit the button above. Output lands here.

Goals

Print the raw balance
run the code to check this
Run the code to load this lesson’s chain.