Skip to main content

Crate bulk_keychain

Crate bulk_keychain 

Source
Expand description

§bulk-keychain

A simple high perf signing lib for BULK txns.

This crate provides the core functionality for signing transactions on BULK. Designed for low-latency, high-throughput trading systems.

§Features

  • Fast signing: Ed25519 signatures with SIMD optimizations
  • Batch signing: Sign multiple transactions in parallel using Rayon
  • Zero-copy serialization: Minimal allocations in hot paths
  • Type-safe: Rust’s type system prevents malformed transactions

§Quick Start

use bulk_keychain::{Keypair, Order, SignatureDomain, Signer, TimeInForce};

// Generate a new keypair
let keypair = Keypair::generate();

// Create an order
let order = Order::limit("BTC-USD", true, 100000.0, 0.1, TimeInForce::Gtc);

// Sign the transaction
let mut signer = Signer::new(keypair, SignatureDomain::Devnet);
let signed_tx = signer.sign(order.into(), None).unwrap();

§Batch Signing

For high-frequency trading, use batch signing to maximize throughput:

use bulk_keychain::{Keypair, Order, SignatureDomain, Signer, TimeInForce};

let keypair = Keypair::generate();
let mut signer = Signer::new(keypair, SignatureDomain::Devnet);

// Create many independent orders
let orders: Vec<_> = (0..1000)
    .map(|i| Order::limit("BTC-USD", i % 2 == 0, 100000.0 + i as f64, 0.1, TimeInForce::Gtc).into())
    .collect();

// Sign all at once - automatically uses parallel signing for large batches
let signed_txs = signer.sign_all(orders, None).unwrap();

Re-exports§

pub use nonce::parse_decimal as parse_nonce_decimal;
pub use nonce::NonceManager;
pub use nonce::NonceStrategy;
pub use order_id::compute_limit_order_id;
pub use order_id::compute_market_order_id;
pub use order_id::compute_order_id;
pub use order_id::compute_order_item_id;
pub use prepare::finalize_all;
pub use prepare::finalize_transaction;
pub use prepare::finalize_transaction_bytes;
pub use prepare::prepare_action;
pub use prepare::prepare_agent_wallet;
pub use prepare::prepare_all;
pub use prepare::prepare_approve_builder_code;
pub use prepare::prepare_approve_commission_fee;
pub use prepare::prepare_create_multisig;
pub use prepare::prepare_create_sub_account;
pub use prepare::prepare_faucet;
pub use prepare::prepare_group;
pub use prepare::prepare_message;
pub use prepare::prepare_multisig_approve;
pub use prepare::prepare_multisig_cancel;
pub use prepare::prepare_multisig_execute;
pub use prepare::prepare_multisig_propose;
pub use prepare::prepare_multisig_reject;
pub use prepare::prepare_remove_sub_account;
pub use prepare::prepare_rename_sub_account;
pub use prepare::prepare_revoke_builder_code;
pub use prepare::prepare_revoke_commission_fee;
pub use prepare::prepare_transfer;
pub use prepare::prepare_update_liquidator_config;
pub use prepare::prepare_update_multisig_policy;
pub use prepare::prepare_user_settings;
pub use prepare::prepare_withdraw;
pub use prepare::prepare_withdraw_lock_recover;
pub use prepare::PreparedMessage;
pub use bs58;
pub use ed25519_dalek;
pub use types::*;

Modules§

nonce
Nonce management utilities
order_id
Order ID computation.
prepare
Message preparation for external wallet signing.
types
Type definitions for BULK transactions

Structs§

Keypair
Ed25519 keypair for signing transactions
Signer
High-performance signer.

Enums§

Error
All errors that can occur in bulk-keychain

Type Aliases§

Result
Result type alias for bulk-keychain operations