For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Submit Transactions to Public Mempool

Learn how to submit transactions to the BNB Chain public mempool through GetBlock's BDN fast path.

This process involves submitting transactions to the BNB Chain public mempool via GetBlock's BDN fast path. Your transaction propagates to validators significantly faster than through standard P2P gossip, increasing the probability of earlier block inclusion.

When to Use Public Mempool

Use public mempool submission when:

  • You want faster propagation without hiding your transaction

  • MEV exposure is acceptable for your use case

  • You're competing on speed rather than privacy

  • You need broad validator visibility quickly

For MEV-sensitive transactions, see Private Transactions instead.

Sample Request

wss://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>
blxr_tx
Parameter
Type
Required
Description

nonce

int

Yes

Transaction count for your address

to

string

Yes

Recipient address

value

BigInt

Yes

Amount in wei

gasPrice

BigInt

Yes

Gas price (minimum 3 gwei)

gasLimit

int

Yes

Gas limit for execution

data

string

No

Calldata for contract calls

chainId

int

Yes

56 for BSC Mainnet

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "blxr_tx",
  "params": ["0x<signed_transaction_hex>"]
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x<transaction_hash>"
}

How to Submit a Transaction to Public Mempool

1

Set up the project

mkdir transaction-public-mempool
cd transaction-public-mempool
npm init -y
npm install ws ethers dotenv
mkdir transaction-public-mempool
cd transaction-public-mempool
yarn init -y
yarn ws ethers dotenv
2

Create a new file named index.js. This is where you will make your first call.

3

Set the ES module "type": "module" in your package.json.

4

Create .env file and add the following:

ACCESS_TOKEN=your-accelerated-node-endpoint
RPC_URL=your-normal-bsc-node-endppoint //e.g https
PRIVATE_KEY=your-wallet-private-key
TO_ADDRESS=the-receiver-address
5

Add the following code to index.js:

6
import WebSocket from "ws";
import { ethers } from "ethers";
import "dotenv/config";
7

Create and Sign Your Transaction

const PRIVATE_KEY = process.env.PRIVATE_KEY;
const RPC_URL = process.env.RPC_URL;
const provider = new ethers.JsonRpcProvider(RPC_URL);
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);

// Get current nonce
const nonce = await provider.getTransactionCount(wallet.address);
// Build transaction
const tx = {
  nonce: nonce,
  to: process.env.TO_ADDRESS,
  value: ethers.parseEther("0.001"),
  gasPrice: ethers.parseUnits("3", "gwei"), // Minimum 3 gwei for BSC
  gasLimit: 21000,
  chainId: 56, // BSC Mainnet
};
// Sign transaction
const signedTx = await wallet.signTransaction(tx); 
const signedTxNoPrefix = signedTx.startsWith("0x")
  ? signedTx.slice(2)
  : signedTx;
8

Submit via WebSocket

const ws = new WebSocket(process.env.ACCESS_TOKEN);
ws.on("open", () => {
  ws.send(
    JSON.stringify({
      jsonrpc: "2.0",
      id: 1,
      method: "blxr_tx",
      params: {"transaction": signedTxNoPrefix},
    }),
  );
});
ws.on("message", (data) => {
  const response = JSON.parse(data);
  if (response.result?.txHash) {
  const hash = response.result.txHash;
  console.log("TX Hash:", hash);
  console.log(`https://bscscan.com/tx/${hash}`);
} else if (response.error) {
    console.error("❌ Error:", response.error.message);
  }
  ws.close();
});
9

Response

01f86c380384b2d05e0082520894d26ea0f03100358b2ebd4c9638f042aada9a1bcf87038d7ea4c6800080c001a04647f98754480337ae409bcc225f2d62b706b47f31385221421cea20e41080b0a03ae32f07bb7110c4153c2ab121c152db7d3030d54cc0c5341f0b75b20e3d439d
TX Hash: 00d4fe2db5c667ce549318cf621913af1bcb130022ec51020cbb6cae2b7eedce
https://bscscan.com/tx/00d4fe2db5c667ce549318cf621913af1bcb130022ec51020cbb6cae2b7eedce
Complete Example: BNB Transfer
import WebSocket from "ws";
import { ethers } from "ethers";
import "dotenv/config";

const PRIVATE_KEY = process.env.PRIVATE_KEY;
const RPC_URL = process.env.RPC_URL;
const provider = new ethers.JsonRpcProvider(RPC_URL);
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);


// Get current nonce
const nonce = await provider.getTransactionCount(wallet.address);

// Build transaction
const tx = {
  nonce: nonce,
  to: "0xd26ea0f03100358b2Ebd4c9638f042aAda9a1BcF",
  value: ethers.parseEther("0.001"),
  gasPrice: ethers.parseUnits("3", "gwei"), // Minimum 3 gwei for BSC
  gasLimit: 21000,
  chainId: 56, // BSC Mainnet
};

// Sign transaction
const signedTx = await wallet.signTransaction(tx); // e.g. "0xabcdef..."
const signedTxNoPrefix = signedTx.startsWith("0x")
  ? signedTx.slice(2)
  : signedTx;

console.log(signedTxNoPrefix);

const ws = new WebSocket(process.env.ACCESS_TOKEN);
ws.on("open", () => {
  ws.send(
    JSON.stringify({
      jsonrpc: "2.0",
      id: 1,
      method: "blxr_tx",
      params: {"transaction": signedTxNoPrefix},
    }),
  );
});

ws.on("message", (data) => {
  const response = JSON.parse(data);
  if (response.result?.txHash) {
  const hash = response.result.txHash;
  console.log("TX Hash:", hash);
  console.log(`https://bscscan.com/tx/${hash}`);
} else if (response.error) {
    console.error("❌ Error:", response.error.message);
  }

  ws.close();
});
Complete Example: Token Swap on PancakeSwap

Gas Price Recommendations

Priority
Gas Price
Use Case

Standard

3 gwei

Regular transfers

Fast

5 gwei

Time-sensitive trades

Urgent

10+ gwei

Competitive scenarios

Note: Higher gas prices increase inclusion priority but also increase transaction cost.

Troubleshooting

  1. "nonce too low"

Your nonce is behind the network state. Fetch the latest:

  1. "insufficient funds"

Ensure you have enough BNB for both the transaction value and gas:

  1. "replacement transaction underpriced"

If replacing a pending transaction, increase the gas price by at least 10%:

  1. Transaction not included

  • Increase gas price for higher priority

  • Check that the transaction is valid

  • Verify sufficient balance

Next Steps

For transactions that need MEV protection, see:

Last updated

Was this helpful?