Open VerilogR opened 5 years ago
hi there. I try to use some code
const Web3 = require('web3'); const web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/a258108e315040369ddb3b2d991f4ad0"));
let privateKey = "privatekey";
let tx = { from: '0xb5fcc962b61Ea40d22a012ab0cF94341DDb7f68F', to: '0x15AE271790e8A0a4aC0D4C0dAA16adc3B72c72D5', value: '0x0', gas: 350000, gasPrice: 10000000000, data: '0xe2f8b619', nonce: 1, };
web3.eth.accounts.signTransaction(tx, privateKey).then(signed => { let tran = web3.eth.sendSignedTransaction(signed.rawTransaction);
tran.on('transactionHash', hash => { console.log('hash'); console.log(hash); }); tran.on('confirmation', (confirmationNumber, receipt) => { console.log('confirmation: ' + confirmationNumber); }); tran.on('receipt', receipt => { console.log('reciept'); console.log(receipt); }); tran.on('error', console.error);
});
But it make an error. Please explain what i do wrong
hash 0x3e91427e15075c27234f65cbc3949b5e1c9567244dbc3aa14395230452627caa { error: Error: Node error: {"code":-32042,"message":"Bad response on request: [ TransactionIndex ]. Error cause was EmptyResponse, (majority count: 69 / total: 69)"} at Function.validate (/home/dmitriy/Projects/SignedTransactionETH/node_modules/web3-providers/dist/web3-providers.cjs.js:114:18) at HttpProvider._callee$ (/home/dmitriy/Projects/SignedTransactionETH/node_modules/web3-providers/dist/web3-providers.cjs.js:710:61) at tryCatch (/home/dmitriy/Projects/SignedTransactionETH/node_modules/regenerator-runtime/runtime.js:45:40) at Generator.invoke [as _invoke] (/home/dmitriy/Projects/SignedTransactionETH/node_modules/regenerator-runtime/runtime.js:271:22) at Generator.prototype.(anonymous function) [as next] (/home/dmitriy/Projects/SignedTransactionETH/node_modules/regenerator-runtime/runtime.js:97:21) at asyncGeneratorStep (/home/dmitriy/Projects/SignedTransactionETH/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) at _next (/home/dmitriy/Projects/SignedTransactionETH/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) at process._tickCallback (internal/process/next_tick.js:68:7), receipt: false, confirmations: 0, confirmationChecks: 0 } undefined undefined
hi there. I try to use some code
const Web3 = require('web3'); const web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/a258108e315040369ddb3b2d991f4ad0"));
let privateKey = "privatekey";
let tx = { from: '0xb5fcc962b61Ea40d22a012ab0cF94341DDb7f68F', to: '0x15AE271790e8A0a4aC0D4C0dAA16adc3B72c72D5', value: '0x0', gas: 350000, gasPrice: 10000000000, data: '0xe2f8b619', nonce: 1, };
web3.eth.accounts.signTransaction(tx, privateKey).then(signed => { let tran = web3.eth.sendSignedTransaction(signed.rawTransaction);
});
But it make an error. Please explain what i do wrong
hash 0x3e91427e15075c27234f65cbc3949b5e1c9567244dbc3aa14395230452627caa { error: Error: Node error: {"code":-32042,"message":"Bad response on request: [ TransactionIndex ]. Error cause was EmptyResponse, (majority count: 69 / total: 69)"} at Function.validate (/home/dmitriy/Projects/SignedTransactionETH/node_modules/web3-providers/dist/web3-providers.cjs.js:114:18) at HttpProvider._callee$ (/home/dmitriy/Projects/SignedTransactionETH/node_modules/web3-providers/dist/web3-providers.cjs.js:710:61) at tryCatch (/home/dmitriy/Projects/SignedTransactionETH/node_modules/regenerator-runtime/runtime.js:45:40) at Generator.invoke [as _invoke] (/home/dmitriy/Projects/SignedTransactionETH/node_modules/regenerator-runtime/runtime.js:271:22) at Generator.prototype.(anonymous function) [as next] (/home/dmitriy/Projects/SignedTransactionETH/node_modules/regenerator-runtime/runtime.js:97:21) at asyncGeneratorStep (/home/dmitriy/Projects/SignedTransactionETH/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) at _next (/home/dmitriy/Projects/SignedTransactionETH/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) at process._tickCallback (internal/process/next_tick.js:68:7), receipt: false, confirmations: 0, confirmationChecks: 0 } undefined undefined
Versions