bloXroute Documentation
WebsiteBlogTwitterDiscord
  • Welcome to bloXroute
  • Introduction
    • Why Use bloXroute?
    • Products
    • Create An Account
    • Technical Support
  • SOLANA
    • Trader API
      • Introduction
        • Regions
        • Authorization
        • Rate Limits
        • Tip and Tipping Addresses
      • Quick Start
        • Transaction Submission
        • Front-Running Protection & Transaction Bundle
        • Go SDK
        • Python SDK
        • Typescript SDK
        • Rust SDK
      • API Endpoints
        • Core Endpoints
          • submit
          • submit-paladin
          • submit-batch
          • balance
          • rate-limit
          • transaction
          • priority-fee
          • GetPriorityFeeStream
          • GetBundleTipStream
          • submit-snipe
        • Pump.fun
          • quotes
          • swap
          • swap-sol
          • GetPumpFunNewTokensStream
          • GetPumpFunSwapsStream
          • GetPumpFunAMMSwapsStream
        • Raydium
          • quotes
          • pools
          • pool-reserves
          • swap
          • cpmm-swap
          • clmm-swap
          • route-swap
          • GetPoolReservesStream
          • GetSwapsStream
          • GetNewRaydiumPoolsStream
          • GetNewRaydiumPoolsByTransactionStream
        • Jupiter
          • quotes
          • swap
          • swap-instructions
          • route-swap
        • Openbook
          • markets
          • orderbooks/{market}
          • depth/{market}
          • tickers/{market}
          • open-orders/{market}
          • unsettled/{market}
          • place
          • replace
          • cancel
          • settle
          • GetOrderbooksStream
          • GetTickersStream
      • Best Performance for Landing Transactions
      • Support
        • API Health
        • Contact us
        • Suggestions
        • Wiki
          • Terms & Concepts
          • Resources
    • Optimized Feed Relay (OFR)
      • Transaction Streamer
      • Gateway and OFR Requirements
      • Gateway and OFR Setup
      • Gateway Startup Arguments
      • OFR performance
      • Logging
      • Submitting Transaction
      • Upgrading Gateway
      • Troubleshooting
  • BSC & ETH
    • EVM Blockchain Distribution Network (BDN)
      • How to Connect
      • The bloXroute Gateway
        • Local Gateway
          • Installation and Startup
            • Authentication & Certificates
            • Requirements
            • Supported Clients
            • GitHub repository option
            • Docker container option
            • Startup Script
            • Startup Arguments
          • General Connectivity Troubleshooting
          • Logging
          • Upgrading your Gateway
        • Add Your Gateway as a Trusted Peer to Your Execution Layer Client
        • Connecting Your Gateway with the Consensus Layer
      • IPs & Relays
        • Relays IPs
        • Private Relays
        • Cloud-API IPs
          • ⏩Reducing Latencies using the BDN
    • APIs
      • Authorization
      • Check Transaction Quota
      • Submit a Transaction
        • Raw Transaction Construction
        • Tx-Validation
        • Batch Transaction
      • Private Transactions
        • ETH Private Transactions
        • BSC Private Transactions
      • Transaction Bundles
        • Bundle Simulation
        • Bundle Validation
        • Bundle Submission
          • BSC Bundle Submission
            • List of BSC Validators
          • ETH Bundle Submission
          • Bundle Submission with Gateway
        • Bundle Tracking
          • BSC Bundle-Trace
          • ETH Bundle-Trace
          • ETH Bundle Inclusion Status
        • Bundle Refunds
          • Priority Fee Refund
          • Bundle Refund
          • Latest Bundle Refunds
      • Backrun Arbitrage
        • BackRunMe: Bundle Submission
          • BSC submit arbOnly
          • ETH submit arbOnly
            • blxr_info
            • ETH arbOnly Simulation
      • Token Launch Sniping
      • Other Utilities
        • List of bloXroute Builders
        • List of External Builders
        • Tx-Trace
        • Ping
    • Streams
      • Requirements
      • Subscription limits
      • Working With Streams
        • Creating a Subscription
          • Websocket
          • gRPC
        • Handling the Notification
          • Websocket
          • gRPC
        • Cancelling a Subscription
          • Websocket
          • gRPC
        • Local Node Validation
      • newTxs and pendingTxs
        • Filters
        • Raw TX Reconstruction
      • BackRunMe: arbOnlyMEV
        • ETH arbOnlyMEV
        • BSC arbOnlyMEV
      • transactionStatus
      • txReceipts
      • newBlocks
      • bdnBlocks
      • ethOnBlock
      • MEVBlockValue
      • MEVNextProposerInfo
    • Block Builders and Validators
      • Validator Gateway
      • MEV Relay (For Validators)
      • Block Submission
      • Proposer MEV-Protect
      • Compliance Lists
      • Preconfirmations
    • Protect RPCs
      • ETH Protect RPC
      • ETH Gas Protect RPC
      • BSC Protect RPC
      • SOL Protect RPC
  • Base Network
    • Submit Transactions
    • Streams
      • GetBdnBlockStream
  • TON NETWORK
    • TON Trader API
      • Quick Start
      • Fee Schedule
      • Connection
      • Submit Signed Transaction
  • Resources
    • BDN Explorer
    • Block Explorer
    • Guides
      • Algorithmic Trading
      • Setting Up a Local Gateway
      • Gateway as Web3 Bridge
    • Architecture
      • BDN Architecture
        • Network Components
        • Performance Techniques
          • Block Compression
          • Cut-through Routing
          • Optimized Topology
      • bloXroute Protocol
        • Versioning
        • Message Structure
        • Message Types
    • Contact Us
