Created
October 11, 2021 06:53
-
-
Save Rhynorater/df20153bd9a5ec3b16b4ec5a7515e032 to your computer and use it in GitHub Desktop.
Quick command-line script to predict the next contract address for an account based off its current nonce and address.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var web3 = require('web3'); | |
var rlp = require('rlp'); | |
var process = require( 'process' ); | |
var nonce = parseInt(process.argv[3]); | |
var account = process.argv[2]; | |
var d = web3.utils.sha3(rlp.encode([account, nonce])); | |
console.log("0x"+d.substring(d.length-40)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment