package main import ( "fmt" "github.com/skycoin/skycoin/src/cipher" "log" ) func main() { // This is your private/public key pair. You give them the public key pubkey1, seckey1, err := cipher.GenerateDeterministicKeyPair([]byte("Password")) if err != nil { log.Fatal(err) } // This is their key pair pubkey2, seckey2 := cipher.GenerateKeyPair() // They communicate pubkey2, by for instance using it as the first destination for coins in a transaction // You know pubkey2, and seckey1/pubkey1 // They know your pubkey, pubkey1 and know their seckey seckey2/pubkey2 // Your computer // Use your private key and the pubkey they gave you secret1, err := cipher.ECDH(pubkey2, seckey1) if err != nil { log.Fatal(err) } // Their computer // They use your pubkey and their private key secret2, err := cipher.ECDH(pubkey1, seckey2) if err != nil { log.Fatal(err) } // Now you may compute an address from the secrets pubkey3, _, err := cipher.GenerateDeterministicKeyPair(secret1) if err != nil { log.Fatal(err) } address1 := cipher.AddressFromPubKey(pubkey3) // send coins here // Now you may compute an address from the them pubkey4, _, err := cipher.GenerateDeterministicKeyPair(secret2) if err != nil { log.Fatal(err) } address2 := cipher.AddressFromPubKey(pubkey4) // send coins here if address1 == address2 { fmt.Printf("%s\n%s", address1, address2) } else { fmt.Println("Addresses don't match!") } }