package main import ( "encoding/hex" "fmt" "github.com/ava-labs/avalanchego/utils/crypto" ) func main() { // Hexadecimal private key privateKeyHex := "eeac0e3d8f0fcc32a553cc5ab8dad48a435bb4c047d95b06eb7a29a4a823e87c" // Parse the private key privateKeyBytes, _ := hex.DecodeString(privateKeyHex) // Create a new private key object from the parsed bytes // factory := &FactorySECP256K1R{} factory := &crypto.FactorySECP256K1R{} privateKey, err := factory.ToPrivateKey(privateKeyBytes) if err != nil { panic(err) } // Print the private key in hex format fmt.Printf("Private key: %x\n", privateKeyBytes) // Derive the public key from the private key publicKey := privateKey.PublicKey() // Print the public key in hex format fmt.Printf("Public key: %x\n", publicKey.Bytes()) // Sign a message using the private key message := []byte("avalanchesignature") signature, err := privateKey.Sign(message) if err != nil { panic(err) } // Parse the signature // r, s, v, err := parseSignature(signature) // if err != nil { // panic(err) // } // Print the signature and its components fmt.Printf("Signature: %x\n", signature) // fmt.Printf("r: %d\n", r) // fmt.Printf("s: %x\n", s) // fmt.Printf("v: %d\n", v) }