1

We have two types of account in Ethereum one is EOA and other is a Contract account. While going through some code i found that u need to have a EOA account to create a new contract in ethereum.

var greeter = greeterContract.new(_greeting,{from:web3.eth.accounts[0], data: greeterCompiled.greeter.code, gas: 300000}

So my question is we always need a EOA account to publish a smart contract in ethereum, if not the case how can it be done without a EOA.

0

Contracts can be created in the Genesis block, so that they are present when the chain starts.

This is how Quorum implements QuorumChain consensus. The voting contract is embedded in the genesis.json file along with its initial parameters.

You can see an example here - it creates a contract at address 0x20 with the code shown and the initial storage set up:

{
  "alloc": {
    "0x0000000000000000000000000000000000000020": {
      "code": "606060405236156100c45760e0...<truncated>...",
      "storage": {
        "0x0000000000000000000000000000000000000000000000000000000000000001": "0x02",
        "0x0000000000000000000000000000000000000000000000000000000000000002": "0x04",
        "0x29ecdbdf95c7f6ceec92d6150c697aa14abeb0f8595dd58d808842ea237d8494": "0x01",
        "0x6aa118c6537572d8b515a9f9154be55a3377a8de7991cd23bf6e5ceb368688e3": "0x01",
        ...
      }
    },
...

This is the only mechanism I am aware of to do what you are asking about. Contracts can create other contracts, but that just pushes the problem back a step

  • Thanks Ben. I understand that we need a EOA to publish a contract, as publishing means running some code and in that way some EOA should also provide ether, sounds ok. But quorum it could have been overcome as it is private blockchain, but still it needs a EOA to push a contract into blockchain? – user5740953 Nov 10 '17 at 8:27
  • Quorum deliberately stays as close to Ethereum as possible while achieving its goals. You are correct that many things could be changed, such as this, but as a design choice it changes as little as possible. Therefore, as with the public chain, all actions need to be initiated by EOAs. – benjaminion Nov 10 '17 at 8:32

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.