qn_broadcastRawTransaction RPC Method - Multi-Region Broadcast
Please note that this RPC method requires the Transaction Broadcast add-on enabled on your Quicknode endpoint.
Parâmetros
dados
cadeia de caracteres
OBRIGATÓRIO
A carregar...
Devoluções
resultado
cadeia de caracteres
A carregar...
Pedido
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--dados '{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--dados '{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 = 500000000006carga útil = {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])18apresenta a resposta19
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 = 500000000006carga útil = {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])18apresenta a resposta19
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.acrescentar("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 = {14método: 'POST',15cabeçalhos: myHeaders,16corpo: raw,17redirecionar: 'seguir'18};1920fetch("https://docs-demo.avalanche-mainnet.quiknode.pro", requestOptions)21.então(resposta => resposta.texto())22.então(resultado => console.log(resultado))23.catch(error => console.log('error', error));
1var myHeaders = new Headers();2myHeaders.acrescentar("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 = {14método: 'POST',15cabeçalhos: myHeaders,16corpo: raw,17redirecionar: 'seguir'18};1920fetch("https://docs-demo.avalanche-mainnet.quiknode.pro", requestOptions)21.então(resposta => resposta.texto())22.então(resultado => console.log(resultado))23.catch(error => console.log('error', error));
1importar pedidos2import json34url = "https://docs-demo.avalanche-mainnet.quiknode.pro"56carga útil = json.dumps({7"jsonrpc": "2.0",8"method": "qn_broadcastRawTransaction",9"params": [10"SIGNED_TRANSACTION"11],12"id": 113})14cabeçalhos = {15'Content-Type': 'application/json'16}1718resposta = pedidos.pedido("POST", url, headers=headers, dados=carga útil)1920imprimir(resposta.texto)21
1importar pedidos2import json34url = "https://docs-demo.avalanche-mainnet.quiknode.pro"56carga útil = json.dumps({7"jsonrpc": "2.0",8"method": "qn_broadcastRawTransaction",9"params": [10"SIGNED_TRANSACTION"11],12"id": 113})14cabeçalhos = {15'Content-Type': 'application/json'16}1718resposta = pedidos.pedido("POST", url, headers=headers, dados=carga útil)1920imprimir(resposta.texto)21
1exigir "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.avalanche-mainnet.quiknode.pro")67https = Net::HTTP.novo(url.host, url.porta)8https.use_ssl = true910pedido = Líquido::HTTP::POST.novo(url)11pedido["Content-Type"] = "application/json"12pedido.corpo = JSON.dump({13"jsonrpc": "2.0",14"method": "qn_broadcastRawTransaction",15"params": [16"SIGNED_TRANSACTION"17],18"id": 119})2021resposta = https.pedido(pedido)22insere a resposta.read_body23
1exigir "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.avalanche-mainnet.quiknode.pro")67https = Net::HTTP.novo(url.host, url.porta)8https.use_ssl = true910pedido = Líquido::HTTP::POST.novo(url)11pedido["Content-Type"] = "application/json"12pedido.corpo = JSON.dump({13"jsonrpc": "2.0",14"method": "qn_broadcastRawTransaction",15"params": [16"SIGNED_TRANSACTION"17],18"id": 119})2021resposta = https.pedido(pedido)22insere a resposta.read_body23
1de 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))
1de 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))
Ainda não tem uma conta?
Crie o seu ponto de extremidade Quicknode em segundos e comece a desenvolver
Comece gratuitamente