SOCI4L

Your first query

Step 1 of 2
0 of 2 goals

Ask the chain how tall it is

In your own project you would write:

const client = createPublicClient({ chain: avalanche, transport: http() })

Here that is done for you. Same viem, same methods, pointed at a chain inside this tab.

const height = await client.getBlockNumber()
console.log(height)

Note what comes back: a bigint, not a number.

// Everything here is real viem. Try it.
// `client` is already connected — see the notes on the left.

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

Goals

Print something
run the code to check this
Print the block height
run the code to check this
Run the code to load this lesson’s chain.