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.25.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.25-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.25-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (504.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.25-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (521.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.25-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (503.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.25-cp312-cp312-macosx_10_12_x86_64.whl (496.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.25-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.25-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (506.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.25-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.25-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.25-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.25-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (508.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: bulk_keychain-0.1.25.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.25.tar.gz
Algorithm Hash digest
SHA256 93e43328e80b73199b48c4830cfcc8f8bad02f282ec454de6396880846e369ba
MD5 2260a7299c8baf230ae5b60f0113f956
BLAKE2b-256 5cc58d707a0e1ee7a212a112c27298d8690728da278fa8eecd9bcf0dab6b31be

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4843be3152f87508ce49c967c5c79d79ea83107c676d626c06eabff53b81899
MD5 3f82b50ccf99578a3b77e8acd1cc042a
BLAKE2b-256 4c6a9ee2afff26813b962ba7c2dd1f2592149bd3320d51e6d0eabbc8a76d562f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c2d309559d37d90f779e0d85442935e9a0990afbaa42429cecdfbe20d053d3c4
MD5 937cb0b054f99bd0ff00b2cdf483abd9
BLAKE2b-256 699b4fd9ca0c138df4a44302843556532e4ba7e2e181548c58da03cb2a629289

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e3f43f447192eafb3935da5040f40bf1e0bedafd0031986f6433cfb1c87211a4
MD5 ee9bba4be66d87c2a9615793bbcb34ea
BLAKE2b-256 b5b2d2192f0d1d7f479806e00d83790d57b695ffbff6ce80cc463ae7b43d00e6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 46d9cd8c20d136b6273e10a875cffa2181d854f4033ead512ae1cd4ae7fc7cbb
MD5 98a5f38f0012dbd8bbc21da7394783cd
BLAKE2b-256 ab907a78bc5f8dc0d3837e90eda3698d4a6b2d34b918efb2df5be50c56e6c8ab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 848ba437a3690b8e1f8b32ec62e871b7c018ea3e6e307aa7c58a935b5310d205
MD5 a2ecfcde3e2b3b2f588a4552e353554b
BLAKE2b-256 4537e98a7181b1db7c907c38f74516b3276e377347f796294b834668dcb5e174

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e4186232e16a81c7ea135bc4692a3fa43274bde63c1f9ede1233e03a9f7e5fdf
MD5 3065407500c44e8b00434fb0bfbb945b
BLAKE2b-256 cb2d7b48dd1121fee01c606db0714938bcd535a131f82605606eca0e2ca1e9d5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 241310412edcc1db7424bef1bb2ff45f8b69da3a91d6ced997e52dea38c0f055
MD5 9b29ad2660f74cd4c407632107fd45aa
BLAKE2b-256 d2770f9462ff316ec6204f76e49fbc5b7c54d5aca3157fd5546d94067326908b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d37f47c705b7dde4b67adfd6ba70e97ac5fcb6b845e9dae6f70a09e8aad63f97
MD5 8945b6d0624bc8d2c5b44f8ece3b8a11
BLAKE2b-256 05e5dc4b3c2c285ffec486210f340b9c6fa3e66ce988895011d654bfc9d03f9d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d781c58395dcf60db1b9f5e82e25f8648bd33ce2c6039295a02a9193cbfdef40
MD5 486d990e9ffd17efb1110383d4ef2458
BLAKE2b-256 c74793717d4b57479e24ef31e849b93601313e94e7e29f6c1d8c76471ae2f64c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 499ed6c2725bc05d2d8d7dea0531e59c05fa7dbb753784295ff2f5a4e63310a9
MD5 08f37b15517fd9d070c99a85726b7944
BLAKE2b-256 4148df1f03354f04cf19dbd2ae0c42664f599be6879c1244c8bc621a0b1a68d6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8b1dd5a8edec299b2c413153d23b181c1737778ab8032db918b888218427db61
MD5 4f4beebc0eb21b420caae8565ee8a531
BLAKE2b-256 9fe8910110202635a94e461dbe6a3ab279323e269f5dfb0b6403bb1ee33db788

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2080efd0ba86dd1377094e93b04d691f43008b6709f16f901270ab3c07d12014
MD5 0ce858ecd48e882d63b737a404a1c294
BLAKE2b-256 9af3f25810a0b0ca17581ef0d6756b5b1033447efa0f34f9a4364c12daefc07b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.25-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 03012043a68b22f94ead748918d842a5de371068530772c92167f4381fb69ce8
MD5 185fc96e49eb8ae6eb43466c24cee2a0
BLAKE2b-256 3e93a9707af49bb79f87f22e24dffdffde49bbdfdde837681a2a393804b26a03

See more details on using hashes here.

Provenance

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

This release

0.1.25 This release

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