Powered by GitBook
On this page
  • REQUEST
  • RESPONSE
  • Example - gRPC
  • NOTES
  1. BSC & ETH
  2. APIs

Submit a Transaction

Use this endpoint to send a single transaction faster than the p2p network using the BDN.

PreviousCheck Transaction QuotaNextRaw Transaction Construction

Last updated 2 months ago

REQUEST

Method: blxr_tx

Parameters

Parameter
Description
Instructions & Notes

transaction

Raw transactions bytes without 0x prefix.

blockchain_network

Blockchain network name.

Optional. Default: Mainnet

Available options are: Mainnet for ETH Mainnet, BSC-Mainnet for BSC Mainnet

*Use with Cloud-API when working with BSC.

node_validation

Transaction is sent to the blockchain node for validation, and the Gateway returns any error message received in response.

Available only with Gateway API

Optional

Default: False

Cloud-API

  • The WebSocket endpoint for sending transactions is wss://api.blxrbdn.com/ws . All users sending transactions via a WebSocket connection should use this endpoint.

  • See to work directly with IP ( wss://<IP>/ws)

  • The HTTPS POST endpoint is https://api.blxrbdn.com .

Sending transactions via WebSocket instead of HTTPS can lead to a latency improvement of up to 10ms.

Examples

# ETH Example
wscat -c wss://api.blxrbdn.com/ws --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params":
   {"transaction": "f86b0184...e0b58219"}}
< ......

# BSC Example
wscat -c wss://api.blxrbdn.com/ws --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": 
  {"transaction": "f86b0184...e0b58219",
   "blockchain_network": "BSC-Mainnet"}}
< ....
const WebSocket = require('ws');

const ws = new WebSocket(
  "wss://api.blxrbdn.com/ws", 
  {
    headers: { 
      "Authorization" : <YOUR-AUTHORIZATION-HEADER>  
    },
    rejectUnauthorized: false,
  }
);

function proceed() {
    // ETH Example
    ws.send(`{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219"}}`);
    // BSC Example
    // ws.send(`{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219", "blockchain_network": "BSC-Mainnet"}}`);
    //
    // or use a variable for the transaction string:
    // rawTx = "f86b0184...e0b58219";
    // ws.send(`{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "${rawTx}"}}`);
}


