func Public(PrivateKey
string) (publicKey
string) {
var e ecdsa.PrivateKey
e.D, _ = new(big.Int).SetString(PrivateKey, 16)
e.PublicKey.Curve = secp256k1.S256()
e.PublicKey.X, e.PublicKey.Y = e.PublicKey.Curve.ScalarBaseMult(e.D.Bytes())
return fmt.Sprintf("%x", elliptic.MarshalCompressed(secp256k1.S256(), e.X, e.Y))
_________________________________________________________________________________________
i tried this
package main
import
func Public(PrivateKey string) (publicKey string) {
var e ecdsa.PrivateKey
e.D, _ = new(big.Int).SetString(PrivateKey, 16)
e.PublicKey.Curve = secp256k1.S256()
e.PublicKey.X, e.PublicKey.Y = e.PublicKey.Curve.ScalarBaseMult(e.D.Bytes())
return fmt.Sprintf("%x", elliptic.MarshalCompressed(secp256k1.S256(), e.X, e.Y))
}
func main() {
count, one := big.NewInt(1), big.NewInt(1)
count.SetString("9404625697166532776746648320380374280100293470930272690489102837043110636674",10)
PrivateKey := make([]byte, 32)
for {
count.Add(count, one)
copy(PrivateKey[32-len(count.Bytes()):], count.Bytes())
fmt.Printf("%x\n",Public(PrivateKey))
}
}
_______________________________________________________________________________________
output: ./ keysgo.go: 33: 33: unable to use PrivateKey (type [] byte) as type string in argument in Public
_______________________________________________________________________________________
I hope for your help. A thousand thanks