Signature Scheme
Vela uses the same elliptic curve as Ethereum: secp256k1. Signatures follow the EIP-191 personal sign standard, which prepends a standard prefix to prevent signed messages from being mistaken for Ethereum transactions:r (32 bytes) + s (32 bytes) + v (1 byte, recovery id: 27 or 28).
Order Signing
Every order submitted to Vela must be signed by the account’s private key. The signing payload is the canonical JSON serialization of the order parameters:address field. If verification fails, the order is rejected with INVALID_SIGNATURE.
WebSocket Authentication
WebSocket private channels use a challenge-response flow:1
Request challenge
2
Receive challenge
3
Sign and respond
Nonce Replay Prevention
Thenonce field in each order is a per-account monotonic integer. The engine tracks a nonce high-water mark per account and rejects any order with nonce ≤ high_water_mark.
This prevents replay attacks: a signed order cannot be re-submitted by a third party who intercepts it, because the nonce has already been consumed.
Nonce management best practices:
Implementation: ethers.js
Address Derivation
The engine derives the signer address from the signature using the standard Ethereum address derivation:- Recover the public key from
(hash, r, s, v) - Take
keccak256of the uncompressed public key (64 bytes, without the 0x04 prefix) - Take the last 20 bytes → Ethereum address
k256 Rust crate in the engine.