qn_broadcastRawTransaction RPC Method - Multi-Region Broadcast
Please note that this RPC method requires the Transaction Broadcast add-on enabled on your Quicknode endpoint.
Paramètres
données
chaîne de caractères
OBLIGATOIRE
Chargement en cours...
Retours
résultat
chaîne de caractères
Chargement en cours...
Demande
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H « Content-Type : application/json » \4--données '{5« jsonrpc » : « 2.0 »,6"method": "qn_broadcastRawTransaction",7« params » : [8"SIGNED_TRANSACTION"9],10« id » : 111}'
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H « Content-Type : application/json » \4--données '{5« jsonrpc » : « 2.0 »,6"method": "qn_broadcastRawTransaction",7« params » : [8"SIGNED_TRANSACTION"9],10« id » : 111}'
1require 'ethereum.rb'2require 'eth'3client = Ethereum::HttpClient.new('https://docs-demo.avalanche-mainnet.quiknode.pro')4key = Eth::Key.new priv: "{your-key-here}"5amount = 500000000006charge utile = {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.avalanche-mainnet.quiknode.pro')4key = Eth::Key.new priv: "{your-key-here}"5amount = 500000000006charge utile = {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.avalanche-mainnet.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.avalanche-mainnet.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.ajouter(« Content-Type », « application/json »);34var brut = JSON.stringify({5« jsonrpc »: « 2.0 »,6"method": "qn_broadcastRawTransaction",7« params »: [8"SIGNED_TRANSACTION"9],10« id »: 111});1213var requestOptions = {14méthode: « POST »,15en-têtes: myHeaders,16corps: brut,17redirection: « suivre »18};1920fetch("https://docs-demo.avalanche-mainnet.quiknode.pro", requestOptions)21.puis(réponse => réponse.text())22.puis(résultat => console.log(résultat))23.catch(error => console.log('error', error));
1var myHeaders = new Headers();2myHeaders.ajouter(« Content-Type », « application/json »);34var brut = JSON.stringify({5« jsonrpc »: « 2.0 »,6"method": "qn_broadcastRawTransaction",7« params »: [8"SIGNED_TRANSACTION"9],10« id »: 111});1213var requestOptions = {14méthode: « POST »,15en-têtes: myHeaders,16corps: brut,17redirection: « suivre »18};1920fetch("https://docs-demo.avalanche-mainnet.quiknode.pro", requestOptions)21.puis(réponse => réponse.text())22.puis(résultat => console.log(résultat))23.catch(error => console.log('error', error));
1import demandes2import json34url = "https://docs-demo.avalanche-mainnet.quiknode.pro"56charge utile = json.dumps({7« jsonrpc »: « 2.0 »,8"method": "qn_broadcastRawTransaction",9« params »: [10"SIGNED_TRANSACTION"11],12« id »: 113})14en-têtes = {15« Content-Type »: 'application/json'16}1718réponse = demandes.demande(« POST », url, en-têtes=en-têtes, données=charge utile)1920imprimer(réponse.texte)21
1import demandes2import json34url = "https://docs-demo.avalanche-mainnet.quiknode.pro"56charge utile = json.dumps({7« jsonrpc »: « 2.0 »,8"method": "qn_broadcastRawTransaction",9« params »: [10"SIGNED_TRANSACTION"11],12« id »: 113})14en-têtes = {15« Content-Type »: 'application/json'16}1718réponse = demandes.demande(« POST », url, en-têtes=en-têtes, données=charge utile)1920imprimer(réponse.texte)21
1nécessite « uri »2require « json »3nécessite « net/http »45url = URI("https://docs-demo.avalanche-mainnet.quiknode.pro")67https = Net::HTTP.new(url.serveur, url.port)8https.use_ssl = true910demande = Net::HTTP::POST.nouveau(URL)11demande[« Content-Type »] = « application/json »12demande.corps = JSON.dump({13« jsonrpc »: « 2.0 »,14"method": "qn_broadcastRawTransaction",15« params »: [16"SIGNED_TRANSACTION"17],18« id »: 119})2021réponse = https.requête(requête)22affiche la réponse.read_body23
1nécessite « uri »2require « json »3nécessite « net/http »45url = URI("https://docs-demo.avalanche-mainnet.quiknode.pro")67https = Net::HTTP.new(url.serveur, url.port)8https.use_ssl = true910demande = Net::HTTP::POST.nouveau(URL)11demande[« Content-Type »] = « application/json »12demande.corps = JSON.dump({13« jsonrpc »: « 2.0 »,14"method": "qn_broadcastRawTransaction",15« params »: [16"SIGNED_TRANSACTION"17],18« id »: 119})2021réponse = https.requête(requête)22affiche la réponse.read_body23
1Source : web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.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))
1Source : web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.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))
Vous n'avez pas encore de compte ?
Créez votreendpoint Quicknode endpoint quelques secondes et commencez à développer
Commencez gratuitement