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.26.tar.gz (64.5 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.26-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.26-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (504.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.26-cp312-cp312-win_amd64.whl (374.7 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (520.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.26-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (502.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.26-cp312-cp312-macosx_11_0_arm64.whl (454.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.26-cp312-cp312-macosx_10_12_x86_64.whl (496.3 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.26-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (506.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.26-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (507.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (524.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.26-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (508.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: bulk_keychain-0.1.26.tar.gz
  • Upload date:
  • Size: 64.5 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.26.tar.gz
Algorithm Hash digest
SHA256 6c3db4155f3e566a8b48e4d74659bdf50083b60f9c59df5c02ec04bc578b60f8
MD5 4e327f4a554c89cd36eb9549d36b46a5
BLAKE2b-256 84494e33b4c830aca38fea622be6f7123aa9cd05eb072ff473ebc0725235b166

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26.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.26-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45d25c81b829a6284f77a723660d21129a24b703811e24c3c3837f4fb3691b70
MD5 6b7e248ec88c93f1876d63ae58ed0c69
BLAKE2b-256 898c7843c6934fe808a82779e8f9b2ae0acac07b1ab772e8a3032b6e3252e6eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a6595ce354462187a5e49d78b1f30c16cf9e43f001c4976f03b98e26cff961e
MD5 2d17813b355365dfb4569c52e9cdadde
BLAKE2b-256 690fe81b104f3654ca7ecea33d9bb344a5f0e35522a80dab2d181eb55428fe6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1f9b2be46041db102bf197b56dd68c0f03a9e313c56030bd097dfe100f379cf6
MD5 4fedb6bfe9df634abb7be90127f2b872
BLAKE2b-256 452dc425206490592990f0104deab1a2d27f5db259c853787d70e690a8fd28be

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 255ec1fda88792d0f47be1786d5800c378c022b180feb81da0876b08f473ebdd
MD5 4afbf63dbbf1d9140f3583b3442df1f7
BLAKE2b-256 38818c67ef9bfbe04ef0404e72f0b14f6702d84781ba7e2f0046d8eca9f369c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7770d737b06c356e67cda2821caf80bfb737b34033e93bb095d29f7349275eb6
MD5 897839eaa0d76d43cdf690260535367d
BLAKE2b-256 f08144128220a1ded06df7e276edd43cb3d7cd4e518a5ef34c961b8b49beb592

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 438be648e51a07813e8fb37f4711acabc759612e3aedf8a3a665d85fb2a2f3ef
MD5 42d36b4bbd9c85a4cfe2726aebaafffa
BLAKE2b-256 7bf9a6548939cfdb83353b86f9eee11f9243d50ddd1d39869318cdc9122479c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 eea590856e5a81baa74c34c2dd2cd65d53d32123ed476acd7f2fdfffc84cfbaf
MD5 11e9a28178e2baad4a132607dfd72ef3
BLAKE2b-256 07b1372c766cae0575675525c408cc557f13f5a042e0b1cfd8b407a727e90692

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c22ea56fec19992d879254a4772a8807818b5af8cd01ae52508db7f300d169c
MD5 11f684cb5bc65d23a171e602e5e25dd6
BLAKE2b-256 16200f97b96379f52133b1776f7c95c7f389beceedcc05b4f45ac30e813d0388

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6925cf893e896bbe22638af2a42fab9f998387eb44dbe5400fdeada5a448f6e6
MD5 69fd83cee58a29948529c020124fa786
BLAKE2b-256 6d58d981cf293b1d3d61d421805bb91f6d2498d27f932168b6e33fd4c01c3919

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9390636c416af0799458b3c542f623a3210ac3ef7d48fb9dc2a893cc3492532
MD5 1dc67e60f94b81a2f3af180f7897158c
BLAKE2b-256 0d2c01399b12f258e93f4c1fdd24977396bf976ee0b0e600c8e0dfb4ee73b64e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e3916b02ed16c6e6d68265cc4e4756b8391631098ef68d1f3c6a5dd8f7493bf8
MD5 0a9f4a483b77560303ffc0cbc1d92459
BLAKE2b-256 b1c7841e7b99531c56d637a035aa44cf4c9789df4da789b6400eeebde59ad2b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f21c3b46e67395b6aae204c1dfc55a48a861975bc24c0667c195cedf187a8219
MD5 0def9c3aa5284561a9056d864772411a
BLAKE2b-256 0344befeddf641142fd19bf1e9195100526f5b9dfc06af03fb3962801600f310

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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.26-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.26-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9d18edc24273c29e2b61bf68b96682393606721f4c6d83eaca8750535ed36f13
MD5 efe69174e00f77d9aa9f6b11852efeaf
BLAKE2b-256 d6ca3e5d85762a14dae2b63eab9965e3beda31bc9db2332249c411c4089885d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.26-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

This release

0.1.26 This release

14 files

0.1.25

14 files

0.1.24

14 files

0.1.23

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