Skip to content

Signing Transactions

Blink supports two Ed25519 authenticators.

AuthenticatorUseEndpoint
StandardDelegated trading keysPOST https://sequencer.blink.trade/sequencer/txs
SolanaOffchainSolana walletsPOST https://sequencer.blink.trade/sequencer/accept-solana-offchain-tx

Transaction schema

GET /rollup/schema returns the serialization schema, chain ID, chain name, and chain hash. The schema defines roots for RuntimeCall, UnsignedTransaction, and Transaction.

A runtime call is nested by module and call name:

ts
const runtimeCall: RuntimeCall = {
  perps: {
    cancel_all_orders: {
      owner: ownerAddress,
      vault_id: null,
      subaccount_id: 0,
    },
  },
}

Include every field defined for the call. Encode absent optional fields as null and large integers as decimal strings.

Wrap the call in an unsigned transaction:

ts
type UnsignedTransaction = {
  runtime_call: RuntimeCall
  uniqueness: { generation: number } | { nonce: number }
  details: {
    max_priority_fee_bips: number
    max_fee: string
    gas_limit: [number, number] | null
    chain_id: 4321
  }
}

The SDK uses generation: Date.now() by default.

Standard

Use Standard for delegated trading keys after a Solana wallet authorizes the key.

  1. Serialize the unsigned transaction with serializeUnsignedTx.
  2. Sign the serialized bytes followed by the schema's chain_hash.
  3. Create the schema's Transaction root:
ts
const transaction = {
  V0: {
    pub_key: publicKeyHex,
    signature: signatureHex,
    ...unsignedTransaction,
  },
}

pub_key is a 32-byte Ed25519 public key and signature is a 64-byte signature, both hex-encoded.

Serialize it with serializeTx, base64-encode the result, and submit { "body": "<base64>" }.

SolanaOffchain

Use SolanaOffchain for transactions signed by a Solana wallet, including delegation management, deposits, withdrawals, and transfers.

The signed JSON contains the unsigned transaction fields plus chain_name from the schema. solanaSimple signs that JSON directly; solana adds the standard Solana signing preamble. solanaAuto selects the appropriate format.

SolanaSignableRollup builds the envelope and submits its base64-encoded bytes.