← octane.fast

Wallet API Reference

The Octane wallet exposes a JSON-RPC API via window.octra. DApps call methods using window.octra.request({ method, params }).

This is the same provider pattern used by MetaMask and other Ethereum wallets.

// Basic usage
const accounts = await window.octra.request({
  method: 'octra_requestAccounts',
});
console.log(accounts[0]); // "octAbc..."

💡 Live example: Open the PVAC Proof Demo → — an interactive page that exercises encrypt, decrypt, range proof, and commitment APIs against your wallet.

Authentication

When a Dapp calls a method, the extension prompts the user for approval (for sensitive operations like signing or sending).

It's usually best to call octra_requestAccounts first to establish a connection and get the user's address.

Error Handling

All methods reject with an Error if something goes wrong. The wallet returns structured error objects with an error string field. Handle them in a try/catch:

try {
  const result = await window.octra.request({ method: 'octra_balance' });
} catch (e) {
  console.log(e.message); // error string from the table below
}

Connection Errors

ErrorDescription
User rejected connectionUser denied the connection approval popup
User rejected requestUser denied a generic approval popup (PVAC encrypt, decrypt, range proof, etc.)

Wallet State Errors

ErrorDescription
lockedWallet is locked — call octra_requestAccounts to trigger unlock
Wallet is lockedSame as above, used in dApp context
no walletExtension installed but no wallet has been created or imported
PVAC derivation failedFailed to derive privacy keys from the seed

Transaction Errors

ErrorDescription
User rejected transactionUser denied the send transaction approval popup
User rejected signature requestUser denied the message signing approval popup
User rejected contract callUser denied the contract call approval popup
User rejected decrypt requestUser denied the PVAC decrypt approval popup
invalid amountAmount is zero, negative, or not a valid number
Invalid contract call dataMalformed calldata passed to octra_contractCall

Balance & Privacy Errors

ErrorDescription
missing valueRequired value parameter not provided (PVAC encrypt)
Missing ciphertextCiphertext not provided for decrypt operation
No encrypted balanceShield/unshield attempted but no on-chain encrypted balance exists
Insufficient encrypted balance: have X, need YUnshield or stealth send amount exceeds the encrypted balance

Stealth Transfer Errors

ErrorDescription
recipient_no_pvacRecipient has no PVAC public key registered on-chain — they need funds to receive stealth sends
Recipient has no public key registeredRecipient has never made a transaction — they must transact at least once
Invalid recipient public keyRecipient's registered public key is malformed

Network Errors

ErrorDescription
Tor proxy not reachable at 127.0.0.1:9050Tor routing enabled but Tor Browser is not running

Connection

octra_requestAccounts

Requests permission to connect. Opens an approval popup in the wallet extension. Returns an array with the active account address.

const accounts = await window.octra.request({
  method: 'octra_requestAccounts',
});
// ["octAbc123..."]
ReturnsTypeDescription
accountsstring[]Array with one address string

octra_accounts

Returns currently connected accounts without prompting. Returns empty array if not connected.

const accounts = await window.octra.request({
  method: 'octra_accounts',
});
// ["octAbc123..."] or []
ReturnsTypeDescription
accountsstring[]Array of connected addresses (empty if not connected)

octra_disconnect

Disconnects the Dapp from the wallet. Subsequent calls to octra_accounts will return an empty array.

Balances

octra_balance

Returns the public (unencrypted) balance for the connected account.

const result = await window.octra.request({
  method: 'octra_balance',
});
// { formatted: "1.500000", raw: "1500000" }
ReturnsTypeDescription
formattedstringHuman-readable balance (e.g. "1.500000")
rawstringRaw balance in smallest unit (microOCT)

octra_encryptedBalance

Returns the encrypted (on-chain) private balance ciphertext. Requires the wallet to be unlocked.

const result = await window.octra.request({
  method: 'octra_encryptedBalance',
});
// { cipher: "hfhe_v1|...", has_pvac_pubkey: true }
ReturnsTypeDescription
cipherstringHFHE v1 prefixed ciphertext (base64), or "0" if no balance
has_pvac_pubkeybooleanWhether the account has a PVAC public key registered on-chain

octra_decryptedBalance

Decrypts the private balance using PVAC keys and returns the human-readable value. This is an expensive operation — the wallet caches the result.

const result = await window.octra.request({
  method: 'octra_decryptedBalance',
});
// { balance: "1000000" }
ReturnsTypeDescription
balancestringDecrypted balance as a string (microOCT)

octra_tokensByAddress

Returns OCS-01 tokens held by the given address.

const tokens = await window.octra.request({
  method: 'octra_tokensByAddress',
});
// [{ contract: "oct...", symbol: "wOCT", balance: "5000000" }]
ReturnsTypeDescription
tokensobject[]Array of token objects
tokens[].contractstringToken contract address
tokens[].symbolstringToken symbol
tokens[].balancestringToken balance (raw)

