Skip to main content

bulk-keychain

A simple high perf signing lib for BULK txns - Python bindings.

Installation

pip install bulk-keychain

Quick Start

from bulk_keychain import Keypair, Signer

# Generate a new keypair
keypair = Keypair()
print(f"Public key: {keypair.pubkey}")

# Or import from base58
# keypair = Keypair.from_base58("your-secret-key...")

# Create a signer
signer = Signer(keypair, "devnet")

# Sign a limit order
signed = signer.sign({
    "type": "order",
    "symbol": "BTC-USD",
    "is_buy": True,
    "price": 100000.0,
    "size": 0.1,
    "order_type": {"type": "limit", "tif": "GTC"}
})

# Submit to API
import requests
response = requests.post(
    "https://api.bulk.exchange/api/v1/order",
    json={
        "actions": signed["actions"],
        "nonce": signed["nonce"],
        "account": signed["account"],
        "signer": signed["signer"],
        "signature": signed["signature"],
    }
)

Order Types

Limit Order

{
    "type": "order",
    "symbol": "BTC-USD",
    "is_buy": True,
    "price": 100000.0,
    "size": 0.1,
    "order_type": {"type": "limit", "tif": "GTC"}  # GTC, IOC, or ALO
}

Market Order

{
    "type": "order",
    "symbol": "BTC-USD",
    "is_buy": True,
    "price": 0.0,
    "size": 0.1,
    "order_type": {"type": "market", "is_market": True, "trigger_px": 0.0}
}

Cancel Order

{
    "type": "cancel",
    "symbol": "BTC-USD",
    "order_id": "order-id-base58"
}

Cancel All Orders

{
    "type": "cancel_all",
    "symbols": ["BTC-USD"]  # or [] for all symbols
}

Builder Codes

Builder codes are optional builder-code fees for routed limit and market orders. Python order input uses builder_code; API JSON emits builderCode on orders and abc/rbc approval actions. When builder_code is absent, it contributes no signing bytes.

Batch Signing

For high-frequency trading, sign many transactions in parallel:

# Sign all at once - each order becomes one transaction
signed_txs = signer.sign_all(orders)

For multi-order atomic transactions, batch order_ids are optional:

signer.set_compute_batch_order_ids(True)  # default False for max performance
grouped = signer.sign_group([entry_order, stop_loss, take_profit])
print(grouped.get("order_ids"))

API Reference

Keypair

# Generate new keypair
keypair = Keypair()

# Import from base58
keypair = Keypair.from_base58("secret-key-base58")

# Import from bytes (32 or 64 bytes)
keypair = Keypair.from_bytes(bytes_data)

# Properties and methods
keypair.pubkey          # Public key as base58 string
keypair.to_base58()     # Full keypair as base58 (64 bytes)
keypair.to_bytes()      # Full keypair as bytes
keypair.secret_key()    # Secret key as bytes (32 bytes)

Signer

# Create signer
signer = Signer(keypair, "devnet")
signer = Signer.from_base58("secret-key-base58", "devnet")

# With nonce management 
signer = Signer.with_nonce_manager(keypair, "timestamp", "devnet")
signer = Signer.with_nonce_manager(keypair, "counter", "devnet")
signer = Signer.with_nonce_manager(keypair, "high_frequency", "devnet")

# Optional ID computation controls
signer.set_compute_order_id(True)            # default True
signer.set_compute_batch_order_ids(False)    # default False
signer.computes_order_id()
signer.computes_batch_order_ids()

# Sign operations
signed = signer.sign(order, nonce=None)
signed = signer.sign_group([order1, order2], nonce=None)
signed = signer.sign_faucet(nonce=None)
signed = signer.sign_agent_wallet(agent_pubkey, delete=False, nonce=None)
signed = signer.sign_user_settings(max_leverage=[("BTC-USD", 5.0)], nonce=None)
signed = signer.sign_oracle_prices([(1704067200000000000, "BTC-USD", 102500.0)], nonce=None)
signed = signer.sign_pyth_oracle([(1704067200000000000, 1, 10250000000000, -8)], nonce=None)
signed = signer.sign_whitelist_faucet(target_pubkey, whitelist=True, nonce=None)
signed = signer.sign_approve_builder_code(builder_pubkey, fee=5, nonce=None)
signed = signer.sign_revoke_builder_code(builder_pubkey, nonce=None)
signed_list = signer.sign_all(orders, base_nonce=None)

Tuple formats:

  • sign_oracle_prices: (timestamp, asset, price)
  • sign_pyth_oracle: (timestamp, feed_index, price, exponent)

Utilities

from bulk_keychain import random_hash, current_timestamp, validate_pubkey, validate_hash

# Generate random hash for client order IDs
client_id = random_hash()

# Get the current Unix timestamp in nanoseconds
ts = current_timestamp()

# Validate base58 strings
is_valid = validate_pubkey("pubkey-base58")
is_valid = validate_hash("hash-base58")

Compute order ID without a signer/private key:

from bulk_keychain import compute_order_id_from_order

order_id = compute_order_id_from_order(
    {"type": "order", "symbol": "BTC-USD", "is_buy": True, "price": 100000.0, "size": 0.1},
    nonce=1704067200000,
    account="your-account-pubkey",
)

# Compact API order JSON is also supported:
order_id_compact = compute_order_id_from_order(
    {"l": {"c": "BTC-USD", "b": True, "px": 100000.0, "sz": 0.1, "r": False, "tif": "GTC"}},
    nonce=1704067200000,
    account="your-account-pubkey",
)

