Documentation Index
Fetch the complete documentation index at: https://docs.unlink.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Network
Unlink is live on Base Sepolia.| Resource | Value |
|---|---|
| Network | Base Sepolia |
| Chain ID | 84532 |
| API URL | https://staging-api.unlink.xyz |
| Pool Address | 0x647f9b99af97e4b79DD9Dd6de3b583236352f482 |
Base Sepolia faucet
Get testnet ETH for gas.
Prerequisites
Make sure you have:- Node.js v18 or later
- A package manager (npm, pnpm, yarn, or bun)
- A TypeScript project
Don't have a project yet?
Don't have a project yet?
Create a tenant and a session
The SDK splits work into two pieces: a process-wide Tenant (engine URL + API key, cached env info) and a per-user Session (account identity + optional EVM signer). Build the Tenant once, then call Use The What each piece does:
tenant.forUser({ account }) once per user — in a multi-user backend, that’s per request.- Server-side (Node.js)
- Browser (viem)
- Browser (ethers)
- Multi-user backend
Use a private key and viem for backends, scripts, bots, or AI agents.
account.fromSeed(...) or account.fromKeys(...) when you already manage seed material or raw account keys outside the SDK.Derive identity from a wallet signature (MetaMask)
For browser apps where you don’t want users to manage a separate mnemonic, derive the Unlink identity from a one-timepersonal_sign signature on the user’s existing EVM wallet. Same EOA + same tenant + same chain ⇒ same unlink1… address, as long as the wallet emits deterministic ECDSA (RFC-6979) — which every mainstream wallet does today (MetaMask, Rabby, Coinbase Wallet, Ledger, Trezor, viem, ethers).tenantName string lives in the signed message verbatim — the SDK does not lowercase or canonicalise it, so use a stable slug from your tenant config. tenantName and chainId are also bound into the HKDF salt, so reusing a stale signature against a different (tenant, chain) context derives a fresh, empty address rather than silently surfacing the old identity.If you already hold the signature (e.g. you signed via viem’s walletClient.signMessage(...)), use account.fromEthereumSignature({ signature, tenantName, chainId }) instead — pass the same values you used to build the message. See Utilities for the message-format reference.personal_sign (EIP-191) is suitable for demos and trusted-origin flows. For production, prefer the EIP-712 typed-data variant (follow-up). EOA-only — smart-account wallets (Safe, Argent, Coinbase Smart Wallet) are not supported by this path. For long-term recovery, call account.export(keys) once after first derivation and store the keystore alongside (or independently of) the wallet signature.| Concept | Role |
|---|---|
createWalletClient (viem) / BrowserProvider (ethers) | Standard EVM wallet — signs on-chain transactions (deposits, approvals). Not Unlink-specific. |
account.fromMnemonic() | Derives your Unlink account (private spending & viewing keys) from a BIP-39 mnemonic. A different mnemonic = a different Unlink identity. |
registerAccount() | Registers the account once so the backend can build deposits, transfers, and withdrawals for that Unlink identity. |
evm.fromViem() / evm.fromEthers() | Bridges your EVM wallet into the SDK so Unlink can submit on-chain transactions on your behalf. |
createTenant() | Process-wide handle (engine URL + API key). Construct once at app startup. |
tenant.forUser({ account, evm }) | Per-user Session. Every SDK operation (deposit, transfer, withdraw, balances) goes through this session. |
Get your Unlink address
Your Unlink address (This address is deterministically derived from your mnemonic. The same mnemonic always produces the same address.
unlink1...) is your identity inside the privacy pool. Share it to receive private transfers — it does not reveal your EVM wallet.Get test tokens
Fund your Unlink account directly via the faucet. No EVM approval or gas needed.You can verify the balance arrived:See Faucet for other options like minting public ERC-20 tokens to an EVM wallet.
Withdraw
Going further
Deposit from an EVM wallet
To move ERC-20 tokens from an on-chain wallet into the unlink contract, usedepositWithApproval(). It runs the one-time Permit2 approval per token, waits for confirmation, and then runs the deposit — one call instead of three.
ensureErc20Approval() plus deposit() directly.
See Deposit for the full parameter reference, approval helpers, and EVM provider setup.