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)

# 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 commission fees for routed limit and market orders. Python order input uses builder_code; API JSON emits builderCode on orders and abc/rbc approval actions.

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)
signer = Signer.from_base58("secret-key-base58")

# With nonce management 
signer = Signer.with_nonce_manager(keypair, "timestamp")     # Use timestamp
signer = Signer.with_nonce_manager(keypair, "counter")       # Use counter
signer = Signer.with_nonce_manager(keypair, "high_frequency") # Timestamp + counter

# 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.20.tar.gz (60.0 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.20-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (515.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.20-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (496.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.20-cp312-cp312-win_amd64.whl (367.6 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (514.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.20-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (494.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.20-cp312-cp312-macosx_11_0_arm64.whl (449.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.20-cp312-cp312-macosx_10_12_x86_64.whl (489.0 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (516.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.20-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (498.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (516.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.20-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (499.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (517.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.20-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (500.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

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

File hashes

Hashes for bulk_keychain-0.1.20.tar.gz
Algorithm Hash digest
SHA256 2c840e9bf2a8b10f8775e4ba4cea273871322621a612148d9693dc7e56bc9eed
MD5 99d24d5182d1a9733d5ea4fc80fbd0ff
BLAKE2b-256 931ac290c178efaba0a20073ef8ff786d7797585a8101fa256d3cccc2294314e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc929a1175d262e8705f979a565f978f25a05ff35b0e4a0fc64fe05dcf5fe8a9
MD5 ac097d6f1d7557896d9b58028533e326
BLAKE2b-256 a97df07aed73909374f6a8effa0d89b101493a0122e3b9d4112ce1054454d72b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 497aef5c30747c1c70a89d70db6d99061308293eff989e1ec87392b53690c3ad
MD5 647b44a67989546a087c25d942e5a832
BLAKE2b-256 f3599e31db59c1e04b7ac1480211b203bf8f23a6cde66c6af7c173ac38116dcf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 863301c7f69e1906ae6b76c717ac8c160d930f49ea57c93aa75fe19a96b13ce4
MD5 56053cdbfc262734c501ddad73c3fad8
BLAKE2b-256 98d24fbd0f40c95fbb1f946dace9633f6b87732c301fc9e37dc49ef81f11698b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af29c2f1ca40a642fda11de04514f30f7e4666934d41c7e5d1edd998487710e0
MD5 350cd06bc40216288972815b4c4e9899
BLAKE2b-256 b5833d16f6771df08d837e4716d3bd0a0cbe28469dc19fc18ad28d2879ea8fb4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dbf39e44080ffcb6f671a4305bdb53580d304200aa59fbefde7a5ff8423b9e98
MD5 84130c088e76dee5d493826404f51325
BLAKE2b-256 19b1f47f6bc07d7cc611ac9e6490014c1089c82c949e213801a6b7fafa95580f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6e557289a5ee855d103ed8f4cb337727dbd4d43275ae882c6803897d040877a
MD5 1a0e48e2e517c54016173b4c83872ee2
BLAKE2b-256 446065418cc5557022c0296c862d96edc73939d61b70022c82353ee6a77904b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 084fe4033d1ab9215334acc5279513b0ce4d81e7e09cf9dec4e3451cf5db4811
MD5 e8f4dba7c7a5855c9580f944508aa597
BLAKE2b-256 4dc948f67f4204b903a56a602dcf6a7f9a938041ac5379851e8e57165715c098

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5bcbd7494caa257e294db2677d7165b74a8a99b87ef46c856c54ef5e4f0ea72a
MD5 2f83442ab956fdb342b06ef68926d027
BLAKE2b-256 f6df4247666dc401692175d55a727d8158e90f1ae7af138985b9015ec29360f5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 39a34c94473e2a9836364025e0d99b0f3746c9ce1b87842a3c649731cae0625d
MD5 9ec7aaf01b2f584390c123d9c0817f4e
BLAKE2b-256 fec0184ccac1926c0881a432e84c70e62821d8e7cca64c727e7e4dec331cd3a7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94aae1d3e558ef674d152aec393638e70452fe824c1503236e7d1f7dc04e61cb
MD5 2b1d652ca13ecb43489d0d971b4bbd85
BLAKE2b-256 e3190aae038aa24b23be626fa629c2a950495449f29248aaad7ecc2a367016e5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4365c79144b814f885d2a3f70b8c368b70d6254fc28d189adeec59885101dea
MD5 55a3a5aeef019068821ae924b8f38673
BLAKE2b-256 f0c7c26493617a842b719edf05f8e9f5c9020c83e8a78118a1a6a4b58fe361c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 034971b73c835d5f145942ee4f43aadfb819f3085add9b41e9bf4ef7f9cd6c49
MD5 6139b8537453dbfd9084490d3b838138
BLAKE2b-256 2e7b2cf6ff3c4a39944dd7662966c79ec3ca31da8f932f3f3c90a6e612d583f1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.20-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0d8dc88f8fab6326f5b0321657d8bcb567df23a8a7838fc5ff22f793d8197d0d
MD5 7b9ac04f92ad6e0ab1706e9e7128b22a
BLAKE2b-256 1af09d4bd2ad257edd14dd68d006d144cb7d9d4cef40d371f9ddd1cba7ed39b8

See more details on using hashes here.

Provenance

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

0.1.22

14 files

0.1.21

14 files

This release

0.1.20 This release

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