Deploying a smart contract from EVM Bytecode via rpc calls










2















I am currently trying to deploy a smart contract with bytecode in a private Ethereum chain, using the "dev" chain of the parity client. For this, I compiled the following contract:



pragma solidity ^0.4.11;

contract MyContract
uint i = (10 + 2) * 2;



with solidity:



solc --bin test.sol 

======= test.sol:MyContract =======
Binary:
608060405260186000553480156014576
00080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029


I then used the following rpc call to create the transaction:



Request: "method": "personal_sendTransaction", "id": 1, "jsonrpc": "2.0", "params": ["from": "0x0053b6a9527c2ba72cf44486dd12d9930ce25bae", "data": "0x60806040526018600055348015601457600080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029", "test"].


where 0x0053b6a9527c2ba72cf44486dd12d9930ce25bae is an account on the private Chain which has ether and the passphrase test.



This is the answer I get:



Response: "jsonrpc":"2.0","result":"0xf547c28a3f51c05832fadd4b807f5bb769196970d08e446b2644a2ea94359572","id":1.


But the byte string given in result is not a valid address. How do I get the address of the contract I created?










share|improve this question


























    2















    I am currently trying to deploy a smart contract with bytecode in a private Ethereum chain, using the "dev" chain of the parity client. For this, I compiled the following contract:



    pragma solidity ^0.4.11;

    contract MyContract
    uint i = (10 + 2) * 2;



    with solidity:



    solc --bin test.sol 

    ======= test.sol:MyContract =======
    Binary:
    608060405260186000553480156014576
    00080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029


    I then used the following rpc call to create the transaction:



    Request: "method": "personal_sendTransaction", "id": 1, "jsonrpc": "2.0", "params": ["from": "0x0053b6a9527c2ba72cf44486dd12d9930ce25bae", "data": "0x60806040526018600055348015601457600080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029", "test"].


    where 0x0053b6a9527c2ba72cf44486dd12d9930ce25bae is an account on the private Chain which has ether and the passphrase test.



    This is the answer I get:



    Response: "jsonrpc":"2.0","result":"0xf547c28a3f51c05832fadd4b807f5bb769196970d08e446b2644a2ea94359572","id":1.


    But the byte string given in result is not a valid address. How do I get the address of the contract I created?










    share|improve this question
























      2












      2








      2


      1






      I am currently trying to deploy a smart contract with bytecode in a private Ethereum chain, using the "dev" chain of the parity client. For this, I compiled the following contract:



      pragma solidity ^0.4.11;

      contract MyContract
      uint i = (10 + 2) * 2;



      with solidity:



      solc --bin test.sol 

      ======= test.sol:MyContract =======
      Binary:
      608060405260186000553480156014576
      00080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029


      I then used the following rpc call to create the transaction:



      Request: "method": "personal_sendTransaction", "id": 1, "jsonrpc": "2.0", "params": ["from": "0x0053b6a9527c2ba72cf44486dd12d9930ce25bae", "data": "0x60806040526018600055348015601457600080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029", "test"].


      where 0x0053b6a9527c2ba72cf44486dd12d9930ce25bae is an account on the private Chain which has ether and the passphrase test.



      This is the answer I get:



      Response: "jsonrpc":"2.0","result":"0xf547c28a3f51c05832fadd4b807f5bb769196970d08e446b2644a2ea94359572","id":1.


      But the byte string given in result is not a valid address. How do I get the address of the contract I created?










      share|improve this question














      I am currently trying to deploy a smart contract with bytecode in a private Ethereum chain, using the "dev" chain of the parity client. For this, I compiled the following contract:



      pragma solidity ^0.4.11;

      contract MyContract
      uint i = (10 + 2) * 2;



      with solidity:



      solc --bin test.sol 

      ======= test.sol:MyContract =======
      Binary:
      608060405260186000553480156014576
      00080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029


      I then used the following rpc call to create the transaction:



      Request: "method": "personal_sendTransaction", "id": 1, "jsonrpc": "2.0", "params": ["from": "0x0053b6a9527c2ba72cf44486dd12d9930ce25bae", "data": "0x60806040526018600055348015601457600080fd5b5060358060226000396000f3006080604052600080fd00a165627a7a72305820d0cc3f28b74510b6f3f34e1a1e1303c584b355320f387a3e30022117e3554e220029", "test"].


      where 0x0053b6a9527c2ba72cf44486dd12d9930ce25bae is an account on the private Chain which has ether and the passphrase test.



      This is the answer I get:



      Response: "jsonrpc":"2.0","result":"0xf547c28a3f51c05832fadd4b807f5bb769196970d08e446b2644a2ea94359572","id":1.


      But the byte string given in result is not a valid address. How do I get the address of the contract I created?







      contract-deployment private-blockchain parity






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 14:52









      BlockchainDieterBlockchainDieter

      324




      324




















          1 Answer
          1






          active

          oldest

          votes


















          4














          The result you got is the "transaction hash" ( tx ), which you can then pass to a "eth_getTransactionReceipt" call in order to get the actual contract address.



          See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt



          // Example Call / Request 

          curl -X POST --data'"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1'

          // Result

          "id":1,
          "jsonrpc":"2.0",
          "result":
          transactionHash: '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238',
          transactionIndex: '0x1', // 1
          blockNumber: '0xb', // 11
          blockHash: '0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b',
          cumulativeGasUsed: '0x33bc', // 13244
          gasUsed: '0x4dc', // 1244
          contractAddress: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', // or null, if none was created
          logs: [
          // logs as returned by getFilterLogs, etc.
          , ...],
          logsBloom: "0x00...0", // 256 byte bloom filter
          status: '0x1'







          share|improve this answer






















            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%2f62350%2fdeploying-a-smart-contract-from-evm-bytecode-via-rpc-calls%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









            4














            The result you got is the "transaction hash" ( tx ), which you can then pass to a "eth_getTransactionReceipt" call in order to get the actual contract address.



            See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt



            // Example Call / Request 

            curl -X POST --data'"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1'

            // Result

            "id":1,
            "jsonrpc":"2.0",
            "result":
            transactionHash: '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238',
            transactionIndex: '0x1', // 1
            blockNumber: '0xb', // 11
            blockHash: '0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b',
            cumulativeGasUsed: '0x33bc', // 13244
            gasUsed: '0x4dc', // 1244
            contractAddress: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', // or null, if none was created
            logs: [
            // logs as returned by getFilterLogs, etc.
            , ...],
            logsBloom: "0x00...0", // 256 byte bloom filter
            status: '0x1'







            share|improve this answer



























              4














              The result you got is the "transaction hash" ( tx ), which you can then pass to a "eth_getTransactionReceipt" call in order to get the actual contract address.



              See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt



              // Example Call / Request 

              curl -X POST --data'"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1'

              // Result

              "id":1,
              "jsonrpc":"2.0",
              "result":
              transactionHash: '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238',
              transactionIndex: '0x1', // 1
              blockNumber: '0xb', // 11
              blockHash: '0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b',
              cumulativeGasUsed: '0x33bc', // 13244
              gasUsed: '0x4dc', // 1244
              contractAddress: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', // or null, if none was created
              logs: [
              // logs as returned by getFilterLogs, etc.
              , ...],
              logsBloom: "0x00...0", // 256 byte bloom filter
              status: '0x1'







              share|improve this answer

























                4












                4








                4







                The result you got is the "transaction hash" ( tx ), which you can then pass to a "eth_getTransactionReceipt" call in order to get the actual contract address.



                See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt



                // Example Call / Request 

                curl -X POST --data'"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1'

                // Result

                "id":1,
                "jsonrpc":"2.0",
                "result":
                transactionHash: '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238',
                transactionIndex: '0x1', // 1
                blockNumber: '0xb', // 11
                blockHash: '0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b',
                cumulativeGasUsed: '0x33bc', // 13244
                gasUsed: '0x4dc', // 1244
                contractAddress: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', // or null, if none was created
                logs: [
                // logs as returned by getFilterLogs, etc.
                , ...],
                logsBloom: "0x00...0", // 256 byte bloom filter
                status: '0x1'







                share|improve this answer













                The result you got is the "transaction hash" ( tx ), which you can then pass to a "eth_getTransactionReceipt" call in order to get the actual contract address.



                See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt



                // Example Call / Request 

                curl -X POST --data'"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1'

                // Result

                "id":1,
                "jsonrpc":"2.0",
                "result":
                transactionHash: '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238',
                transactionIndex: '0x1', // 1
                blockNumber: '0xb', // 11
                blockHash: '0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b',
                cumulativeGasUsed: '0x33bc', // 13244
                gasUsed: '0x4dc', // 1244
                contractAddress: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', // or null, if none was created
                logs: [
                // logs as returned by getFilterLogs, etc.
                , ...],
                logsBloom: "0x00...0", // 256 byte bloom filter
                status: '0x1'








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 15:38









                Micky SocaciMicky Socaci

                66419




                66419



























                    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%2f62350%2fdeploying-a-smart-contract-from-evm-bytecode-via-rpc-calls%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







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                    Museum of Modern and Contemporary Art of Trento and Rovereto