Skip to main content

Quickstart

From zero to a sent transaction. This page uses the TypeScript SDK (@qorechain/sdk); short connect-and-read snippets for Python, Go, and Rust follow at the end.

1. Connect

createClient() resolves a network and composes the read clients, a fee helper, and a lazy signing entrypoint. It targets the public testnet (qorechain-diana) by default. The default endpoints point at localhost, so pass endpoints to talk to a real node.

import { createClient } from "@qorechain/sdk";

// Testnet (chain id "qorechain-diana"), default localhost endpoints.
const client = createClient();

// Point at a real node by overriding endpoints.
const remote = createClient({
endpoints: {
rest: "https://rest.testnet.example", // Cosmos REST (LCD)
rpc: "https://rpc.testnet.example", // consensus RPC (for signing)
evmRpc: "https://evm.testnet.example", // EVM + qor_ JSON-RPC
},
});

Mainnet (chain id qorechain-vladi) is live. Select it and override the localhost defaults with your node URLs:

const main = createClient({
network: "mainnet",
endpoints: {
rest: "https://rest.mainnet.example",
rpc: "https://rpc.mainnet.example",
evmRpc: "https://evm.mainnet.example",
},
});

2. Derive an account

A single mnemonic derives native (qor1…), EVM (0x…), and SVM (base58) accounts via independent derivation paths.

import {
generateMnemonic,
deriveNativeAccount,
} from "@qorechain/sdk";

const mnemonic = generateMnemonic(); // 12 words (pass 256 for 24 words)

const native = await deriveNativeAccount(mnemonic);
console.log(native.address); // "qor1..." (Cosmos-style secp256k1)

See Accounts & PQC signing for EVM/SVM derivation and the full derivation table.

3. Read a balance

// Cosmos bank balances over REST.
const balances = await client.rest.getAllBalances(native.address);

// A typed qor_ JSON-RPC call.
const tokenomics = await client.qor.getTokenomicsOverview();

4. Send a QOR transfer

Derive a native account, adapt its private key into a signer, connect a TxClient, and send tokens. Use toBase("1.5") to convert QOR to base uqor.

import {
createClient,
deriveNativeAccount,
directSignerFromPrivateKey,
toBase,
} from "@qorechain/sdk";

const client = createClient({
endpoints: {
rpc: "https://rpc.testnet.example",
rest: "https://rest.testnet.example",
},
});

const account = await deriveNativeAccount(mnemonic);

// Adapt the raw secp256k1 key into an offline signer bound to the "qor" prefix.
const signer = await directSignerFromPrivateKey(account.privateKey, "qor");

// Connect a tx client at the consensus RPC endpoint.
const tx = await client.connectTx(signer);

// Estimate a fee, then send 1.5 QOR.
const fee = await client.fees.estimate(); // or "fast" | "normal" | "slow"
const result = await tx.bankSend(
"qor1recipientaddress...",
[{ denom: "uqor", amount: toBase("1.5") }],
{ fee },
);

console.log(result.transactionHash);

toBase("1.5") returns "1500000" (QOR has 10^6 base uqor units).

Other languages: connect & read

These mirror the same network presets and read surface.

Python

from qorechain import create_client

client = create_client() # testnet preset (localhost endpoints)
print(client.network.chain_id) # "qorechain-diana"

balances = client.rest.get_all_balances("qor1...")
stats = client.qor.get_ai_stats()
client.close()

Go

import "github.com/qorechain/qorechain-sdk/packages/go/qorechain/client"

c, err := client.CreateClient(client.Options{}) // defaults to "testnet"
if err != nil {
panic(err)
}
fmt.Println(c.Network.ChainID) // qorechain-diana

balances, err := c.REST.GetAllBalances("qor1...")
stats, err := c.Qor.GetAIStats()

Rust

use qorechain::ClientBuilder;

#[tokio::main]
async fn main() -> qorechain::Result<()> {
let client = ClientBuilder::new().build()?; // defaults to "testnet"
let balances = client.rest.get_all_balances("qor1...").await?;
let stats = client.qor.get_ai_stats().await?;
let _ = (balances, stats);
Ok(())
}

Next