Skip to main content
replaced http://ethereum.stackexchange.com/ with https://ethereum.stackexchange.com/
Source Link

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce this Python scriptthis Python script in Javascript:

#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));

My interest spiked, I also created a small Truffle project here where, for deployment I do:

module.exports = function(deployer) {
    // You need to npm install -g ethereumjs-util
    var ethJsUtil = require('/usr/lib/node_modules/ethereumjs-util/');

    var currentNonce = web3.eth.getTransactionCount(web3.eth.accounts[0]);
    var futureLeftNonce = currentNonce;
    var futureLeftAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureLeftNonce));
    var futureRightNonce = futureLeftNonce + 1;
    var futureRightAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureRightNonce));

    deployer.deploy(Left, futureRightAddress);
    deployer.deploy(Right, futureLeftAddress);
};

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce this Python script in Javascript:

#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));

My interest spiked, I also created a small Truffle project here where, for deployment I do:

module.exports = function(deployer) {
    // You need to npm install -g ethereumjs-util
    var ethJsUtil = require('/usr/lib/node_modules/ethereumjs-util/');

    var currentNonce = web3.eth.getTransactionCount(web3.eth.accounts[0]);
    var futureLeftNonce = currentNonce;
    var futureLeftAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureLeftNonce));
    var futureRightNonce = futureLeftNonce + 1;
    var futureRightAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureRightNonce));

    deployer.deploy(Left, futureRightAddress);
    deployer.deploy(Right, futureLeftAddress);
};

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce this Python script in Javascript:

#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));

My interest spiked, I also created a small Truffle project here where, for deployment I do:

module.exports = function(deployer) {
    // You need to npm install -g ethereumjs-util
    var ethJsUtil = require('/usr/lib/node_modules/ethereumjs-util/');

    var currentNonce = web3.eth.getTransactionCount(web3.eth.accounts[0]);
    var futureLeftNonce = currentNonce;
    var futureLeftAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureLeftNonce));
    var futureRightNonce = futureLeftNonce + 1;
    var futureRightAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureRightNonce));

    deployer.deploy(Left, futureRightAddress);
    deployer.deploy(Right, futureLeftAddress);
};
Add reference to small project putting this in practice.
Source Link

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce this Python script in Javascript:

#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));

My interest spiked, I also created a small Truffle project here where, for deployment I do:


module.exports = function(deployer) {
    // You need to npm install -g ethereumjs-util
    var ethJsUtil = require('/usr/lib/node_modules/ethereumjs-util/');

    var currentNonce = web3.eth.getTransactionCount(web3.eth.accounts[0]);
    var futureLeftNonce = currentNonce;
    var futureLeftAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureLeftNonce));
    var futureRightNonce = futureLeftNonce + 1;
    var futureRightAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureRightNonce));

    deployer.deploy(Left, futureRightAddress);
    deployer.deploy(Right, futureLeftAddress);
};

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce this Python script in Javascript:

#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce this Python script in Javascript:

#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));

My interest spiked, I also created a small Truffle project here where, for deployment I do:


module.exports = function(deployer) {
    // You need to npm install -g ethereumjs-util
    var ethJsUtil = require('/usr/lib/node_modules/ethereumjs-util/');

    var currentNonce = web3.eth.getTransactionCount(web3.eth.accounts[0]);
    var futureLeftNonce = currentNonce;
    var futureLeftAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureLeftNonce));
    var futureRightNonce = futureLeftNonce + 1;
    var futureRightAddress = ethJsUtil.bufferToHex(ethJsUtil.generateAddress(
        web3.eth.accounts[0], futureRightNonce));

    deployer.deploy(Left, futureRightAddress);
    deployer.deploy(Right, futureLeftAddress);
};
Gave a working JS example.
Source Link

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce Thisthis Python script could help.in Javascript:


#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

This Python script could help.

According to here:

Note it gave us the new contract address. Where did this address come from? It is the sha3 hash of the RLP encoding of the list [address of sender, sequence number of sender].

If you know in advance at what tx nonce you will deploy Allower and you can make this RLP calculation yourself, then you can calculate the address to pass to the constructor of your Allowed contract. And vice-versa.

Let's reproduce this Python script in Javascript:


#!/usr/bin/nodejs

var ethJsUtil = require('ethereumjs-util');

var account = "0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0";
console.log("nonce0= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 0)));
console.log("nonce1= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 1)));
console.log("nonce2= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 2)));
console.log("nonce3= " + ethJsUtil.bufferToHex(ethJsUtil.generateAddress(account, 3)));
added 14 characters in body
Source Link
Loading
Source Link
Loading