Getting started
Why this matters
The SDK is how a business puts Varnir inside its own product: take payments into wallets it controls, pay out, trade, raise invoices, and hand an AI agent a key that can only spend within limits set on the ledger. Keys are made and used in your own process, so Varnir never holds the key that signs for you.
Pick a language
TypeScript is the reference SDK. The others are ports that follow the same core contract, so amounts, network codes and error codes mean the same thing in every language.
| Language | Package |
|---|---|
| TypeScript | @varnir/chain-client |
| Python | varnir |
| Kotlin / Java | varnir-sdk |
| C# / .NET | Varnir.Sdk |
| Go | site.varnir/sdk |
| PHP | varnir/sdk |
| Rust | varnir-sdk |
| Dart / Flutter | varnir |
| Swift | Varnir |
Not every port covers every method yet. The overview lists what each one supports and how to install it.
The flow in five steps
Every integration follows the same path, whichever language you use:
- Get a key. Generate a recovery phrase and derive a private key from it, in your own process. Store the phrase: it is the only way back to the identity.
- Onboard. Put the identity on the ledger. This is idempotent, so it is safe to call every time your process starts.
- Get a wallet. Ask for a deposit address on a network such as Tron Nile.
- Send or invoice. Pay out, or raise an invoice that a customer pays.
- Get told. Set a deposit callback so your server hears about payments.
In TypeScript, steps 1 to 4 look like this:
import {VarnirClient, VarnirChain} from '@varnir/chain-client';
import {generateRecoveryPhrase, derivePrivateKeyFromPhrase} from '@varnir/chain-client/keys';
const phrase = generateRecoveryPhrase();
const {privateKeyHex} = derivePrivateKeyFromPhrase(phrase);
const client = await VarnirClient.onboard({network: 'testnet', privateKeyHex});
const wallet = await client.getWallet(VarnirChain.TronNile);
const invoice = await client.createInvoice({
wallets: [wallet],
name: 'First invoice',
amount: '10',
});
console.log(invoice.url); // https://scanner.varnir.site/pay/<id>
'testnet' is the entire configuration: you never name a hostname, a contract
id or a transaction shape. The TypeScript guide goes through
each step in full, and each language page shows
its own version.
Try it without installing anything
Every snippet on the playground runs this same API live in a browser tab, against the public testnet.
Next
- Overview & backends: the rules every SDK follows, and which methods need a chain node, a gateway or the scanner.
- The signing model: what is signed, and why no private key is ever sent.
- Invoices and Webhooks: every field, and how you hear about payments.