qn_broadcastRawTransaction RPC Method - Multi-Region Broadcast
Please note that this RPC method requires the Transaction Broadcast add-on enabled on your Quicknode endpoint.
Parameters
data
string
REQUIRED
Loading...
Returns
result
Loading...
Request
1curl https://docs-demo.matic.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"jsonrpc":"2.0","method":"qn_broadcastRawTransaction","params":["SIGNED_TRANSACTION"],"id":1}'
1curl https://docs-demo.matic.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"jsonrpc":"2.0","method":"qn_broadcastRawTransaction","params":["SIGNED_TRANSACTION"],"id":1}'
1require 'ethereum.rb'2require 'eth'3client = Ethereum::HttpClient.new('https://docs-demo.matic.quiknode.pro/')4key = Eth::Key.new priv: "{your-key-here}"5amount = 500000000006payload = {7chain_id: Eth::Chain::GOERLI, #replace with correct chain!8nonce: 5, #replace with correct nonce!9priority_fee: 3 * Eth::Unit::GWEI,10max_gas_fee: 21 * Eth::Unit::GWEI,11gas_limit: 69_420,12to: "0xaC2d0226AdE52e6b4CCc97359359f01e34d50352",13value: amount,14}15tx = Eth::Tx.new(payload)16tx.sign(key)17response = client.send_command('qn_broadcastRawTransaction', [tx.hex])18puts response19
1require 'ethereum.rb'2require 'eth'3client = Ethereum::HttpClient.new('https://docs-demo.matic.quiknode.pro/')4key = Eth::Key.new priv: "{your-key-here}"5amount = 500000000006payload = {7chain_id: Eth::Chain::GOERLI, #replace with correct chain!8nonce: 5, #replace with correct nonce!9priority_fee: 3 * Eth::Unit::GWEI,10max_gas_fee: 21 * Eth::Unit::GWEI,11gas_limit: 69_420,12to: "0xaC2d0226AdE52e6b4CCc97359359f01e34d50352",13value: amount,14}15tx = Eth::Tx.new(payload)16tx.sign(key)17response = client.send_command('qn_broadcastRawTransaction', [tx.hex])18puts response19
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider("https://docs-demo.matic.quiknode.pro/");4const wallet = new ethers.Wallet("{your-key-here}");5let tx = {6to: "0xaC2d0226AdE52e6b4CCc97359359f01e34d50352",7value: ethers.utils.parseEther("0.05"),8gasLimit: 8000000,9gasPrice: "0x07f9acf02",10};11let signedTx = await wallet.signTransaction(tx);12console.log(signedTx);13let sentTx = await provider.send("qn_broadcastRawTransaction", [signedTx]);14console.log(sentTx);15})();16
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider("https://docs-demo.matic.quiknode.pro/");4const wallet = new ethers.Wallet("{your-key-here}");5let tx = {6to: "0xaC2d0226AdE52e6b4CCc97359359f01e34d50352",7value: ethers.utils.parseEther("0.05"),8gasLimit: 8000000,9gasPrice: "0x07f9acf02",10};11let signedTx = await wallet.signTransaction(tx);12console.log(signedTx);13let sentTx = await provider.send("qn_broadcastRawTransaction", [signedTx]);14console.log(sentTx);15})();16
1var myHeaders = new Headers();2myHeaders.append("Content-Type", "application/json");34var raw = JSON.stringify({5"jsonrpc": "2.0",6"method": "qn_broadcastRawTransaction",7"params": [8"SIGNED_TRANSACTION"9],10"id": 111});1213var requestOptions = {14method: 'POST',15headers: myHeaders,16body: raw,17redirect: 'follow'18};1920fetch("https://docs-demo.matic.quiknode.pro/", requestOptions)21.then(response => response.text())22.then(result => console.log(result))23.catch(error => console.log('error', error));
1var myHeaders = new Headers();2myHeaders.append("Content-Type", "application/json");34var raw = JSON.stringify({5"jsonrpc": "2.0",6"method": "qn_broadcastRawTransaction",7"params": [8"SIGNED_TRANSACTION"9],10"id": 111});1213var requestOptions = {14method: 'POST',15headers: myHeaders,16body: raw,17redirect: 'follow'18};1920fetch("https://docs-demo.matic.quiknode.pro/", requestOptions)21.then(response => response.text())22.then(result => console.log(result))23.catch(error => console.log('error', error));
1import requests2import json34url = "https://docs-demo.matic.quiknode.pro/"56payload = json.dumps({7"jsonrpc": "2.0",8"method": "qn_broadcastRawTransaction",9"params": [10"SIGNED_TRANSACTION"11],12"id": 113})14headers = {15'Content-Type': 'application/json'16}1718response = requests.request("POST", url, headers=headers, data=payload)1920print(response.text)21
1import requests2import json34url = "https://docs-demo.matic.quiknode.pro/"56payload = json.dumps({7"jsonrpc": "2.0",8"method": "qn_broadcastRawTransaction",9"params": [10"SIGNED_TRANSACTION"11],12"id": 113})14headers = {15'Content-Type': 'application/json'16}1718response = requests.request("POST", url, headers=headers, data=payload)1920print(response.text)21
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.matic.quiknode.pro/")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["Content-Type"] = "application/json"12request.body = JSON.dump({13"jsonrpc": "2.0",14"method": "qn_broadcastRawTransaction",15"params": [16"SIGNED_TRANSACTION"17],18"id": 119})2021response = https.request(request)22puts response.read_body23
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.matic.quiknode.pro/")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["Content-Type"] = "application/json"12request.body = JSON.dump({13"jsonrpc": "2.0",14"method": "qn_broadcastRawTransaction",15"params": [16"SIGNED_TRANSACTION"17],18"id": 119})2021response = https.request(request)22puts response.read_body23
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.matic.quiknode.pro/'))3signed_txn = w3.eth.account.sign_transaction(dict(4nonce=w3.eth.get_transaction_count("{your-public-address-here}"),5maxFeePerGas=3000000000,6maxPriorityFeePerGas=2000000000,7gas=100000,8to='0xaC2d0226AdE52e6b4CCc97359359f01e34d50352',9value=50000000000,10data=b'',11type=2,12chainId=1,13),14"{your-private-key-here}",15)16txHash = w3.provider.make_request("qn_broadcastRawTransaction", [signed_txn.rawTransaction])17print(w3.toHex(txHash))
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.matic.quiknode.pro/'))3signed_txn = w3.eth.account.sign_transaction(dict(4nonce=w3.eth.get_transaction_count("{your-public-address-here}"),5maxFeePerGas=3000000000,6maxPriorityFeePerGas=2000000000,7gas=100000,8to='0xaC2d0226AdE52e6b4CCc97359359f01e34d50352',9value=50000000000,10data=b'',11type=2,12chainId=1,13),14"{your-private-key-here}",15)16txHash = w3.provider.make_request("qn_broadcastRawTransaction", [signed_txn.rawTransaction])17print(w3.toHex(txHash))
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free