2

Looking for help with a successful transaction not showing the details on etherescan.

Having a deployed factory contract like so (simplified):

contract EntityFactory  {

    event EntityCreated(address entity);

    function createEntity (string _hash) public returns (Entity entity) {
        Entity ent = new Entity(_hash);

        EntityCreated(ent);
        return ent;
    }
}

contract Entity {
    string private hash;

    function Entity (string _hash) public {
        hash = _hash;
    }

    function getHash() public returns(string) { 
        return hash; 
    }
}

I called EntityFactory.createEntity(...) successfully and the transaction got mined etc

On etherscan I see the transaction of calling EntityFactory.createEntity(...) as well as the emitted events. In the linked event log it is the second event. The first piece of data of the event is the address for the created Entity.

However, the address of Entity can't be found on etherscan. When I take the same address and use truffle console to call Entity.at('<address>') the correct data is found and I can interact with the Entity at that address.

My understanding is that the EntityFactory would have created a new contract by calling new and that Contract should also be visible on etherscan.

Where am I thinking wrong about this?

Is there a way to see the resulting contract that came from the call to EntityFactory.createEntity(...) somewhere on etherescan?

0

I just gave it a try on Remix.

The code seems to work ok, although you should mark getHash() as constant/view as it is just reading data.

First I deployed the EntityFactory contract: https://ropsten.etherscan.io/address/0x66ef7b2923c769c529300cb6f9d002be0337fc58

Then executed createEntity("Hello"), which created and deployed a newEntity contract.

This is the tx hash: https://ropsten.etherscan.io/tx/0x40c981bd9f5936cad26f62ada2761484d17e7befdc6ee6a3b19a768087aea08f

And the Entity contract that it generated: https://ropsten.etherscan.io/address/0xc9c9b580fc41cdcf10df9743cadc845f6d8300e9

  • When I am looking at the event log of the transaction that called the factory method I can see that the address of the Entity is logged there as 0xc9c9b580fc41cdcf10df9743cadc845f6d8300e9. However, that address doesn't show up on etherscan then. Do you think that is because it is an 'internal transaction'? Obviously, the transaction succeeded in general. – emdor202 Oct 26 '17 at 3:50
  • @emdor202 yes it does show. You have a table with one entry and a few columns. The third column (_to) shows the address of the contract created by the internal transaction. – pabloruiz55 Dec 28 '17 at 10:06

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.