eth_sendRawTransaction RPC Method
To use the eth_sendRawTransaction method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.
Paramètres
données
chaîne de caractères
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": "eth_sendRawTransaction",7« params » : [8"0xf8680685051f4d5c00833d090094ac2d0226ade52e6b4ccc97359359f01e34d50352834c4b40802aa004f4410acfc636f5d65e75ca37448fd0b1e90632661ad3ea071594b646e7621fa0186d78ddbeef43bc372fcc650ad4e77e0629206426cd183d751e9ddcc8d5e777"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": "eth_sendRawTransaction",7« params » : [8"0xf8680685051f4d5c00833d090094ac2d0226ade52e6b4ccc97359359f01e34d50352834c4b40802aa004f4410acfc636f5d65e75ca37448fd0b1e90632661ad3ea071594b646e7621fa0186d78ddbeef43bc372fcc650ad4e77e0629206426cd183d751e9ddcc8d5e777"9],10« id » : 111}'
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider(4"https://docs-demo.avalanche-mainnet.quiknode.pro"5);6const wallet = new ethers.Wallet("{your-key-here}");7let tx = {8to: "0xaC2d0226AdE52e6b4CCc97359359f01e34d50352",9value: ethers.utils.parseEther("0.05"),10gasLimit: 8000000,11gasPrice: "0x07f9acf02",12};13let signedTx = await wallet.signTransaction(tx);14console.log(signedTx);15let sentTx = await provider.sendTransaction(signedTx);16console.log(sentTx);17})();18
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider(4"https://docs-demo.avalanche-mainnet.quiknode.pro"5);6const wallet = new ethers.Wallet("{your-key-here}");7let tx = {8to: "0xaC2d0226AdE52e6b4CCc97359359f01e34d50352",9value: ethers.utils.parseEther("0.05"),10gasLimit: 8000000,11gasPrice: "0x07f9acf02",12};13let signedTx = await wallet.signTransaction(tx);14console.log(signedTx);15let sentTx = await provider.sendTransaction(signedTx);16console.log(sentTx);17})();18
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.eth.send_raw_transaction(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.eth.send_raw_transaction(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