# Interact directly with the Txboost RPC endpoint
searchers can interact with the RPC endpoint at one of URLs below.
# Bundle RPC URL
RPC endpoints:
Location | URL |
---|---|
US | https://bsc-rpc-us.txboost.io/ |
EU | https://bsc-rpc-eu.txboost.io/ |
Bundle bid receiver: 0x0000000000007592b04bB3BB8985402cC37Ca224
# API
# eth_sendBundle
This method can be used to send bundle to our builder.
Request payload format:
{ "jsonrpc": "2.0", "id": 1, "method": "eth_sendBundle", "params": [ { txs, // Array[String], A list of signed transactions to execute in an atomic bundle blockNumber, // String, a hex encoded block number for which this bundle is valid on minTimestamp, // (Optional) Number, the minimum timestamp for which this bundle is valid, in seconds since the unix epoch maxTimestamp, // (Optional) Number, the maximum timestamp for which this bundle is valid, in seconds since the unix epoch revertingTxHashes // (Optional) Array[String], A list of tx hashes that are allowed to revert } ] }
copy!
Example request:
{ "jsonrpc": "2.0", "id": 1, "method": "eth_sendBundle", "params": [ { "txs": ["0x...aa", "0x...bb"], "blockNumber": "0xb63dcd", "minTimestamp": 0, "maxTimestamp": 1615920932 } ] }
copy!
Example response:
{ "jsonrpc": "2.0", "id": 1, "result": { "bundleHash": "0x2228f5d8954ce31dc1601a8ba264dbd401bf1428388ce88238932815c5d6f23f" } }
copy!
# eth_sendPrivateRawTransaction / eth_sendRawTransaction
Both method can be used to send a single private transaction to our builder. A private transaction will be included in upcoming blocks and sent to validators directly.
Request payload format:
{ "jsonrpc": "2.0", "id": 1, "method": "eth_sendPrivateRawTransaction", "params": [tx] // String, a single signed transaction ] }
copy!
Example request:
{ "jsonrpc": "2.0", "id": 1, "method": "eth_sendPrivateRawTransaction", "params": ["0x...ff"] }
copy!
Example response:
{ "jsonrpc": "2.0", "id": 1, "result": 200 }
copy!
# bsc_getRegisterValidators
Returns a list of validators that accept MEV blocks from txboost.
Example request:
{ "jsonrpc": "2.0", "id": 1, "method": "bsc_getRegisterValidators", "params": [] }
copy!
Example response:
{ "jsonrpc": "2.0", "id": 1, "result": {"validators": ["0xee226379d...dq1d","0x733fda77...kjijx"]} }
copy!
# Authentication
To authenticate your request, please set the Authorization
HTTP header in the RPC request and include your auth token as Basic {AUTH-TOKEN}
.
Edit the .env first:
PRIV_KEY="private key to sign bundle" AUTHORIZATION="http basic auth"
Please refer to the python example:
import requests import time import os from web3 import Web3 from web3.middleware import geth_poa_middleware from eth_account import Account from dotenv import load_dotenv load_dotenv() url = 'http://localhost:8545' submission_url = 'https://bsc-builder.txboost.org' simulation_url = 'https://bsc-simulation.txboost.org' def attach_flashbots( w3, signature_account, endpoint_uri, ): """ Injects the flashbots module and middleware to w3. """ from web3._utils.module import attach_modules from flashbots import Flashbots from flashbots import construct_flashbots_middleware from flashbots import FlashbotProvider s = requests.Session() s.headers.update({'authorization': os.getenv('AUTHORIZATION')}) flashbots_provider = FlashbotProvider( signature_account, endpoint_uri, session=s) flash_middleware = construct_flashbots_middleware(flashbots_provider) w3.middleware_onion.add(flash_middleware) # attach modules to add the new namespace commands attach_modules(w3, {"flashbots": (Flashbots,)}) def create_w3_for_bundle_simulation(account): w3 = Web3(Web3.HTTPProvider(url)) w3.middleware_onion.inject(geth_poa_middleware, layer=0) attach_flashbots(w3, account, simulation_url) return w3 def create_w3_for_bundle_submission(account): w3 = Web3(Web3.HTTPProvider(url)) w3.middleware_onion.inject(geth_poa_middleware, layer=0) attach_flashbots(w3, account, submission_url) return w3 def main(): private_key = os.getenv('PRIV_KEY') account = Account.from_key(private_key) w3 = create_w3_for_bundle_submission(account) sim_w3 = create_w3_for_bundle_simulation(account) nonce = w3.eth.get_transaction_count(account.address) # Create a transaction tx = { 'to': account.address, 'value': 0, 'gas': 21000, 'gasPrice': w3.toWei('3', 'gwei'), 'nonce': nonce, 'chainId': w3.eth.chainId } # Sign the transaction signed_tx = account.sign_transaction(tx) bundle = [ {"signed_transaction": signed_tx.rawTransaction}, ] # Simulate the bundle target = sim_w3.eth.blockNumber + 1 simulated = sim_w3.flashbots.simulate(bundle, target) print("bundle simulated:") print(simulated) # Send the bundle rsp = w3.flashbots.send_bundle(bundle, target) print("bundle sent") rsp.wait() if __name__ == '__main__': main()
copy!