Content
@
0 reply
0 recast
0 reaction
christopher
@christopher
Getting the wei balance of a wallet using go-ethereum is easy! All you have to do is: func etherToWei(eth *big.Float) *big.Int { truncInt, _ := eth.Int(nil) truncInt = new(big.Int).Mul(truncInt, big.NewInt(params.Ether)) fracStr := strings.Split(fmt.Sprintf("%.18f", eth), ".")[1] fracStr += strings.Repeat("0", 18 - len(fracStr)) fracInt, _ := new(big.Int).SetString(fracStr, 10) wei := new(big.Int).Add(truncInt, fracInt) return wei; } and then just use the result.
7 replies
1 recast
25 reactions
Jacob
@jrf
0 reply
0 recast
1 reaction