|
|
|
@ -8,6 +8,7 @@ import ( |
|
|
|
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/ethereum/go-ethereum/common/math" |
|
|
|
"github.com/ethereum/go-ethereum/common/math" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var Ether = math.BigPow(10, 18) |
|
|
|
var Ether = math.BigPow(10, 18) |
|
|
|
@ -35,7 +36,7 @@ func MakeTimestamp() int64 { |
|
|
|
func GetTargetHex(diff int64) string { |
|
|
|
func GetTargetHex(diff int64) string { |
|
|
|
difficulty := big.NewInt(diff) |
|
|
|
difficulty := big.NewInt(diff) |
|
|
|
diff1 := new(big.Int).Div(pow256, difficulty) |
|
|
|
diff1 := new(big.Int).Div(pow256, difficulty) |
|
|
|
return string(common.ToHex(diff1.Bytes())) |
|
|
|
return string(hexutil.Encode(diff1.Bytes())) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TargetHexToDiff(targetHex string) *big.Int { |
|
|
|
func TargetHexToDiff(targetHex string) *big.Int { |
|
|
|
|