Skip to main content

A simple high perf signing lib for BULK txns

Project description

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_order([{
    "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=signed
)

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
}

Batch Signing

For high-frequency trading, sign many transactions in parallel:

# Create batches (each inner list becomes one transaction)
batches = [[order] for order in orders]

# Sign all at once - parallelizes automatically when > 10 batches
signed_txs = signer.sign_orders_batch(batches)

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

# Sign operations
signed = signer.sign_order(orders, 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_list = signer.sign_orders_batch(batches, base_nonce=None)

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")

Project details


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.3.tar.gz (37.6 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.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (437.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (421.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.3-cp312-cp312-win_amd64.whl (294.4 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (437.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (421.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (378.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.3-cp312-cp312-macosx_10_12_x86_64.whl (405.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (437.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (423.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (438.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (423.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (438.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (424.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

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

File hashes

Hashes for bulk_keychain-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d535d0abaf49166ab6231d4115e41a5b91b24e46da863e616b19d322089d095c
MD5 563fb6545e9f0dffe85b35a8880368e6
BLAKE2b-256 dfb4b4770c244d604703d4a086406ee55b92294f580d648314dafc1885db1dd8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b90272435c643703508bcd24df405bb441972868bfa254f78eaa8424dc2301ed
MD5 e25962d21201ebb58983b0c0c8cdaffd
BLAKE2b-256 14303a8b3b695556d2882f8e37e33999e149c85e7a7de285f84db63a060eb0c1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 52ce5728e8c1f4c30652ddd8e4d0b1e5581fc512e7f4ee68dd3e4ebb2e4d4089
MD5 517166845117c991f19aa592b9fecaca
BLAKE2b-256 10480823287338041800359f18b7b443767d0ebd365abb99ada7c21f485b94e3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aeb33324704d97b6c2ff9fad6c6177dd9c860eac90804823fd0cb4f5857a7b72
MD5 40ebd5544a49ad209e39fab3fe129d66
BLAKE2b-256 8557fd5a49bd48988fb65eee89101a6cbbf2e39136d78d2f20e2bd54297ea448

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fea60d2f116df92b4d43cb6af0b0bdb73c6c29074933ac520434cd800f502124
MD5 ae6ab091ad1363c7535bacc31e409a66
BLAKE2b-256 634a55e637ffc3634cddf2abe2d7f4cb4d8faea3b0d5a4fe9d829ccdd71bfc02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8d66eb5b029f74c080313bcc7c2ed2dc0cb6e005c4aa83fd3faaed5449bf5ac2
MD5 eb6414742bb888b96642fc969e78d7f2
BLAKE2b-256 06ee3fa230f8ee7b8377f5ceb75e85eae7a692d6ed11900a3461bfc93a65c50f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 144b291847f55cf655971d1956a3d86fb5174c4e395fb54abaf7e19e6f3c04be
MD5 92f80ebb4983858d101a6d9e92cd7902
BLAKE2b-256 1127ee7b2b1493472fd0c3ce6b1c723d7e703669b7930a47c627593de4e7aae6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a4b0266fc45283bfcb43e131e24368723fb2889319d7ae35a289f3e53f40c3bf
MD5 22304c59654a71bd51fb06594a1cb299
BLAKE2b-256 2c78e8311ba9934987364bfac41e9b67e191eabe872db393b40cca25294229c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd80d436673760c7172082d02052de20fc20f393d6d34af2ca273ab8ae81b31b
MD5 3943736e77a279547dcc98eae746d8ee
BLAKE2b-256 cff68fc0a45cc7af7ed8f13f04779188a8c974b8a86c6b3c04121a8a32139ae0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6ac2f50ca30787ea378f54a23727dd5ef7f0c990f581bb4d01f3a59a51e62398
MD5 01240030e6e23090819f89120a18dbef
BLAKE2b-256 35908c5d023d415887d04cc6bb0eca7ca09fe8ad6f812589a0b55936f2b207c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a951b896d20fa4d38db9047e88555d19669e8ec4cf436da75886d1d056df7a3b
MD5 3ca743d7f0506bfd8d81d4a5e1c6b9a3
BLAKE2b-256 d80954053c3e8b67b1d91faf369e92ed2f97d570d137b9a69dc6d61626397433

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7374585c6a075fe56fabe258af828d2bc45f2a7fca11c97c2866544cc98fb757
MD5 df7cef76f9faed810d035165a7f53abc
BLAKE2b-256 0396f9e2b6bfb389776f91c39eadbc4289765816c7439152c99370bcb033a244

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3eeac8e0fb2bb3ae37a2aa8a532dbd0206afbcb31b891047088a75f0633e43d
MD5 c4972f6dbf5d511c411492e2a5769fe4
BLAKE2b-256 0d0f19f489f816870ea956760c3c15ed8780ad7e1c3634eb2a3371c49a0ea93c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4aa156f2131b6d925c2b7528480607928ebbfff2528047b133ea6417d3f3c9b
MD5 61e5f70f443cb02746f64492b31f24e7
BLAKE2b-256 4afd0eb1b10f0f57220990c4d0c3541b8d9ee4cf897b5c26996d20fb05e61233

See more details on using hashes here.

Provenance

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page