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.29

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.29
File Size Uploaded
bulk_keychain-0.1.29.tar.gz 91.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for bulk-keychain 0.1.29
File
bulk_keychain-0.1.29-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.29-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.29-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
bulk_keychain-0.1.29-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.29-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.29-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
bulk_keychain-0.1.29-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
bulk_keychain-0.1.29-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.29-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.29-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.29-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.29-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.29-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.29.tar.gz

Download URL bulk_keychain-0.1.29.tar.gz
Size 91.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4d61bb448de0ab1dc5cabad0902297749630d34c1027b8fdfc4a3edf95d3f0cf
BLAKE2b-256 checksum
How to use checksums
8c1f1e7b34e41a627bd2177049ec8eb907e967f454d1763477eb8e6b1478b20a
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 683.0 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7771a71ead8c03daf080fa98b63b30ce3cb858e716128091fab082edf2663e96
BLAKE2b-256 checksum
How to use checksums
a58d485c9e43434c973a0bdde66b4a05b61897f7eca2c0d9cc4d38cc6158a665
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 638.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
51f57ae4d046ca20d874380d4addf9c32685175779b6e711fddb053f3901a988
BLAKE2b-256 checksum
How to use checksums
c73e8a55b5390830c078db35f32a6a09d6316b061c7dca70efbaed24e6e71261
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp312-cp312-win_amd64.whl
Size 528.1 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
a00866dbbd766d503130382c4a66571cf3b4f11c1b4d3e5ba5098c40514b3fd8
BLAKE2b-256 checksum
How to use checksums
b347c0b9514bd93a5b41bd8531b257c1db3b44e196c432d1a430fa7f9778438b
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 681.7 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d6223bf3bdd120e781ca44c8e204afa50c1f4c8cdcadc15a079b17f61823b525
BLAKE2b-256 checksum
How to use checksums
0ca967366a414a33dbdb7f0e786e71ebecfda77d51d84c3d5ee63b3852f37d90
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 637.1 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1bd66438fd310b50a52fe69ffb2601c38289cfda82c8ecc1c321bf4e413f7633
BLAKE2b-256 checksum
How to use checksums
fcc04491bb89b5e2910e7c39ab88516167b0995acb0a518cc2c26f05feee7d18
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp312-cp312-macosx_11_0_arm64.whl
Size 587.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
438f4eadb060e67fd97a8403320e4e756a03483fda5146999373344d01bec41a
BLAKE2b-256 checksum
How to use checksums
3c48f9e8d0ab6de6d8e8b2608e2437b0106b3bf48e07d4cad04bebdde3205c30
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp312-cp312-macosx_10_12_x86_64.whl
Size 655.7 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0512313ead1d7238e9a7f7ca7ae0b259b32efc1aff8bcbb65453248a9f7c0430
BLAKE2b-256 checksum
How to use checksums
ab814b1191712d0ce5d1d89dcd0376e75f2f0e77c0873651bd28f983b9cfd1fc
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 684.4 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7b88c3e29e6c51cf4e7582a815cd577ae0c6aedcf483ab4ea6f5c21b2910b21e
BLAKE2b-256 checksum
How to use checksums
358523b0fa2659b6afaa36dc1d6dc6280b14cdb42ca7d8eba4e1c7ac2e6f3a24
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 642.2 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
17386002bdbf68aedbf99cbd6b4ed8ea8fe6380eefa218573fb2c4b481d4ebb6
BLAKE2b-256 checksum
How to use checksums
c192c62742e3bda95d605a16a54bed15f39f6ddcda8a143dfa7ba8596bf2e6f8
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 684.8 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
046f88ec959b6a4f9d9ffdec8246c28c44e3844e6d2e470617ad8e30d5e7db0b
BLAKE2b-256 checksum
How to use checksums
e5a99b422ced3632cb473bd87821bc6137beae66bb0f530d29c6c8fe1144d64b
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 642.4 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
2edd37e49dc228e463cf636583dbc87374abc70df57fa41e032403f49c954eac
BLAKE2b-256 checksum
How to use checksums
2d292657f7b76d3f278fea50dd1abf72447cb235da475ac3cd76919b4b0fc156
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 685.7 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e45a126d4acf408d1f05895f140b7dfb39aab421e4468a2bbc42d91550cef474
BLAKE2b-256 checksum
How to use checksums
809a2e70e7f3db044c66964999647de31951cd2694e392e113d61fa452688380
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 25, 2026.

Transparency log

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

Download URL bulk_keychain-0.1.29-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 643.9 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ec4d5c8260d9f45e6bdf8ed699a7d10e1d75d90a900d364ee625bcb3565d7c1d
BLAKE2b-256 checksum
How to use checksums
6348c2687fd0b6ba09213bc4b2e08c112b592bf17d17e60859b15db042930371
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 25, 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