What is the unit used when using the SetBalance() function of the state package?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















Maybe I missed it, but can't seem to find it anywhere. Is the unit used in Gwei or in Eth?



For example when writing :



stateDb, err := state.New(rootHash, db)
if err!=nil
return err

addressA := common.HexToAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")

stateDb.SetBalance(addressA, big.NewInt(1000))


do we get 1000 eth or 1000 wei?



Any help appreciated










share|improve this question




























    2















    Maybe I missed it, but can't seem to find it anywhere. Is the unit used in Gwei or in Eth?



    For example when writing :



    stateDb, err := state.New(rootHash, db)
    if err!=nil
    return err

    addressA := common.HexToAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")

    stateDb.SetBalance(addressA, big.NewInt(1000))


    do we get 1000 eth or 1000 wei?



    Any help appreciated










    share|improve this question


























      2












      2








      2








      Maybe I missed it, but can't seem to find it anywhere. Is the unit used in Gwei or in Eth?



      For example when writing :



      stateDb, err := state.New(rootHash, db)
      if err!=nil
      return err

      addressA := common.HexToAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")

      stateDb.SetBalance(addressA, big.NewInt(1000))


      do we get 1000 eth or 1000 wei?



      Any help appreciated










      share|improve this question
















      Maybe I missed it, but can't seem to find it anywhere. Is the unit used in Gwei or in Eth?



      For example when writing :



      stateDb, err := state.New(rootHash, db)
      if err!=nil
      return err

      addressA := common.HexToAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")

      stateDb.SetBalance(addressA, big.NewInt(1000))


      do we get 1000 eth or 1000 wei?



      Any help appreciated







      solidity go-ethereum ether






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 25 at 18:12







      Solerus

















      asked Jan 25 at 17:51









      SolerusSolerus

      656




      656




















          2 Answers
          2






          active

          oldest

          votes


















          2














          From state_object.go, the state code deals with the following account representation:



          // Account is the Ethereum consensus representation of accounts.
          // These objects are stored in the main account trie.
          type Account struct
          Nonce uint64
          Balance *big.Int
          Root common.Hash // merkle root of the storage trie
          CodeHash byte



          setBalance() works on this representation of Balance.



          The state representation in the code is a direct implementation of the specification in the Yellow Paper. The description of world state in section 4.1 of the Yellow Paper has this to say:




          balance: A scalar value equal to the number of Wei owned by this
          address







          share|improve this answer


















          • 1





            No problem, glad it helped :-)

            – Richard Horrocks
            Jan 25 at 18:19


















          1














          It is impossible to answer without more information or code to see.



          However, it is likely in wei. All values in Solidity are in wei, unless they are suffixed with a keyword such as ether, szabo, or finney.






          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%2f66146%2fwhat-is-the-unit-used-when-using-the-setbalance-function-of-the-state-package%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            From state_object.go, the state code deals with the following account representation:



            // Account is the Ethereum consensus representation of accounts.
            // These objects are stored in the main account trie.
            type Account struct
            Nonce uint64
            Balance *big.Int
            Root common.Hash // merkle root of the storage trie
            CodeHash byte



            setBalance() works on this representation of Balance.



            The state representation in the code is a direct implementation of the specification in the Yellow Paper. The description of world state in section 4.1 of the Yellow Paper has this to say:




            balance: A scalar value equal to the number of Wei owned by this
            address







            share|improve this answer


















            • 1





              No problem, glad it helped :-)

              – Richard Horrocks
              Jan 25 at 18:19















            2














            From state_object.go, the state code deals with the following account representation:



            // Account is the Ethereum consensus representation of accounts.
            // These objects are stored in the main account trie.
            type Account struct
            Nonce uint64
            Balance *big.Int
            Root common.Hash // merkle root of the storage trie
            CodeHash byte



            setBalance() works on this representation of Balance.



            The state representation in the code is a direct implementation of the specification in the Yellow Paper. The description of world state in section 4.1 of the Yellow Paper has this to say:




            balance: A scalar value equal to the number of Wei owned by this
            address







            share|improve this answer


















            • 1





              No problem, glad it helped :-)

              – Richard Horrocks
              Jan 25 at 18:19













            2












            2








            2







            From state_object.go, the state code deals with the following account representation:



            // Account is the Ethereum consensus representation of accounts.
            // These objects are stored in the main account trie.
            type Account struct
            Nonce uint64
            Balance *big.Int
            Root common.Hash // merkle root of the storage trie
            CodeHash byte



            setBalance() works on this representation of Balance.



            The state representation in the code is a direct implementation of the specification in the Yellow Paper. The description of world state in section 4.1 of the Yellow Paper has this to say:




            balance: A scalar value equal to the number of Wei owned by this
            address







            share|improve this answer













            From state_object.go, the state code deals with the following account representation:



            // Account is the Ethereum consensus representation of accounts.
            // These objects are stored in the main account trie.
            type Account struct
            Nonce uint64
            Balance *big.Int
            Root common.Hash // merkle root of the storage trie
            CodeHash byte



            setBalance() works on this representation of Balance.



            The state representation in the code is a direct implementation of the specification in the Yellow Paper. The description of world state in section 4.1 of the Yellow Paper has this to say:




            balance: A scalar value equal to the number of Wei owned by this
            address








            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 25 at 18:17









            Richard HorrocksRichard Horrocks

            21.8k947101




            21.8k947101







            • 1





              No problem, glad it helped :-)

              – Richard Horrocks
              Jan 25 at 18:19












            • 1





              No problem, glad it helped :-)

              – Richard Horrocks
              Jan 25 at 18:19







            1




            1





            No problem, glad it helped :-)

            – Richard Horrocks
            Jan 25 at 18:19





            No problem, glad it helped :-)

            – Richard Horrocks
            Jan 25 at 18:19











            1














            It is impossible to answer without more information or code to see.



            However, it is likely in wei. All values in Solidity are in wei, unless they are suffixed with a keyword such as ether, szabo, or finney.






            share|improve this answer



























              1














              It is impossible to answer without more information or code to see.



              However, it is likely in wei. All values in Solidity are in wei, unless they are suffixed with a keyword such as ether, szabo, or finney.






              share|improve this answer

























                1












                1








                1







                It is impossible to answer without more information or code to see.



                However, it is likely in wei. All values in Solidity are in wei, unless they are suffixed with a keyword such as ether, szabo, or finney.






                share|improve this answer













                It is impossible to answer without more information or code to see.



                However, it is likely in wei. All values in Solidity are in wei, unless they are suffixed with a keyword such as ether, szabo, or finney.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 25 at 18:03









                shaneshane

                1,8414730




                1,8414730



























                    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%2f66146%2fwhat-is-the-unit-used-when-using-the-setbalance-function-of-the-state-package%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

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?