← 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: "hfhe_v1|base64..." }
ParamTypeDescription
value requirednumberPlaintext value (in smallest unit)
ReturnsTypeDescription
ciphertextstringHFHE v1 prefixed PVAC ciphertext

octra_pvac_encryptProve

Encrypts a value and generates a Pedersen commitment + bound zero proof in a single approved operation. Optionally includes a range proof. Routed through the accelerator when available.

const result = await window.octra.request({
  method: 'octra_pvac_encryptProve',
  params: [{ value: 1000000, rangeProof: true }],
});
// { ciphertext, amount_commitment, zero_proof, blinding, range_proof? }
ParamTypeDescription
value requirednumberPlaintext value (in smallest unit)
rangeProofbooleanIf true, also generates a range proof on the ciphertext
ReturnsTypeDescription
ciphertextstringHFHE v1 prefixed PVAC ciphertext
amount_commitmentstringBase64 Pedersen commitment to the value
zero_proofstringBase64 bound zero proof
blindingstringBase64 blinding factor (for commitment verification)
range_proofstringBase64 range proof (only if rangeProof=true)

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: "rp_v1|base64..." }
ParamTypeDescription
ciphertext requiredstringBase64-encoded PVAC ciphertext
value requirednumberThe value the ciphertext is expected to encrypt
ReturnsTypeDescription
proofstringPrefixed base64 range proof

Homomorphic Arithmetic

Raw arithmetic on encrypted ciphertexts. No user approval required — these are fast WASM operations. Ciphertexts passed as arguments should be raw base64 (strip the hfhe_v1| prefix first).

octra_pvac_ctAdd

Add two ciphertexts: result = a + b

const result = await window.octra.request({
  method: 'octra_pvac_ctAdd',
  params: [{ a: 'base64...', b: 'base64...' }],
});
// { ciphertext: "base64..." }
ParamTypeDescription
a requiredstringBase64 ciphertext A (raw, no prefix)
b requiredstringBase64 ciphertext B (raw, no prefix)
ReturnsTypeDescription
ciphertextstringBase64 result ciphertext

octra_pvac_ctSub

Subtract two ciphertexts: result = a - b

const result = await window.octra.request({
  method: 'octra_pvac_ctSub',
  params: [{ a: 'base64...', b: 'base64...' }],
});
// { ciphertext: "base64..." }
ParamTypeDescription
a requiredstringBase64 ciphertext A (raw, no prefix)
b requiredstringBase64 ciphertext B (raw, no prefix)
ReturnsTypeDescription
ciphertextstringBase64 result ciphertext

octra_pvac_ctMul

Multiply two ciphertexts: result = a * b

const result = await window.octra.request({
  method: 'octra_pvac_ctMul',
  params: [{ a: 'base64...', b: 'base64...' }],
});
// { ciphertext: "base64..." }
ParamTypeDescription
a requiredstringBase64 ciphertext A (raw, no prefix)
b requiredstringBase64 ciphertext B (raw, no prefix)
ReturnsTypeDescription
ciphertextstringBase64 result ciphertext

octra_pvac_ctAddConst

Add a plaintext constant to a ciphertext: result = ct + k

const result = await window.octra.request({
  method: 'octra_pvac_ctAddConst',
  params: [{ ciphertext: 'base64...', value: 100 }],
});
// { ciphertext: "base64..." }
ParamTypeDescription
ciphertext requiredstringBase64 ciphertext (raw, no prefix)
value requirednumberPlaintext constant to add
ReturnsTypeDescription
ciphertextstringBase64 result ciphertext

octra_pvac_ctSubConst

Subtract a plaintext constant from a ciphertext: result = ct - k

const result = await window.octra.request({
  method: 'octra_pvac_ctSubConst',
  params: [{ ciphertext: 'base64...', value: 50 }],
});
// { ciphertext: "base64..." }
ParamTypeDescription
ciphertext requiredstringBase64 ciphertext (raw, no prefix)
value requirednumberPlaintext constant to subtract
ReturnsTypeDescription
ciphertextstringBase64 result ciphertext

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

octra_pvac_stealthTransfer

Encrypts a transfer amount, homomorphically subtracts it from the sender's encrypted balance, and generates range proofs on both the delta and new balance — all in a single approved operation. Used by dApps implementing custom encrypted tokens.

const result = await window.octra.request({
  method: 'octra_pvac_stealthTransfer',
  params: [{
    balance: 'base64...',   // sender's encrypted balance (raw, no prefix)
    amount: 100,            // amount to transfer
    balanceValue: 1000,     // sender's known plaintext balance
  }],
});
// { ciphertext, amount_commitment, zero_proof, blinding,
//   new_balance, range_proof_delta, range_proof_balance, new_balance_value }
ParamTypeDescription
balance requiredstringSender's encrypted balance (raw base64, no hfhe_v1| prefix)
amount requirednumberAmount to transfer (plaintext)
balanceValue requirednumberSender's known plaintext balance (for range proof)
ReturnsTypeDescription
ciphertextstringHFHE v1 prefixed delta ciphertext
amount_commitmentstringPedersen commitment to the transfer amount
zero_proofstringBound zero proof for the delta
blindingstringBlinding factor for the commitment
new_balancestringBase64 new encrypted balance ciphertext
range_proof_deltastringRange proof on the delta ciphertext
range_proof_balancestringRange proof on the new balance ciphertext
new_balance_valuenumberNew plaintext balance (for local tracking)

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

zkTLS

zkTLS lets DApps generate zero-knowledge proofs of TLS sessions. The wallet records a TLS handshake and the Octane Accelerator (Jolt zkVM) proves it locally — no data leaves the user's machine. Requires the Octane Accelerator to be running.

octra_requestZktlsProofJolt

Records a TLS session to the given URL and generates a zero-knowledge proof of the response using Jolt. Proofs are cached by ID — subsequent calls with the same ID return instantly.

const result = await window.octra.request({
  method: 'octra_requestZktlsProofJolt',
  params: [{
    url: 'https://api.github.com/zen',
    headers: { Accept: 'application/json' },
    id: 'github-zen-proof',
    records: [0, 1],
  }],
});
// { proof, public_inputs, url, status, _cached?, _cacheAge? }
ParamTypeDescription
url requiredstringURL to fetch and prove
headersobjectCustom HTTP headers (JSON object)
idstringUnique claim ID for caching. Same ID + URL returns cached proof.
recordsnumber[]TLS record indices to include in the proof (default: all)
regeneratebooleanForce regeneration, skip cache
ReturnsTypeDescription
proofstringBase64-encoded Jolt proof blob
public_inputsobjectPublic inputs (URL hash, response digest, record metadata)
urlstringThe proven URL
statusstringProof status ("verified" or "error")
_cachedbooleanTrue if this was a cached proof
_cacheAgenumberAge of cached proof in seconds

💡 Try it live: Open the Demo App → — section 11 exercises the full zkTLS flow interactively.