const transaction = { to: '0x31B98D14007bDEe637298086988A0bBd31184523', // 轉入地址:Rinkeby faucet value: 100, // 100 wei gas: 30000, maxFeePerGas: 2500000000, nonce: nonce, }; const signedTx = await web3.eth.accounts.signTransaction(transaction, PRIVATE_KEY); web3.eth.sendSignedTransaction(signedTx.rawTransaction, function(error, hash) { if (!error) { console.log("🎉 The hash of your transaction is: ", hash, "\n Check Alchemy's Mempool to view the status of your transaction!"); } else { console.log("❗Something went wrong while submitting your transaction:", error) } }); };
main();
執行腳本。
1
node index.js
結果如下:
1 2 3
node index.js 🎉 The hash of your transaction is: 0x95c59fcbbb6823ceb205ab88bd23a94a2dfdca47f78c10e760a73dc3e4c3e9a5 Check Alchemy's Mempool to view the status of your transaction!