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 current timestamp in milliseconds
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.22.tar.gz (62.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.22-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (521.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.22-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.22-cp312-cp312-win_amd64.whl (372.4 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (519.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.22-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (501.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.22-cp312-cp312-macosx_10_12_x86_64.whl (495.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.22-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (505.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.22-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (505.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.22-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.22-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (506.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: bulk_keychain-0.1.22.tar.gz
  • Upload date:
  • Size: 62.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.22.tar.gz
Algorithm Hash digest
SHA256 4b264e9dc60119261f1fee5bbcf574bed51144ad385e9b0dff2dfdc26386f2ae
MD5 9156f95ec63e838c7c0410218aea18b8
BLAKE2b-256 7fdf944f07bd581f187945357010a2b438d2a9f5ab24e7dbe11de256d2034382

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f08b02015e0d39f754aebc9e91be8eb0daf9b21fe28db2b71009e16ee9b0b3f2
MD5 1c24c602e75eb82528dca5ef9bcb7302
BLAKE2b-256 d270ef1356c02ab7e7e275649eaef77ea64b398366dbbecd6e7578768136cb5c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6ab5c6574d9eba4ddd929977c60d7c76fd6e2d0f83854b391f2342a323fc4e14
MD5 29ee96d9c3930dcb5e56da1a8ef1afde
BLAKE2b-256 2bc9fd869181a1fbb6ff4176b2707dad861d81c87ed9bf2c662913f06df3e625

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b13421e227b277a8221999ccd0668b7e2e978522b6bd3c21bc6a9108435ea5e0
MD5 db7dc885e66b2a122774a385faf995e4
BLAKE2b-256 d149ea2fc3b33463872e8d196fc37d5c06f43a3b982d950cfbccc80319c3697a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 400e87b0e38bfd04fe62a196ac6c689f8e2eac22204942af593473a21dbf51a9
MD5 8cdddce25812d17e8ed623083be89a71
BLAKE2b-256 3ec982a5457da1320418cd7f1f02e7f48ea13a0a666f3ef152af98a9c61f2b92

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6bbda6b129e21ca504240180104ff26823699b3cfe78388ef2d5abe298a6794d
MD5 0506ab10e1b375c4ec573f4c06a985cf
BLAKE2b-256 9367902b56af91931ee6bc2601498ff6f2fe9d1608848e1d507bdfaba2fbe552

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e22f79168d3d52fb23bfa604770bc2a58ae98baba6271473b2b7d8e5760ba743
MD5 7b85c66f6a654160c3b1a6d0aae05809
BLAKE2b-256 f3b18aa15cb142cc9020d99635440ba0e065fa371d245dbf838ec5ac57e89f4e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dd91b897a17e553099104072deb177f031c8bf8f6a61821a626803b662c00908
MD5 b47daadddd84b6076c8ee9761df3ad7e
BLAKE2b-256 c147d8e9be97a18dc74aa266dd835a3df799e74de41b87863ecea5101de90c9c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87848611788f1768e7256b6c691567191e97f5ee53464d4f4d0152251bb5e37d
MD5 a90c273bdd5788207fe18f772cde2294
BLAKE2b-256 b2a6e3f222e35640a2b8d27597bbe92ad9e8d178797ad1c95622a1e1de0756f1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 52db1271cb9c4b000cbd72e108ae8ba444263fdb5ebbf07620a3726bbdeadeff
MD5 d2a0a8c8adbae23a2af15373e9654878
BLAKE2b-256 158b8ec6c8075b03ce79d4fbcb52b0bb708f4319f6ebf3ccc8f95fdf2bb3c12a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43eda8b3acefae235b1b44eb5b319f3285f67ea110cd26cd93006611a0cf6517
MD5 4b8368af79efdf4253178f976323f17e
BLAKE2b-256 0fde2aa9d023c94312fabf529ad75d4297941627738064335060387ad344b6b9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 46a6ae55e5584e200a5659f13b1085efda4480e78db794039386b163f52f7c3a
MD5 5bcae30856ca5f7537ee3ba95e365eee
BLAKE2b-256 1cbff0b8d4efbf0ba368de85e3b1ce497774c63b496d457fe8a3c1f611fe297c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e88d561e0eadfc843de49b4e9f726a5cbb2fa78923cd22460285341aa8d3728
MD5 8bfd16223c6a3875a0fcbff04b3b044d
BLAKE2b-256 f0a03b2f2efea94d2a07f072d6f5aad9aa4fac83e7fa2654ec76056a272aef44

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.22-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2614470722af653b4b356410439e167257d1088ded2c1f38d4bd99d8ff6154bd
MD5 e9d279dc971cb657aaa86168955d970d
BLAKE2b-256 f5761024dfd5304d5b089e0eb4f42bc8be30907bcc057f123c53969118faa35f

See more details on using hashes here.

Provenance

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

0.1.23

14 files

This release

0.1.22 This release

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