function handle(response) {
    console.log(response.toString()); // or process it generally
}

ws.on('open', proceed);
ws.on('message', handle);
# Python 3.7 or higher required due to the use of asyncio.run()
import asyncio, json, ssl
from websocket import create_connection

async def main():
    try:
        ws = create_connection('wss://api.blxrbdn.com/ws',
                               header=["Authorization:{}".format("YOUR_AUTHORIZATION_HEADER")],
                               sslopt={"cert_reqs": ssl.CERT_NONE})
        # ETH Example
        request = json.dumps({"id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219"}})
        
        # BSC Example
        request = json.dumps({"id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219", "blockchain_network": "BSC-Mainnet"}})
        
        ws.send(str(request))
        while True:
            response = json.loads(ws.recv())
            print(response) # or process it generally
    except Exception as e:
        print(f'Connection failed, Reason: {e}')


if __name__ == '__main__':
    asyncio.run(main()
package main

import (
	"crypto/tls"
	"fmt"
	"github.com/gorilla/websocket"
	"net/http"
)

func main() {
	tlsConfig := &tls.Config{
		InsecureSkipVerify: true,
	}
	dialer := websocket.DefaultDialer
	dialer.TLSClientConfig = tlsConfig
	wsSubscriber, _, err := dialer.Dial("wss://api.blxrbdn.com/ws", http.Header{"Authorization": []string{<YOUR-AUTHORIZATION-HEADER>}})

	if err != nil {
		fmt.Println(err)
		return
	}

        // ETH Example
	request := `{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219"}}`
        // BSC Example
        // request := `{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219", "blockchain_network": "BSC-Mainnet"}}`
	err = wsSubscriber.WriteMessage(websocket.TextMessage, []byte(request))
	if err != nil {
		fmt.Println(err)
		return
	}

	_, response, err := wsSubscriber.ReadMessage()
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(string(response)) // or process it generally
}
# ETH Example
curl https://api.blxrbdn.com \
    -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: <YOUR-AUTHORIZATION-HEADER>" \
    -d '{"method": "blxr_tx", "id": "1", "params": {"transaction": "f86b0184...e0b58219"}}'

# BSC Example
curl https://api.blxrbdn.com \
    -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: <YOUR-AUTHORIZATION-HEADER>" \
    -d '{"method": "blxr_tx", "id": "1", "params": {"transaction": "f86b0184...e0b58219", 
         "blockchain_network": "BSC-Mainnet"}}'

Gateway-API:

  • Gateway WebSocket endpoint: ws://127.0.0.1:28333/ws

  • We assume the WebSocket port 28333.

Examples

# ETH Example
wscat -c ws://127.0.0.1:28333/ws --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params":
   {"transaction": "f86b0184...e0b58219"}}
< ......

# BSC Example
wscat -c ws://127.0.0.1:28333/ws --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": 
  {"transaction": "f86b0184...e0b58219",
   "blockchain_network": "BSC-Mainnet"}}
< ......
const WebSocket = require('ws');

const ws = new WebSocket(
  "ws://127.0.0.1:28333/ws", 
  {
    headers: { 
      "Authorization" : <YOUR-AUTHORIZATION-HEADER>
    },
    rejectUnauthorized: false,
  }
);

function proceed() {
    // ETH Example
    ws.send(`{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219"}}`);
    // BSC Example
    // ws.send(`{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219", "blockchain_network": "BSC-Mainnet"}}`);
    //
    // or use a variable for the transaction string:
    // rawTx = "f86b0184...e0b58219";
    // ws.send(`{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "${rawTx}"}}`);
}


function handle(response) {
    console.log(response.toString()); // or process it generally
}

ws.on('open', proceed);
ws.on('message', handle);
# Python 3.7 or higher required due to the use of asyncio.run()
import asyncio, json, ssl
from websocket import create_connection

