Implementation Guide
Blocklander is a specialised service that enhances transaction speed and improves conversion rates on Solana by prioritising your transactions. By including a small tip instruction, you send transactions in parallel across multiple, independent pipelines with optimized networking and geographically aware routing.
Head over to https://app.blocklander.io to get your API key.
Step 1: Prepare Tip Instruction
Add a tip instruction to your transaction to prioritize it:
/**
* This is an example of our Blocklander wallet.
* Always use the API to get the latest Blocklander wallets.
* Otherwise, you might use a deprecated wallet.
*/
const TIP_WALLET = new PublicKey("HYseAPq3ZPYzA35hLsEgmdsKCZQ3P7FBCcCPPytRtyTz");
const MIN_TIP_LAMPORTS = 500_000;
const tipIx = SystemProgram.transfer({
fromPubkey: signer.publicKey,
toPubkey: TIP_WALLET,
lamports: MIN_TIP_LAMPORTS,
});Step 2: Get the Latest Tip Wallets
Use our API to retrieve the current list of tip wallets:
curl 'https://solana-mainnet.btftx.io/wallets'Example Response:
{"wallets":["HYseAPq3ZPYzA35hLsEgmdsKCZQ3P7FBCcCPPytRtyTz"]}Step 3: Submit Your Transaction
You can easily submit your Blocklander transaction either using solana SDK and passing in the URL as an RPC endpoint, or using any HTTP client to make requests to the endpoint
RPC-like URL Method
Use our RPC URL with the standard Solana sendTransaction method:
const connection = new Connection('https://solana-mainnet.btftx.io/rpc?api-key=YOUR_API_KEY');
signature = await connection.sendTransaction(signedTx);The endpoint in this example is a global DNS load balanced endpoint based on latency:
https://solana-mainnet.btftx.io
You can use other endpoints that are geolocated closer to your users or servers. Find all the endpoints from the https://app.blocklander.io dashboard.
Note: the Blocklander URL does not support any other RPC method than sendTransaction.
HTTP request
curl -X POST "https://solana-mainnet.btftx.io/rpc?api-key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "sendTransaction",
"params": [
"BASE64_ENCODED_SIGNED_TRANSACTION",
{
"skipPreflight": true,
"encoding": "base64"
}
]
}'Example response
{
"jsonrpc": "2.0",
"result": "SbiSQCQg56henH8YvQEPCXpQV3uQvLWKpoQ6v6bA8Esn94xquDworigbFTSSnWMfREj7No8EqJR6xEfCDu7VxLq",
"id": 1
}How to keep the connection alive?
To maintain an open TCP connection to our servers and avoid unnecessary reconnects, you can periodically call the /ping endpoint.
How It Works
Our servers keep persistent connections open for up to 65 seconds of inactivity. After that, an idle connection is closed automatically. To prevent this from happening, make sure the client sends any request before the timeout is reached.
A few things to keep in mind:
- A connection will close if it sits idle for longer than **65 **seconds.
- Sending a request resets this timer and keeps the connection active.
- Each TCP connection can handle up to** 1000** requests before a new one must be created.
The /ping route is ideal for this purpose:
Sample Request
GET https://solana-mainnet.btftx.io/ping
Sample Response
{
"message": "pong"
}
Recommended Interval
For consistent results, send a request to /ping about every 60 seconds.
This keeps the connection warm without adding unnecessary traffic.
Updated 2 months ago
