0

Normally, when I browse for the address of a specific contract and then click the contract-creation transaction label, I get:

To: [Contract 0x... Created]

For example, consider the BNB contract at 0xb8c77482e45f1f44de1745f52c74426c631bdd52.

When you open this link, you'll see on the More Info pane:

ContractCreator: 0x00c5e04176d95a... at txn 0x436fc7d21ed4a0a...

When you then click the address next to the txn label, you'll see:

To: [Contract 0xb8c77482e45f1f44de1745f52c74426c631bdd52 Created] (Binance Token)

However, when I do this on 0x607108c46bce4cf6f86698e9b46e3270a734fefe, I get:

To: Contract 0x584b3fb1267bf10b85434ccbbe95c2fe677e33eb

To be honest, it truly bothers me when I use etherscan's API in an automation script of mine, with the purpose of finding the creation block numbers of various contracts:

const request = require("request");

const ADDR = process.argv[2];
const KEY  = process.argv[3];
const URL  = "http://api.etherscan.io/api?module=account&action=txlist";

request(URL + "&address=" + ADDR + "&apikey=" + KEY, function(error, response, body) {
    const parsed = body ? JSON.parse(body) : {};
    if (parsed.result && parsed.result.length > 0) {
        if (parsed.result[0].to == "") {
            console.log(parsed.result[0].blockNumber);
        }
        else {
            console.log("error");
        }
    }
    else {
        console.log("error");
    }
});

Normally, on a contract-creation transaction, the value of body.result[0].to is "".

However, in this unique case, it is not.

Any idea why?

I am guessing that maybe this contract was created by another contract (via new) and not by an externally-owned account (in other words, that it was created "on-chain" instead of "off-chain").

But it still doesn't make sense to me that the to address is known upon contract-creation (I mean, of course it can be computed from the hash of the concatenation of the deployer's address and the deployer's nonce, but that would work whether the contract was created "on-chain" or "off-chain").

So what exactly was special about the creation of this specific contract, which makes etherscan return different results?

Thank you!

3

I'm pretty sure that your suggestion is correct.

The contract was deployed in tx with hash 0xd47b26a4bb5cacb3792f2d849ef298295af62fcf5943cfc5e987b0c7c798f162

The 0x607108c4... cotract creator is 0x584b3fb1..., because inside this contract new was called.

And the external accout called 0x584b3fb1... contract to create the tx. So, it is to address that you find.

The scheme is like below:

User
    -(external call = tx creation)->
        0x584b3fb1...
            -(new)-> create 0x607108c4... contract
            some token transfers and one more contract creation

Please feel free to ask again if it's still not clear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.