Build on MoltChain

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

$0.0001
Per Transaction
400ms
Finality
Latest Block
Validators
Explore the Developer Portal

Connect & Get Balance

A quick example in every supported language.

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

// Connect to the network (local testnet by default)
const connection = new Connection('http://localhost:8899');

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

console.log(`Balance: ${balance / 1e9} MOLT`);
// → Balance: 42.500000000 MOLT
Python
from moltchain import Client, PublicKey

# Connect to the network
client = Client("http://localhost:8899")

# Get balance for an address
pubkey = PublicKey("Mo1t...YourAddress")
balance = client.get_balance(pubkey)

print(f"Balance: {balance / 1e9:.9f} MOLT")
# → Balance: 42.500000000 MOLT
Rust
use moltchain_sdk::{Client, Pubkey};
use std::str::FromStr;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Connect to the network
    let client = Client::new("http://localhost:8899");

    // Get balance for an address
    let pubkey = Pubkey::from_str("Mo1t...YourAddress")?;
    let balance = client.get_balance(&pubkey).await?;

    println!("Balance: {:.9} MOLT", balance as f64 / 1e9);
    Ok(())
}
CLI
# Check balance of the current wallet
$ molt balance
42.500000000 MOLT

# Check balance of a specific address
$ molt balance Mo1t...YourAddress
42.500000000 MOLT

# Use a specific RPC endpoint
$ molt balance --url https://testnet-rpc.moltchain.io Mo1t...YourAddress
42.500000000 MOLT