Python Builder Signing SDK

0.0.2 · active · verified Sun Apr 12

The Python Builder Signing SDK facilitates the creation and signing of builder bids and bundles for blockchain applications, specifically in the context of MEV (Maximal Extractable Value) builders. It handles the cryptographic signing processes using `eth-account` and `eip712`. The current version is 0.0.2, and it appears to follow an infrequent release cadence, typical for specialized blockchain tools.

Warnings

Install

Imports

Quickstart

This quickstart initializes the `Builder` SDK with an Ethereum account. It demonstrates how to securely handle private keys using environment variables and provides a basic setup for signing builder bids and bundles. Note that the actual signing calls are commented out as they require valid, context-specific data.

import os
from builder_signing_sdk.builder import Builder
from eth_account import Account

# WARNING: In a real application, retrieve your private key securely, e.g., from environment variables.
# DO NOT hardcode private keys in production code.
# This is a dummy private key for demonstration purposes ONLY.
private_key_env = os.environ.get('BUILDER_PRIVATE_KEY', '0x1111111111111111111111111111111111111111111111111111111111111111')

if private_key_env == '0x1111111111111111111111111111111111111111111111111111111111111111':
    print("WARNING: Using a dummy private key. Set BUILDER_PRIVATE_KEY environment variable for real usage.")

# Initialize an Ethereum account from the private key
account = Account.from_key(private_key_env)

# Define your builder's name
builder_name = os.environ.get('BUILDER_NAME', 'my-test-builder')

# Initialize the Builder SDK
builder = Builder(builder_name, account)

print(f"Initialized Builder SDK for '{builder_name}' with Ethereum address: {account.address}")
print("You can now use 'builder.sign_bid()' or 'builder.sign_bundle()' to sign MEV payloads.")

# Example of how you would call sign_bid (requires valid data, commented out to keep runnable):
# signed_bid_id = builder.sign_bid(
#     gas_limit=21000,
#     gas_price=10**10,
#     base_fee_per_gas=10**10,
#     builder_eth_balance_delta=0,
#     builder_eth_balance_after=0,
#     block_number=12345678,
#     tx_hash="0x" + "0"*64, 
#     tx_eth_value=0,
#     sender_address=account.address,
#     destination_address="0x" + "0"*40,
#     mev_gas_price=0
# )
# print(f"Signed dummy bid ID: {signed_bid_id}")

view raw JSON →