Transactions

octra_sendTransaction

Sends a public transaction. Opens an approval popup showing the recipient, amount, and fee.

const result = await window.octra.request({
  method: 'octra_sendTransaction',
  params: [{
    to: 'octRecipient123...',
    amount: '1.5',
  }],
});
// { hash: "abc123..." }
ParamTypeDescription
to requiredstringRecipient address
amount requiredstringAmount in OCT (human-readable, e.g. "1.5")
feestringCustom fee override
ReturnsTypeDescription
hashstringTransaction hash

octra_signMessage

Signs an arbitrary message with the wallet's ed25519 key. Opens an approval popup.

const result = await window.octra.request({
  method: 'octra_signMessage',
  params: ['Hello, Octra!'],
});
// { signature: "base64..." }
ReturnsTypeDescription
signaturestringBase64-encoded ed25519 signature

octra_contractCall

Calls a smart contract method on-chain. Opens an approval popup.

const result = await window.octra.request({
  method: 'octra_contractCall',
  params: [{
    contract: 'octContractAddr...',
    method: 'transfer',
    params: ['octRecipient...', 1000000],
  }],
});
ParamTypeDescription
contract requiredstringContract address
method requiredstringMethod name to call
paramsany[]Method arguments
ReturnsTypeDescription
resultobjectContract call result (shape depends on the contract)

Privacy (PVAC)

PVAC (Pedersen Verifiable Arithmetic Commitments) is the privacy primitive used by Octra. These methods let Dapps work with encrypted values, generate commitments and proofs — all handled by the wallet's crypto layer.

octra_pvac_encrypt

Encrypts a plaintext value into a PVAC ciphertext. Uses the wallet's PVAC public key.

const result = await window.octra.request({
  method: 'octra_pvac_encrypt',
  params: [{ value: 1000000 }],
});
// { ciphertext: "base64..." }
ParamTypeDescription
value requirednumberPlaintext value (in smallest unit)
ReturnsTypeDescription
ciphertextstringBase64-encoded PVAC ciphertext

octra_pvac_decrypt

Decrypts a PVAC ciphertext back to its plaintext value. Requires wallet unlock and user approval.

const result = await window.octra.request({
  method: 'octra_pvac_decrypt',
  params: [{ ciphertext: 'base64...' }],
});
// { value: 1000000 }
ParamTypeDescription
ciphertext requiredstringBase64-encoded PVAC ciphertext to decrypt
ReturnsTypeDescription
valuenumberDecrypted plaintext value

octra_pvac_commit

Creates a Pedersen commitment to a value with a random blinding factor. Used by the faucet and other protocols to prove wallet ownership without revealing the value.

const result = await window.octra.request({
  method: 'octra_pvac_commit',
  params: [{ value: 3000000 }],
});
// { commitment: "base64..." }
ParamTypeDescription
value requirednumberValue to commit to (in smallest unit)
ReturnsTypeDescription
commitmentstringBase64-encoded Pedersen commitment

octra_pvac_rangeProof

Generates a zero-knowledge range proof that a ciphertext encrypts a specific non-negative value. Required for shield/unshield operations.

const result = await window.octra.request({
  method: 'octra_pvac_rangeProof',
  params: [{
    ciphertext: 'base64...',
    value: 1000000,
  }],
});
// { proof: "base64..." }
ParamTypeDescription
ciphertext requiredstringBase64-encoded PVAC ciphertext
value requirednumberThe value the ciphertext is expected to encrypt
ReturnsTypeDescription
proofstringBase64-encoded range proof

Stealth Transfers

octra_stealth_send

Sends a private (stealth) transfer to another account. The amount is encrypted on-chain — only the sender and recipient can see it. The recipient discovers the payment by scanning for stealth-tagged outputs.

const result = await window.octra.request({
  method: 'octra_stealth_send',
  params: [{
    to: 'octRecipient...',
    amount: '100',
  }],
});
// { jobId: "uuid..." }

Stealth sends are bucketed — the amount must be one of: 1, 10, 100, 1000, 10000, 100000, 1000000 OCT.

ParamTypeDescription
to requiredstringRecipient address
amount requiredstringAmount in OCT (must be a bucket value)
ReturnsTypeDescription
jobIdstringJob ID to track the stealth send progress

Network

octra_getNetworkInfo

Returns the current network configuration (mainnet vs devnet, RPC URL).

const info = await window.octra.request({
  method: 'octra_getNetworkInfo',
});
// { name: "mainnet", chainId: "octra-mainnet-1", rpcUrl: "https://octra.network/rpc" }
ReturnsTypeDescription
namestringNetwork name ("mainnet" or "devnet")
chainIdstringChain identifier
rpcUrlstringCurrent RPC endpoint URL