async def main():
    try:
        ws = create_connection('ws://127.0.0.1:28333/ws',
                               header=["Authorization:{}".format("YOUR_AUTHORIZATION_HEADER")],
                               sslopt={"cert_reqs": ssl.CERT_NONE})
        # ETH Example
        request = json.dumps({"id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219"}})
        
        # BSC Example
        request = json.dumps({"id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219", "blockchain_network": "BSC-Mainnet"}})
        
        ws.send(str(request))
        while True:
            response = json.loads(ws.recv())
            print(response) # or process it generally
    except Exception as e:
        print(f'Connection failed, Reason: {e}')
package main

import (
	"crypto/tls"
	"fmt"
	"github.com/gorilla/websocket"
	"net/http"
)

func main() {
	tlsConfig := &tls.Config{
		InsecureSkipVerify: true,
	}
	dialer := websocket.DefaultDialer
	dialer.TLSClientConfig = tlsConfig
	wsSubscriber, _, err := dialer.Dial("ws://127.0.0.1:28333/ws", http.Header{"Authorization": []string{<YOUR-AUTHORIZATION-HEADER>}})

	if err != nil {
		fmt.Println(err)
		return
	}

  // ETH Example
	request := `{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219"}}`
  // BSC Example
  // request := `{"jsonrpc": "2.0", "id": 1, "method": "blxr_tx", "params": {"transaction": "f86b0184...e0b58219", "blockchain_network": "BSC-Mainnet"}}`
	err = wsSubscriber.WriteMessage(websocket.TextMessage, []byte(request))
	if err != nil {
		fmt.Println(err)
		return
	}

	_, response, err := wsSubscriber.ReadMessage()
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(string(response)) // or process it generally
}

RESPONSE

Result Fields

Result Field
Description

tx_hash

Transaction hash

Examples

{
    "jsonrpc": "2.0", 
    "id": "1", 
    "result": {
        "tx_hash": "ffd59870844e5...bfa54a69"
    }
}    

Example - gRPC

package main

import (
	"context"
	"fmt"
	"time"
	
	pb "github.com/bloXroute-Labs/bxgateway-private-go/bxgateway/v2/protobuf"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
)

func main() {
	// gRPC server default values
	gatewayHostIP := "127.0.0.1"
	gatewayGRPCPort := 5001
	
	// this will use localhost CA to verify the certificate
	creds := credentials.NewClientTLSFromCert(nil, "")

	// Open gRPC connection to Gateway.
	conn, _ := grpc.Dial(
		fmt.Sprintf("%v:%v", gatewayHostIP, gatewayGRPCPort), 
		grpc.WithTransportCredentials(creds),
	)

	// Use the Gateway client connection interface. 
	client := pb.NewGatewayClient(conn)
	
	// create context and defer cancel of context
	callContext, cancel := context.WithTimeout(context.Background(), 24*time.Hour)
	defer cancel()
	
	// send tx
	reply, err := client.BlxrTx(callContext, &pb.BlxrTxRequest{AuthHeader: "<YOUR-AUTHORIZATION-HEADER>", Transaction: "f86b0184...e0b58219"})
	if err != nil {
		print(err)
		return
	}
	
	txHash := reply.TxHash
	print(txHash) // or process it generally
}

NOTES

All Users

The bloXroute best practice is for users to send transactions to both the Gateway-API and to their blockchain node. You should send transactions in parallel to the Gateway and to your blockchain node as a backup.

Users should not send transactions to the transactions streams WebSocket endpoint wss://<REGION>.<NETWORK>.blxrbdn.com/ws(e.g.wss://virginia.eth.blxrbdn.com/ws) which is for streaming only and doesn't support sending transactions.

Mandatory. Learn more about constructing the transaction .

Please check to reconstruct the header.

Sending Transactions to the Cloud-API or Gateway-API requires you to register an account on the . During the registration process, a certificate, private key, and secret hash will be generated for your account. The certificate and key will be used to authenticate your account.

Cloud-API IPs
Authorization Headers examples
bloXroute portal
here