CREATE opcode: what does it really do?What does bytecode of blank contract do?When does a SUICIDE opcode becomes effective?Possible to create new contract via a proposal in the ethereum.org/dao framework?What are the two arguments to a RETURN opcode?Can the CALL opcode be used to create a contract?Transaction Error. Exception thrown in contract code. REVERT opcode when sending ETH to crowdsaleWhat happens in CALL when gas is set to 0?Ethereum opcode: meaning of first few instructions?callvalue opcode, for what?EVM SIGNEXTEND Opcode explanation

Is there any reason not to eat food that's been dropped on the surface of the moon?

Are student evaluations of teaching assistants read by others in the faculty?

Why is Lord Kartikeya called 'Devasenapati'?

How many times can American Tourist re-enter UK in same 6 month period?

Trouble understanding the speech of overseas colleagues

How do scammers retract money, while you can’t?

Balance Issues for a Custom Sorcerer Variant

Increase performance creating Mandelbrot set in python

Is it okay for two “sein” to be next to each other?

Is the destination of a commercial flight important for the pilot?

Is this version of a gravity generator feasible?

What is the intuitive meaning of having a linear relationship between the logs of two variables?

Anatomically Correct Strange Women In Ponds Distributing Swords

How easy is it to start Magic from scratch?

How did Arya survive the stabbing?

What does "I’d sit this one out, Cap," imply or mean in the context?

Why, precisely, is argon used in neutrino experiments?

Is this apparent Class Action settlement a spam message?

Italian words for tools

How does the UK government determine the size of a mandate?

Opposite of a diet

How long to clear the 'suck zone' of a turbofan after start is initiated?

Is HostGator storing my password in plaintext?

Large drywall patch supports



CREATE opcode: what does it really do?


What does bytecode of blank contract do?When does a SUICIDE opcode becomes effective?Possible to create new contract via a proposal in the ethereum.org/dao framework?What are the two arguments to a RETURN opcode?Can the CALL opcode be used to create a contract?Transaction Error. Exception thrown in contract code. REVERT opcode when sending ETH to crowdsaleWhat happens in CALL when gas is set to 0?Ethereum opcode: meaning of first few instructions?callvalue opcode, for what?EVM SIGNEXTEND Opcode explanation













2















I am looking at the docs, but cannot really understand what CREATE opcode does. I can tell that CREATE does create a new smart contract from a memory chunk, pass the gas value to this new contract, then returns. But before returning, does it execute the new contract?



This confuses me because looking at the disassembly code of the smart contract bytecode, after CREATE, I cannot see any call to CALL after that, but then I still see a call to RETURNDATASIZE, which I suppose only happen after CALL. Without CALL, where it get returned data from?



Any enlighten, please?