Release files for bulk-keychain 0.1.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bulk-keychain 0.1.28
File Size Uploaded
bulk_keychain-0.1.28.tar.gz 90.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for bulk-keychain 0.1.28
File
bulk_keychain-0.1.28-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
bulk_keychain-0.1.28-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
bulk_keychain-0.1.28-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
bulk_keychain-0.1.28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
bulk_keychain-0.1.28-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
bulk_keychain-0.1.28-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
bulk_keychain-0.1.28-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
bulk_keychain-0.1.28-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
bulk_keychain-0.1.28-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
bulk_keychain-0.1.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
bulk_keychain-0.1.28-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
bulk_keychain-0.1.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
bulk_keychain-0.1.28-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ ARM64 Details

Total release size: 8.5 MB

Release files / bulk_keychain-0.1.28.tar.gz

Download URL bulk_keychain-0.1.28.tar.gz
Size 90.3 kB
Tags Source
SHA-256 checksum
How to use checksums
73ad2f0980c7745d3870167d2155985d71088555c398ccff09d76c96a911446c
BLAKE2b-256 checksum
How to use checksums
3b2004a798755d721d24a599f1273591077e6be2d085cbf9fa73b76366c03f9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL bulk_keychain-0.1.28-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 680.7 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
062cde1664fab87d1659c77b09c72cacae0fff56d03e68dc697e3e41d55a21bd
BLAKE2b-256 checksum
How to use checksums
50a9a92950cafb7a664f5a4d816d1bc65f1db99f39ad496ba8784aa988aec800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL bulk_keychain-0.1.28-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 635.7 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
cbcdbab463d87705d6a525c3e84112f1729891d5f9ae0394cb33443d40b3da7e
BLAKE2b-256 checksum
How to use checksums
82dda9bcea1bf0396fde7b4fd4734a666677a9e5281168e2276f309d3e841530
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp312-cp312-win_amd64.whl

Download URL bulk_keychain-0.1.28-cp312-cp312-win_amd64.whl
Size 526.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
3d63ad46e7aa3ae28b73ba136bf8ee4cc42039be9806fadb1fb4b500ed3061b1
BLAKE2b-256 checksum
How to use checksums
b7013cb2bb7a3da19fd12925e83b7ad07a2a96514301fe7c3873969c48c15b03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL bulk_keychain-0.1.28-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 679.2 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8153a3d5d94db0a7b0ceb534480e911c9d289458677f20f48937cf819f6b0738
BLAKE2b-256 checksum
How to use checksums
5d387abd80164d5671306f549dca737ac3fbad55e706348b1b1089dbffc08413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL bulk_keychain-0.1.28-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 633.8 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
4d63cc9ab80892b582a3545d84481ab1ebfe14b3cbc6496619e52751ff83488b
BLAKE2b-256 checksum
How to use checksums
4fc83f5a2befa4ab1625d6e78f17a53c7bf416c98e6329daa4a52cba073fe648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp312-cp312-macosx_11_0_arm64.whl

Download URL bulk_keychain-0.1.28-cp312-cp312-macosx_11_0_arm64.whl
Size 584.8 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
42c82546c5e879442945af141208bab0a0056e79657d9e5f4b48a522c9315bb3
BLAKE2b-256 checksum
How to use checksums
03d1bf60756b00faf3112f7a5dea458749f131bf770ddf45b491c91aade03396
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp312-cp312-macosx_10_12_x86_64.whl

Download URL bulk_keychain-0.1.28-cp312-cp312-macosx_10_12_x86_64.whl
Size 653.4 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8049b4bc9ddbf9c1545573e17e7239a3407dd1c919f7c305153b850b811d3941
BLAKE2b-256 checksum
How to use checksums
84265790c88f9251237e4fcb87583f124a306ffd4eeeeff75c7ea98f62fe5cb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL bulk_keychain-0.1.28-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 681.9 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
54f0feb6004d2228553074ddb6ffce3f46e35e795b0c7235ab6016f73d82ed37
BLAKE2b-256 checksum
How to use checksums
c0c32e25a8f65fc2c4ab75e602ad7549bdfeab8533a97e785f4ab60d4f13b2ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL bulk_keychain-0.1.28-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 639.2 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
c706e057971c6d33f36f5862b136b8c4bbb6ff0733adf1daafdb781d4e005c5b
BLAKE2b-256 checksum
How to use checksums
82174f5aaaa3fac9c9bb94b81573efb439aebdf4573774bc9d91621c3f5842a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL bulk_keychain-0.1.28-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 682.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2a1d8e6b4bf51f6500655ed8fed764018c80d35ee5ab2a28ec4ae1b6ed12c7ca
BLAKE2b-256 checksum
How to use checksums
2632dcf24ab6879d1d57fd7278316a3708fa77adbf67f707fccbd2bc142d09b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL bulk_keychain-0.1.28-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 639.6 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
b941cc309a700d08e1d6d64171dfbc2ae680c17371b039536b00e9a28dd34756
BLAKE2b-256 checksum
How to use checksums
da91f6e22ad547d88e1e85108b8041b4ba1bf2e2b38c64441ec9436dcd1dee97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL bulk_keychain-0.1.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 683.4 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1fc58798e3658e75c8dbd3199d5c36010657b757503756fbbe72e4a32dd23fe4
BLAKE2b-256 checksum
How to use checksums
cf05b2642de623cff097adbf575683c3c2003396f405bed48aa2a2b8961fcdd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / bulk_keychain-0.1.28-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL bulk_keychain-0.1.28-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 641.4 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1f89ec8559fd136d9e0408164e94b6c90baad45c2a3509b26b8bf566b8a943a9
BLAKE2b-256 checksum
How to use checksums
ec8e4ce02a77dc3a39d1abdf09e30f872b17436aaa37192546139874ad5350d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page