SatoshiTURK
Programmer
- BNB
- 0,00965879
Go dili ile ethereum kütüphanelerinden faydalanarak adres ve privatekey üretme.
Çıktısı
package main
import (
"crypto/ecdsa"
"fmt"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
func main() {
privateKey, _ := crypto.GenerateKey()
privateKeyBytes := crypto.FromECDSA(privateKey)
privkey := hexutil.Encode(privateKeyBytes)
publicKey := privateKey.Public()
publicKeyECDSA, _ := publicKey.(*ecdsa.PublicKey)
newAddress := crypto.PubkeyToAddress(*publicKeyECDSA).Hex()
fmt.Println("Private Key: ", privkey, "\nPublic Address: ", newAddress)
}
Çıktısı