Guest User

Untitled

a guest
Feb 15th, 2023
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. const { Transaction } = require('@ethereumjs/tx');
  2.  
  3. async function run() {
  4. const txParams = {
  5. from: "0xb1C3C636576910195B322407CB037AA39CFc3704",
  6. to: "0x0EefF8299B50111b0414D55a7A351A0b02d2529A",
  7. nonce: '0x00',
  8. gasPrice: "0x09184e72a000",
  9. }
  10.  
  11. // privkey to the `from` address
  12. const privateKey = Buffer.from('d05ed1ad7027c78aa1f0a55f1b135ff1ba9abbb571457673126e3950c1a927a0', 'hex')
  13.  
  14. const tx = Transaction.fromTxData(txParams);
  15. const signedTx = tx.sign(privateKey);
  16.  
  17. const tx2 = Transaction.fromTxData(txParams);
  18. const signedTx2 = tx.sign(privateKey)
  19.  
  20. console.log(signedTx.hash().toString("hex"));
  21. console.log(signedTx2.hash().toString("hex"));
  22. }
  23.  
  24. run();
Advertisement
Add Comment
Please, Sign In to add comment