Skip to main content

nexus_getVaultState

Get vault state for a user.
params[0]
string
required
User’s public key (hex)
result
object
Vault state including balances and pending withdrawals
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_getVaultState","params":["0x1234..."],"id":1}'
Response
{
  "jsonrpc": "2.0",
  "result": {
    "l1_balance": 100000,
    "l2_balance": 50000,
    "pending_withdrawals": [],
    "vault_address": "bcrt1p..."
  },
  "id": 1
}

nexus_getVaultAddress

Get deposit vault address for an L2 address.
params[0]
string
required
L2 account address
result
object
Vault address information
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_getVaultAddress","params":["bcrt1p..."],"id":1}'
Response
{
  "jsonrpc": "2.0",
  "result": {
    "vault_address": "bcrt1p...",
    "l2_address": "bcrt1p...",
    "protocol_key": "1234...",
    "timelock": 2016
  },
  "id": 1
}

nexus_deriveVaultFromPubkey

Derive vault address from public key.
params[0]
string
required
32-byte x-only public key (hex)
result
object
Derived vault address
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_deriveVaultFromPubkey","params":["0x1234..."],"id":1}'

nexus_registerPubkey

Register a public key for vault derivation.
params[0]
string
required
32-byte x-only public key (hex)
result
object
Registration result
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_registerPubkey","params":["0x1234..."],"id":1}'

nexus_requestWithdrawal

Request a withdrawal from L2 to L1.
params[0]
string
required
User’s public key
params[1]
string
required
Bitcoin destination address
params[2]
number
required
Amount in satoshis
result
object
Withdrawal request result
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_requestWithdrawal","params":["0x1234...", "bcrt1p...", 10000],"id":1}'

Vault Architecture

NEXUS vaults use Taproot addresses with two spending paths:

Protocol Path

The protocol maintains L1 vault balances to always match L2 balances, ensuring 1:1 backing.

Escape Path

Users can recover funds after a timelock (default: 2016 blocks ≈ 2 weeks).
Vault Address (P2TR)
├── Protocol Path: <ProtocolKey> OP_CHECKSIG
└── Escape Path: <Timelock> OP_CSV OP_DROP <UserKey> OP_CHECKSIG
The escape path ensures users can always recover their funds, even if the protocol becomes unresponsive.