An example (available from gobittest website):
We have a private key:
18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725
which maps to public key:
0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A 299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
and say we want to find a pattern "166". One of the solutions takes a form of a private key
B18427B169E86DE681A1A62588E1D02AE4A7E83C1B413849989A76282A7B562F
mapping to public key:
049C95E0949E397FACCECF0FE8EAD247E6FD082717E4A4A876049FB34A9ADED110DFEA2EF691CC4 A1410498F4C312F3A94318CD5B6F0E8E92051064876751C8404
If we add the two public keys (like the person looking for the solution would do), we get a public key:
0436970CE32E14DC06AC50217CDCF53E628B32810707080D6848D9C8D4BE9FE461E100E705CCA98 54436A1283210CCEFBB6B16CB9A86B009488922A8F302A27487
which is equivalent to this address:
166ev9JXn2rFqiPSQAwM7qJYpNL1JrNf3h
If we add the two private keys (like the person requesting the address would), we get:
CA65722CD418ED28EC369E36CFE3B7F3CC1CD035BFBF6469CE759FCA30AD6D54
which maps to the same public key as the sum of the public keys, and thus - to the same address.
If we add the two public keys (like the person looking for the solution would do), we get a public key:
0436970CE32E14DC06AC50217CDCF53E628B32810707080D6848D9C8D4BE9FE461E100E705CCA98 54436A1283210CCEFBB6B16CB9A86B009488922A8F302A27487
which is equivalent to this address:
166ev9JXn2rFqiPSQAwM7qJYpNL1JrNf3h
how?0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A 299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA
6+
049C95E0949E397FACCECF0FE8EAD247E6FD082717E4A4A876049FB34A9ADED110DFEA2EF691CC4 A1410498F4C312F3A94318CD5B6F0E8E92051064876751C840
4=
0436970CE32E14DC06AC50217CDCF53E628B32810707080D6848D9C8D4BE9FE461E100E705CCA98 54436A1283210CCEFBB6B16CB9A86B009488922A8F302A2748
7how to calculate it ? the last number 6+4=7? not 6+4=a?Curve secp256k1:
base point :
G = (79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B 16F81798, 483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8)
order curve:
n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBAAEDCE6AF48A03BBFD25E8CD0364141
First private key :
a = 18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725
First public key :
A = a*G = (50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A, 299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6)
see for yourself here -->
https://gobittest.appspot.com/AddressSecond private key :
b = B18427B169E86DE681A1A62588E1D02AE4A7E83C1B413849989A76282A7B562F
Second public key :
B =b*G=(36970CE32E14DC06AC50217CDCF53E628B32810707080D6848D9C8D4BE9FE461E100E705CCA98, 54436A1283210CCEFBB6B16CB9A86B009488922A8F302A27487)
If we add the two private keys :
a+b = CA65722CD418ED28EC369E36CFE3B7F3CC1CD035BFBF6469CE759FCA30AD6D54
~$ python
Python 2.7.12+ (default, Sep 17 2016, 12:08:02)
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=0x18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725
>>> b=0xB18427B169E86DE681A1A62588E1D02AE4A7E83C1B413849989A76282A7B562F
>>> n=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 #order curve
>>> print hex((a+b) % n) # add mod 'n'
0xca65722cd418ed28ec369e36cfe3b7f3cc1cd035bfbf6469ce759fca30ad6d54
and if we add the two public keys:
A+B = a*G + b*G = (a+b)*G
see for yourself here -->
https://gobittest.appspot.com/Address(a+b)*G = (36970CE32E14DC06AC50217CDCF53E628B32810707080D6848D9C8D4BE9FE461, E100E705CCA9854436A1283210CCEFBB6B16CB9A86B009488922A8F302A27487)
and the address is: 166ev9JXn2rFqiPSQAwM7qJYpNL1JrNf3h