Build on Lichen

The developer portal for the agent-first blockchain. Everything you need to build, deploy, and scale.

$0.0001
Per Transaction
~400ms
BFT Finality
Latest Block
Validators
Explore the Developer Portal
Live Network Surfaces

Connect & Get Balance

A quick example in every supported language.

JavaScript
import { Connection, PublicKey } from '@lichen/sdk';

// Connect to public testnet
const connection = new Connection(
    'https://testnet-rpc.lichen.network',
    'wss://testnet-rpc.lichen.network/ws'
);

// Get balance for an address
const pubkey = new PublicKey('11111111111111111111111111111112');
const balance = await connection.getBalance(pubkey);

console.log(`Balance: ${balance.licn.toFixed(9)} LICN`);
// → Balance: 42.500000000 LICN
Python
import asyncio
from lichen import Connection, PublicKey

async def main():
    connection = Connection(
        "https://testnet-rpc.lichen.network",
        ws_url="wss://testnet-rpc.lichen.network/ws"
    )

    pubkey = PublicKey("11111111111111111111111111111112")
    balance = await connection.get_balance(pubkey)
    print(f"Balance: {balance['licn']:.9f} LICN")

    await connection.close()

asyncio.run(main())
# → Balance: 42.500000000 LICN
Rust
use lichen_client_sdk::{Client, Pubkey, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let client = Client::new("https://testnet-rpc.lichen.network");

    let pubkey = Pubkey::from_base58("11111111111111111111111111111112")?;
    let balance = client.get_balance(&pubkey).await?;

    println!("Balance: {:.9} LICN", balance.licn());
    Ok(())
}
CLI
# Check balance of the default identity
$ lichen --rpc-url https://testnet-rpc.lichen.network balance
42.500000000 LICN

# Check balance of a specific address
$ lichen --rpc-url https://testnet-rpc.lichen.network balance 11111111111111111111111111111112
42.500000000 LICN

# Switch to mainnet by replacing the endpoint
$ lichen --rpc-url https://rpc.lichen.network balance 11111111111111111111111111111112
42.500000000 LICN