newFlashblockTransactions - Flashblocks
Example code for the newFlashblockTransactions Flashblocks method. Complete guide on how to use newFlashblockTransactions Flashblocks in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Request Example
# WebSocket-only. Use wscat (or similar) to connect first:
wscat -c 'wss://go.getblock.io/<ACCESS-TOKEN>/'
# Then send:
{"jsonrpc": "2.0", "method": "eth_subscribe", "params": ["newFlashblockTransactions", true], "id": "getblock.io"}import WebSocket from 'ws';
const ws = new WebSocket('wss://go.getblock.io/<ACCESS-TOKEN>/');
ws.on('open', () => {
ws.send(JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_subscribe",
"params": [
"newFlashblockTransactions",
true
],
"id": "getblock.io"
}));
});
ws.on('message', (data) => {
const msg = JSON.parse(data.toString());
if (msg.method === 'eth_subscription') {
// Preconfirmed data update
console.log(msg.params.result);
} else {
// Subscription ID response
console.log('Subscribed:', msg.result);
}
});Response Example
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "0x5c1de6a7b8c9d0e1f2a3b4c5d6e7f8a9"
}Response Parameters
Field
Type
Description
Use Cases
Error Handling
Status Code
Error Message
Cause
SDK Integration
Last updated
Was this helpful?