What is the unit used when using the SetBalance() function of the state package?
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
add a comment |
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
add a comment |
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
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
solidity go-ethereum ether
edited Jan 25 at 18:12
Solerus
asked Jan 25 at 17:51
SolerusSolerus
656
656
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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
1
Thank you very much!
– Solerus
Jan 25 at 18:19
1
No problem, glad it helped :-)
– Richard Horrocks
Jan 25 at 18:19
add a comment |
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
.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
1
Thank you very much!
– Solerus
Jan 25 at 18:19
1
No problem, glad it helped :-)
– Richard Horrocks
Jan 25 at 18:19
add a comment |
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
1
Thank you very much!
– Solerus
Jan 25 at 18:19
1
No problem, glad it helped :-)
– Richard Horrocks
Jan 25 at 18:19
add a comment |
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
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
answered Jan 25 at 18:17
Richard HorrocksRichard Horrocks
21.7k946101
21.7k946101
1
Thank you very much!
– Solerus
Jan 25 at 18:19
1
No problem, glad it helped :-)
– Richard Horrocks
Jan 25 at 18:19
add a comment |
1
Thank you very much!
– Solerus
Jan 25 at 18:19
1
No problem, glad it helped :-)
– Richard Horrocks
Jan 25 at 18:19
1
1
Thank you very much!
– Solerus
Jan 25 at 18:19
Thank you very much!
– Solerus
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
add a comment |
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered Jan 25 at 18:03
shaneshane
1,7564730
1,7564730
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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