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({
    "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
}

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

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.5.tar.gz (38.9 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.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (458.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (442.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.5-cp312-cp312-win_amd64.whl (315.3 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (458.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (442.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (399.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.5-cp312-cp312-macosx_10_12_x86_64.whl (426.5 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (459.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (445.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (459.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (445.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (460.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (446.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: bulk_keychain-0.1.5.tar.gz
  • Upload date:
  • Size: 38.9 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.5.tar.gz
Algorithm Hash digest
SHA256 2da9570134fea34c3642c18f7dfb0e14358d8de0be70a3d0a6ddafd88b6066a7
MD5 6f7f6890c9aed9c048e2dd5754b0e440
BLAKE2b-256 d9f1e873973b4ba7d95868128b87977f4a3dd856ed89857342eec28bd42f8029

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a5d189a5c06236236698810c2c0087dccc081522a4ce692c1e621e702af88d1
MD5 873a367f52d3ce32984d7e15fd34932f
BLAKE2b-256 9a94b906453fa940269e3e62759044cdde9d4582130a11d6a1e1f49ab09e82ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 71493fb2371bdfb1d69a0a825247958a855773798a3d5663411fdb81e8cca635
MD5 425bc0bfb7737a358da3b3f0cd6ff67a
BLAKE2b-256 8353b8b179e15b6821dc71b65a4292655c7acd64c87ed20c0c7a82093465ed1d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0696a3568b6c37fb10fa720c47ad06c2d4cc1c61b7be6f8fe207923e8a29941a
MD5 2815d3a044c027e749609fe12ec6da02
BLAKE2b-256 10b372917ae9e35509837bdb5dc31db040a5b7ee72a509dd8fee32c8a22c6a47

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a52802f202e6e2e62db6c9dcf2f4979308a65738f80ebda91b4c30692f0458f0
MD5 e9064544ddec543c280e1a9f3e582324
BLAKE2b-256 0ed364cb61138ab2ca1696cb17a9fbcf6ea550d5316e94d67475501390645f48

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9e8123969c3c9f99cf9c89a5a879377f5a1c5297dedd5971d29cb753f9ab8fc8
MD5 8fb9b69fa99b47f0eec7385740b68641
BLAKE2b-256 1542a78308da6814a7d6e445c8b180a26975eabc02a8d6af854b107e9dfa7079

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b68f29a3966fc7faa1ce3c1db0abbc3ee4fc637fc70c788c59212a63f5b1052
MD5 53cb5fb78d5ecbf32ce10640babf5b15
BLAKE2b-256 ffdf40778b905f26d387857bd902fd0d8937af13291780b7ac3a3c11a7554cdd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d7c9546963c00174c79c43796137458ca3269a041322ba2663345612e1414501
MD5 cd5060cbf21596ec8e8c95c06014da35
BLAKE2b-256 47e10996128d8064c28f3247e62a63c933fe2144aa8c3f99e63d900f4b54794c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 67e60b26b920b3d3d0550c803e0b876608aabbcaf1c75e89ef8fbf022f1e9446
MD5 4d54df96b9f18115017849c56a617785
BLAKE2b-256 7aff849d28569316b840927fe5b5330e34ccd0951c5cb0ecb65538f21c672200

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 692f69d7424eac8038284b853bbe0a886667ecea8b6149d423f86ff00585b3bf
MD5 8cc854e155749b7d611b533e8e412bff
BLAKE2b-256 ab733c776c0ac0c782bb5f53a303495bbbafca2e8b2a637d84b3d4cb36fd81ce

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dee2519eee76704897464e33b7d85b90b8bb311afea78ed117932aca156acae6
MD5 6052f8e5c87cc4471813410c30c962fb
BLAKE2b-256 1e4603e4fe4cba79b1b64cf6ee9dbda83ceec8ef8c831fc08f74b9d8bcdbc6f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab28a7d9dd0ad0c09b4902cb40318d9bad82c7b6e20c9fac7bcd7fcac6ffc121
MD5 6f5cf2e72e696ff85f22e099cf5b247d
BLAKE2b-256 e892a320d3b67096e4e37415a48001fa51838c2414040c44ff1e9b6150693139

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f964fca30cf007314ffea10336e63591a4f62f21fe88a4baf244b983d8a0d839
MD5 cb9814744801277ea0c0c4a8462545c6
BLAKE2b-256 69231a9c185a60833e4b6bc330a5ee247788cd242e0c1e2a133a4822aee06a02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a8c0d1838300f48897b295dd7b8f63a93e47411ac85d246544427160ca58499a
MD5 06911a8ccfcf90bc55e63eac2bca0cad
BLAKE2b-256 23cedbda09084f456002c92c7844f2e959bebd757d1ab939971bbf0f15c3d954

See more details on using hashes here.

Provenance

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