share|improve this question


























    2















    I am looking at the docs, but cannot really understand what CREATE opcode does. I can tell that CREATE does create a new smart contract from a memory chunk, pass the gas value to this new contract, then returns. But before returning, does it execute the new contract?



    This confuses me because looking at the disassembly code of the smart contract bytecode, after CREATE, I cannot see any call to CALL after that, but then I still see a call to RETURNDATASIZE, which I suppose only happen after CALL. Without CALL, where it get returned data from?



    Any enlighten, please?










    share|improve this question
























      2












      2








      2








      I am looking at the docs, but cannot really understand what CREATE opcode does. I can tell that CREATE does create a new smart contract from a memory chunk, pass the gas value to this new contract, then returns. But before returning, does it execute the new contract?



      This confuses me because looking at the disassembly code of the smart contract bytecode, after CREATE, I cannot see any call to CALL after that, but then I still see a call to RETURNDATASIZE, which I suppose only happen after CALL. Without CALL, where it get returned data from?



      Any enlighten, please?










      share|improve this question














      I am looking at the docs, but cannot really understand what CREATE opcode does. I can tell that CREATE does create a new smart contract from a memory chunk, pass the gas value to this new contract, then returns. But before returning, does it execute the new contract?



      This confuses me because looking at the disassembly code of the smart contract bytecode, after CREATE, I cannot see any call to CALL after that, but then I still see a call to RETURNDATASIZE, which I suppose only happen after CALL. Without CALL, where it get returned data from?



      Any enlighten, please?







      opcode create






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      user311703user311703

      1806




      1806




















          1 Answer
          1






          active

          oldest

          votes


















          5














          CREATE, in a way, does a built in CALL. What actually happens is that the data passed to call isn't the contract bytecode, it's the init bytecode.



          When CREATE opcode is executed, the EVM creates a call frame in the context of the new contract (e.g. address(this) is the new contracts address). This executes the data passed to CREATE as the code, which in higher level languages is basically the constructor. At the end of this init stuff, it returns the actual code of the contract that is stored in the state trie.



          The easiest way to think about it, which is also fairly accurate, is that the Solidity compiler takes all the executional code of the contract, compiles it to bytecode, and adds it as a return statement at the end of the constructor.






          share|improve this answer

























          • ah, so CREATE when creating a contract actually returns the contract bytecode, right? then after that, CALL will actually executes the contract?

            – user311703
            1 hour ago











          • Please could you tell me what is the best way to track/trace what is really happening at bytecode level? Does Remix a good tool to do this?

            – user311703
            1 hour ago











          • CREATE executes the code passed to it, and that code returns the contact bytecode, yes. Just wanted to be clear on that

            – flygoing
            50 mins ago











          • If you need to a call a function after it's created, then yeah, there would be a CALL right after. Remix is a pretty good way to track/trace on the bytecode level, it has pretty good EVM debugging tools for stepping in/out of bytecode

            – flygoing
            50 mins ago










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "642"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f68943%2fcreate-opcode-what-does-it-really-do%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          CREATE, in a way, does a built in CALL. What actually happens is that the data passed to call isn't the contract bytecode, it's the init bytecode.



          When CREATE opcode is executed, the EVM creates a call frame in the context of the new contract (e.g. address(this) is the new contracts address). This executes the data passed to CREATE as the code, which in higher level languages is basically the constructor. At the end of this init stuff, it returns the actual code of the contract that is stored in the state trie.



          The easiest way to think about it, which is also fairly accurate, is that the Solidity compiler takes all the executional code of the contract, compiles it to bytecode, and adds it as a return statement at the end of the constructor.






          share|improve this answer

























          • ah, so CREATE when creating a contract actually returns the contract bytecode, right? then after that, CALL will actually executes the contract?

            – user311703
            1 hour ago











          • Please could you tell me what is the best way to track/trace what is really happening at bytecode level? Does Remix a good tool to do this?

            – user311703
            1 hour ago











          • CREATE executes the code passed to it, and that code returns the contact bytecode, yes. Just wanted to be clear on that

            – flygoing
            50 mins ago











          • If you need to a call a function after it's created, then yeah, there would be a CALL right after. Remix is a pretty good way to track/trace on the bytecode level, it has pretty good EVM debugging tools for stepping in/out of bytecode

            – flygoing
            50 mins ago















          5














          CREATE, in a way, does a built in CALL. What actually happens is that the data passed to call isn't the contract bytecode, it's the init bytecode.



          When CREATE opcode is executed, the EVM creates a call frame in the context of the new contract (e.g. address(this) is the new contracts address). This executes the data passed to CREATE as the code, which in higher level languages is basically the constructor. At the end of this init stuff, it returns the actual code of the contract that is stored in the state trie.



          The easiest way to think about it, which is also fairly accurate, is that the Solidity compiler takes all the executional code of the contract, compiles it to bytecode, and adds it as a return statement at the end of the constructor.






          share|improve this answer

























          • ah, so CREATE when creating a contract actually returns the contract bytecode, right? then after that, CALL will actually executes the contract?

            – user311703
            1 hour ago











          • Please could you tell me what is the best way to track/trace what is really happening at bytecode level? Does Remix a good tool to do this?

            – user311703
            1 hour ago











          • CREATE executes the code passed to it, and that code returns the contact bytecode, yes. Just wanted to be clear on that

            – flygoing
            50 mins ago











          • If you need to a call a function after it's created, then yeah, there would be a CALL right after. Remix is a pretty good way to track/trace on the bytecode level, it has pretty good EVM debugging tools for stepping in/out of bytecode

            – flygoing
            50 mins ago













          5












          5








          5







          CREATE, in a way, does a built in CALL. What actually happens is that the data passed to call isn't the contract bytecode, it's the init bytecode.



          When CREATE opcode is executed, the EVM creates a call frame in the context of the new contract (e.g. address(this) is the new contracts address). This executes the data passed to CREATE as the code, which in higher level languages is basically the constructor. At the end of this init stuff, it returns the actual code of the contract that is stored in the state trie.



          The easiest way to think about it, which is also fairly accurate, is that the Solidity compiler takes all the executional code of the contract, compiles it to bytecode, and adds it as a return statement at the end of the constructor.






          share|improve this answer















          CREATE, in a way, does a built in CALL. What actually happens is that the data passed to call isn't the contract bytecode, it's the init bytecode.



          When CREATE opcode is executed, the EVM creates a call frame in the context of the new contract (e.g. address(this) is the new contracts address). This executes the data passed to CREATE as the code, which in higher level languages is basically the constructor. At the end of this init stuff, it returns the actual code of the contract that is stored in the state trie.



          The easiest way to think about it, which is also fairly accurate, is that the Solidity compiler takes all the executional code of the contract, compiles it to bytecode, and adds it as a return statement at the end of the constructor.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 1 hour ago









          flygoingflygoing

          7,580931




          7,580931












          • ah, so CREATE when creating a contract actually returns the contract bytecode, right? then after that, CALL will actually executes the contract?

            – user311703
            1 hour ago











          • Please could you tell me what is the best way to track/trace what is really happening at bytecode level? Does Remix a good tool to do this?

            – user311703
            1 hour ago











          • CREATE executes the code passed to it, and that code returns the contact bytecode, yes. Just wanted to be clear on that

            – flygoing
            50 mins ago











          • If you need to a call a function after it's created, then yeah, there would be a CALL right after. Remix is a pretty good way to track/trace on the bytecode level, it has pretty good EVM debugging tools for stepping in/out of bytecode

            – flygoing
            50 mins ago

















          • ah, so CREATE when creating a contract actually returns the contract bytecode, right? then after that, CALL will actually executes the contract?

            – user311703
            1 hour ago











          • Please could you tell me what is the best way to track/trace what is really happening at bytecode level? Does Remix a good tool to do this?

            – user311703
            1 hour ago











          • CREATE executes the code passed to it, and that code returns the contact bytecode, yes. Just wanted to be clear on that

            – flygoing
            50 mins ago











          • If you need to a call a function after it's created, then yeah, there would be a CALL right after. Remix is a pretty good way to track/trace on the bytecode level, it has pretty good EVM debugging tools for stepping in/out of bytecode

            – flygoing
            50 mins ago
















          ah, so CREATE when creating a contract actually returns the contract bytecode, right? then after that, CALL will actually executes the contract?

          – user311703
          1 hour ago





          ah, so CREATE when creating a contract actually returns the contract bytecode, right? then after that, CALL will actually executes the contract?

          – user311703
          1 hour ago













          Please could you tell me what is the best way to track/trace what is really happening at bytecode level? Does Remix a good tool to do this?

          – user311703
          1 hour ago





          Please could you tell me what is the best way to track/trace what is really happening at bytecode level? Does Remix a good tool to do this?

          – user311703
          1 hour ago













          CREATE executes the code passed to it, and that code returns the contact bytecode, yes. Just wanted to be clear on that

          – flygoing
          50 mins ago





          CREATE executes the code passed to it, and that code returns the contact bytecode, yes. Just wanted to be clear on that

          – flygoing
          50 mins ago













          If you need to a call a function after it's created, then yeah, there would be a CALL right after. Remix is a pretty good way to track/trace on the bytecode level, it has pretty good EVM debugging tools for stepping in/out of bytecode

          – flygoing
          50 mins ago





          If you need to a call a function after it's created, then yeah, there would be a CALL right after. Remix is a pretty good way to track/trace on the bytecode level, it has pretty good EVM debugging tools for stepping in/out of bytecode

          – flygoing
          50 mins ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Ethereum Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f68943%2fcreate-opcode-what-does-it-really-do%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          تاکاشی میزونوما جستارهای وابسته منابع پیوند به بیرون منوی ناوبری“Players List (A-Z)”日本代表 試合別出場記録گسترش آن

          Leheküljed, mis viitavad lehele "Corse du Sudi departemangu haldusüksuste loend" Navigeerimismenüü

          What flight has the highest ratio of timezone difference to flight time? The Next CEO of Stack OverflowWhich mountain has the highest death ratio of hikers?Is there a tourist destination where the new year starts first and at the same time the old year ends last?What time is used on board a cruise ship?Does the flight departure time take Daylight Savings Time into account?When a flights departs in the middle of the winter daylight saving time switch, what is the actual departure time?Does the direction of travel matter for jet lag, when the time difference is 12 hours?What is the most expensive regularly scheduled flight?Does the flight time when booking a holiday online show the time you arrive in that country and its time zone?When is 1st of February 24:00 (EST) time in GMT time in the UK?Flight time has been changed - Ryanair refuses to cancel