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",
)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bulk_keychain-0.1.23.tar.gz (63.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (520.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (502.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.23-cp312-cp312-win_amd64.whl (372.5 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (519.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (501.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.23-cp312-cp312-macosx_11_0_arm64.whl (453.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.23-cp312-cp312-macosx_10_12_x86_64.whl (495.5 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (521.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (505.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (505.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (507.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

Details for the file bulk_keychain-0.1.23.tar.gz.

File metadata

  • Download URL: bulk_keychain-0.1.23.tar.gz
  • Upload date:
  • Size: 63.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bulk_keychain-0.1.23.tar.gz
Algorithm Hash digest
SHA256 2c63ce9f9d96b88d824d79735cab27b3103ccb2b5c31c77f51f9fde2b281d962
MD5 4a97b8968743d2e02f38422349372b12
BLAKE2b-256 b465aad7eec5bebe209676e0d9d3d53c12173f62dfff3a6a541b9c18880bde23

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23.tar.gz:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ed04b25405f8b9923079a8a9e1e26bdda638b52f04df971b3b35e8852462607
MD5 bcd5bcb976baa4fd00b06ce80a700f5f
BLAKE2b-256 36dc4b2eb91a343f0b511a006afd81574425e14582024532b13d0a14983517f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 97f8d0eb3f85f84962395de09d7667b9045ed539616ae15d906e829291287856
MD5 d63559c6a22c59c1b4fad44c60ffcc87
BLAKE2b-256 edfe30fb3b17e328358c2753b8fda82840e132105e60172951e2ad2767753c09

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4ce864e7775f3a20165cb1ee1373ef0c2b24b2608acbd45b54ff6e37e151a173
MD5 5774570e160510e4de924bfc0a8b7f7e
BLAKE2b-256 5419374f25830c8831cbaa09481980d4a198a26076d5420e87f4b94ff9ecbadf

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp312-cp312-win_amd64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f128d98732c3fa26ac7ed70222ec2bd237d94d29853c4880fa97c04a5304e358
MD5 96060be0e5e82fa4ead505ccdf66f6e5
BLAKE2b-256 2294d1ad85b12c33f73e6c3d8be47f841addc393574652f0ab0c1e77d6cedd56

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c3b7d354f5cda40180f92c0f472ed9b789571d1dc6828675bb07960dd17fdac
MD5 bd7a6d1da4b337f0ecde0bc65218e8c9
BLAKE2b-256 968215896ab60c736325961c63326b94c029cb50ffb671f18e4593d28b702d9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f63ad351173bcb22b537576fbf4b719b9bded86e1f55588ded4badcda47d4bed
MD5 c0380bfcab271f5ac2d5f36ff4833ae7
BLAKE2b-256 6b9b27737d3d42c37883d3e92f8957adcaadfdcc1c23a29867d8f3d106ebd0be

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e9ef90b86aa0be96746f838c14f8860b319a776be62712485238cac6b325d62d
MD5 1be57d58f3c57b65d702f9dfcc61b8d5
BLAKE2b-256 e8c05ca1b3a1a80a8aabbb11bbd15b8448819009caf87c4c515da0ad33134a76

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0be4d5e3c3f98ae2a965cf68ae7fe8fc21576c1d6b40270ad90f7e4125c29e0
MD5 792fc37abef216f3c787891a916e560b
BLAKE2b-256 6651dff0de0eb9a26294ddb9d1aa4cb878a2bbf243c444768c60d6ce7e29a0b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a6782bf7db306fdd24f1bfb1ccfeb1788c20895dd389edf5e6e76f209e858ce
MD5 db4f32173f257b1c8c6e6b87cca4ed3f
BLAKE2b-256 7275492802d4e59c8a2945a1c836b6d1c6694c2e258803946060885aeae2a2eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 851d17eee2a1b6216eb9362b3b96265cb55e0509c3e25a0476b487cec9450cf1
MD5 94d2d3f00f19a4e6605b5b892abc6b33
BLAKE2b-256 e4ee91e91954eaf90a8b64604f6956070ec645b7aef32ef8477d5af53f2845ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e2c8804068bbb896b71c8071293a04ee6bbcca0acce0f639f4ce59632ba2e19b
MD5 d10b7b48458e4145a3f3c77f2cd3f099
BLAKE2b-256 1f72199d0c9cbd5fc15f09f80b5793c42b028af61bd14a8103692aaebcd18f1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a170fdb8fd401c377443bd6f76e205c02214a4fc2d49a348728b9d99baecfd64
MD5 106912694a6004e612b5bd4b7bd1c3c4
BLAKE2b-256 8ce96bb88f573d6ae15371b6e88620cc9fa0b029239ac8b8b5f46f91b37f93e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 64e17a7dec9b3c1e8985021bb798c4c1d3782c5efb2f676d7703e805155a9299
MD5 4efd3cc034e0c3771d31b334010bd8f4
BLAKE2b-256 cc221475a3e50787c710e3a6f69276636776e6f50f2ad0d1947f22bbc2b4d119

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.23-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.26

14 files

0.1.25

14 files

0.1.24

14 files

This release

0.1.23 This release

14 files

0.1.22

14 files

0.1.21

14 files

0.1.20

14 files

0.1.19

14 files

0.1.18

14 files

0.1.17

14 files

0.1.16

14 files

0.1.15

14 files

0.1.14

14 files

0.1.13

14 files

0.1.12

14 files

0.1.11

14 files

0.1.10

14 files

0.1.9

14 files

0.1.8

14 files

0.1.7

14 files

0.1.6

14 files

0.1.5

14 files

0.1.4

14 files

0.1.3

14 files

0.1.2

14 files

0.1.0

14 files

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