Nicolas Dorier (OP)
|
|
May 19, 2014, 08:57:15 AM Last edit: May 19, 2014, 09:17:59 AM by Nicolas Dorier |
|
I finished implementing StealthAddress in NBitcoin. Key scan = new Key(); Key spend = new Key(); BitcoinStealthAddress address = spend.PukKey.CreateStealthAddress(scan.PubKey,Network.Main); //The receiver publish the address on a forum or whatever.... //Sender then create payment Key ephem = new Key(); //Optional, CreatePayment create one if not specified StealthPayment payment = address.CreatePayment(ephem); //In you want to include the payment to a transaction Transaction tx = new Transaction(); payment.AddToTransaction(tx); //Receiver receive the payment via the block chain with (address.Bitfield.GetPayments(tx)) Key key = spend.Uncover(scan,payment.Metadata.EphemKey); //Or, if you just want the public key (equals to key.PubKey) PubKey pubkey = spend.PubKey.UncoverReceiver(scan, payment.Metadata.EphemKey);
You can replay these steps in parallel with sx to verify the implementation. There is a deterministic unit test for that : https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin.Tests/StealthAddressTests.cs#L179Enjoy, Github : https://github.com/NicolasDorier/NBitcoinNuget : Install-Package NBitcoin
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
Nicolas Dorier (OP)
|
|
May 19, 2014, 04:31:36 PM |
|
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 19, 2014, 08:18:16 PM |
|
cool. let's test it. can you send me some test coins and give the address where to send them back? waPV5rHToBq3NoR7y5J9UdE7aUbuqJybNpE88Dve7WgWhEfvMrcuaSvF6tSQ3Fbe8dErL6ks8byJPcp3QCK2HHviGCSjg42VgMAPJb btw, do you support prefix length other than 0?
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Nicolas Dorier (OP)
|
|
May 19, 2014, 11:45:29 PM |
|
yes it supports prefix. TestNet is unavailable at my place, the dns seed nodes seems down ?! Try to send this transaction to the TestNet, it should works if I did not made a mistake on the sig part. 0100000001695f9c647d044563d2fff95fba1bd5cf1d35d75611ddbd8b1da80a4dff7aa8a000000 0006a47304402200e583af51ef57334f0c830e85bb809c7a23f4fbdd6d5557dbec1a2216c578bee 02203c54f1c2205ab0c21a511cbd1a2006bc339693d329cee7fb881aae44c6323dee012102ccea4 5d5eb89ea63dee2dd567beef6dd38b2edb3ebf3d85ef45c537ff1af1bbcffffffff020000000000 000000286a26060000000002704f9c99117ba90b162859e1f5f21c7e1805bc6c0594cc4e5a3dadf adf2c17bbc056fe03000000001976a9148f1516c7c20207a22940133f878351ac3681b56b88ac00 000000 All of these are down for me vFixedSeeds.Add(new NetworkAddress() { Endpoint = new IPEndPoint(IPAddress.Parse("109.123.116.245").MapToIPv6(), 18333) }); vSeeds.Clear(); vSeeds.Add(new DNSSeedData("bitcoin.petertodd.org", "testnet-seed.bitcoin.petertodd.org")); vSeeds.Add(new DNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); vSeeds.Add(new DNSSeedData("Blockexplorer.com", "blockexplorer.com"));
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 08:13:33 AM |
|
Try to send this transaction to the TestNet, it should works if I did not made a mistake on the sig part. It says the signature of your tx is invalid. Here is the list of 90 testnet peers from my db: 95.85.39.28 18333 46.4.106.234 18333 94.102.53.181 18333 5.135.159.139 18333 188.226.138.211 18333 188.165.238.173 18333 46.28.204.15 18333 109.201.135.216 18333 5.9.2.145 18333 46.182.106.2 18333 109.201.154.201 18333 188.165.246.217 18333 108.62.62.235 18333 184.107.180.2 18333 198.50.215.81 18333 188.226.176.87 18333 75.6.237.138 18333 93.93.135.12 18333 54.208.21.132 18333 107.170.107.245 18333 188.230.215.236 18333 46.28.207.68 18333 178.63.106.253 18333 74.207.249.18 18333 54.209.7.19 18333 254.112.255.114 18333 162.216.6.146 18333 88.198.20.152 18333 54.72.131.178 18333 54.84.19.8 18333 162.243.123.220 18333 87.230.26.205 18333 178.63.106.250 18333 78.46.97.16 18333 162.243.141.246 18333 221.249.5.50 18333 69.85.93.216 18333 5.9.119.49 18333 192.161.182.207 18333 37.59.58.130 18333 107.170.35.88 18333 144.76.175.228 18333 15.125.110.219 18333 178.63.14.7 18333 95.85.15.189 18333 117.241.136.198 18333 192.241.204.12 18333 188.122.92.134 18333 148.251.11.118 18333 54.206.106.94 18333 134.60.102.116 18333 54.215.172.225 18333 85.153.13.35 18333 119.81.66.229 18333 176.9.24.110 18333 54.252.141.122 18333 199.231.187.226 18333 162.242.155.221 18333 23.253.92.253 18333 116.24.15.116 18333 91.121.140.111 18333 46.4.120.71 18333 83.80.206.63 18333 94.190.126.105 18333 107.170.99.148 18333 148.251.236.175 18333 198.50.156.105 18333 137.117.217.85 18333 137.135.219.45 18333 212.108.45.54 18333 87.195.172.209 18333 115.118.49.234 18333 194.18.61.26 18333 41.164.148.82 18333 93.172.61.180 18333 85.17.26.225 18333 212.219.220.118 18333 137.190.79.169 18333 63.87.77.156 18333 146.185.169.56 18333 86.27.247.219 18333 162.242.154.199 18333 151.236.216.148 18333 71.94.45.245 18333 176.111.59.60 18333 80.86.232.251 18333 31.7.56.82 18333 107.170.113.154 18333 178.17.8.128 18333 105.224.102.106 18333
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 10:23:30 AM |
|
Thanks for the seed, I will send the transaction. I signed before adding the TxOut -_- 0100000001695f9c647d044563d2fff95fba1bd5cf1d35d75611ddbd8b1da80a4dff7aa8a000000 0006b483045022100ee96d1dbe442c1b0997526e3e66d188a9014bd0b9f39262498b2c8484520d3 49022070c0fb15145a453cf2151f7ee60d675fbf047afba1d0058ac704589fe07fdcc6012102cce a45d5eb89ea63dee2dd567beef6dd38b2edb3ebf3d85ef45c537ff1af1bbcffffffff0200000000 00000000286a26060000000003de307f3903d0cf32509c2964ea8fca2be9640dd14bc1233856aa8 0967e4e0debc056fe03000000001976a9140d31b807b4ce74cd9e1f7d0c888abbed8e30584788ac 00000000
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 10:52:51 AM |
|
sent, send back to msj42CCGruhRsFrGATiUuh25dtxYtnpbTx (tpfaucet)
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 10:59:39 AM |
|
ok - as soon as it arrives. but it hasn't yet.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 11:15:27 AM |
|
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 11:41:09 AM |
|
I don't think its correct. With the ephemkey key of: 024272e119d08015609528fb6e9841d9a432fe0d013d60d4f332104808088e7084 And my stealth address: waPV5rHToBq3NoR7y5J9UdE7aUbuqJybNpE88Dve7WgWhEfvMrcuaSvF6tSQ3Fbe8dErL6ks8byJPcp3QCK2HHviGCSjg42VgMAPJb Version: 0x2b = 43 Options: 0x00 = 0 scanKey: 026aa1512f0aa20a28ac2ed3fb660aea5cbee45ea6994e4ec790cad001cd5f2643 spndKey: 02a60d70cfba37177d8239d018185d864b2bdd0caf5e175fd4454cc006fd2d75ac sigNeed: 1 Prefix : /0 ... I would be expecting the next output going to mr7F6ALhcQhZay1ufXipnESkLEB5xXuV9S Your output goes to mk2BkyJyE8Fgzs9zpCodpG14TJQHpvUJ9s
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 11:56:21 AM |
|
Can I get your scan private key ? So I can verity with sx and also my framework what address it gives.
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 12:12:50 PM |
|
Can I get your scan private key ? So I can verity with sx and also my framework what address it gives.
Not that one, but I can generate a new address for you. waPYjXyrTrvXjZHmMGdqs9YTegpRDpx97H5G3xqLehkgyrrZKsxGCmnwKexpZjXTCskUWwYywdUvrZK7L2vejeVZSYHVns61gm8VfU Version: 0x2b = 43 Options: 0x00 = 0 scanKey: 0361e5c0bff39f18621693da42cd343d60e3e14b4e9eb46b220eb310a484fcebab spndKey: 02a60d70cfba37177d8239d018185d864b2bdd0caf5e175fd4454cc006fd2d75ac sigNeed: 1 Prefix : /0 its private scankey is: 0361e5c0bff39f18621693da42cd343d60e3e14b4e9eb46b220eb310a484fcebab
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 12:20:18 PM |
|
its private scankey is: 0361e5c0bff39f18621693da42cd343d60e3e14b4e9eb46b220eb310a484fcebab It is not a private key, you copied the pubkey. I made a new transfer on your old stealth: Stealth Addr : waPV5rHToBq3NoR7y5J9UdE7aUbuqJybNpE88Dve7WgWhEfvMrcuaSvF6tSQ3Fbe8dErL6ks8byJPcp 3QCK2HHviGCSjg42VgMAPJb Ephem : 9daed68ad37754305e82740a6252cf80765c36d29a55158b1a19ed29914f0cb1 Scan : 026aa1512f0aa20a28ac2ed3fb660aea5cbee45ea6994e4ec790cad001cd5f2643 Spend : 02a60d70cfba37177d8239d018185d864b2bdd0caf5e175fd4454cc006fd2d75ac PubKey Generated : 03b4e5d3cf889840c75f0dd02ebda946151bf37e56cb888c6002c2ae5288e56de7 ID Generated : 119787de5355172ff7934303c06967697699adb2 Addr : mh7yJrZN6LwCfHymnkxUYJfJxMBQN2HX7R TxId : 266703ce4092b03c4e2585af877eeab6ac6b77d0bf40bf05879e53bedc6e1fbe I cross checked with tx, my PubKey Generated seems fine.
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 12:21:05 PM |
|
sorry cc411aab02edcd3bccf484a9ba5280d4a774e6f81eac8ebec9cb1c2e8f73020a
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 12:24:20 PM |
|
its private scankey is: 0361e5c0bff39f18621693da42cd343d60e3e14b4e9eb46b220eb310a484fcebab It is not a private key, you copied the pubkey. I made a new transfer on your old stealth: Stealth Addr : waPV5rHToBq3NoR7y5J9UdE7aUbuqJybNpE88Dve7WgWhEfvMrcuaSvF6tSQ3Fbe8dErL6ks8byJPcp 3QCK2HHviGCSjg42VgMAPJb Ephem : 9daed68ad37754305e82740a6252cf80765c36d29a55158b1a19ed29914f0cb1 Scan : 026aa1512f0aa20a28ac2ed3fb660aea5cbee45ea6994e4ec790cad001cd5f2643 Spend : 02a60d70cfba37177d8239d018185d864b2bdd0caf5e175fd4454cc006fd2d75ac PubKey Generated : 03b4e5d3cf889840c75f0dd02ebda946151bf37e56cb888c6002c2ae5288e56de7 ID Generated : 119787de5355172ff7934303c06967697699adb2 Addr : mh7yJrZN6LwCfHymnkxUYJfJxMBQN2HX7R With 03b4e5d3cf889840c75f0dd02ebda946151bf37e56cb888c6002c2ae5288e56de7 I'd expect address mvXf4sF4C1w5KgQyasbEWxqVyqbLNtVdnY
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 12:34:08 PM |
|
With 03b4e5d3cf889840c75f0dd02ebda946151bf37e56cb888c6002c2ae5288e56de7 I'd expect address mvXf4sF4C1w5KgQyasbEWxqVyqbLNtVdnY
So you agree on the generated pubkey ? You algorithm to transform a pubkey in address does not seems right. (Hash160) I cross checked mine with brainwallet. Mine give 119787de5355172ff7934303c06967697699adb2
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 12:38:29 PM |
|
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 01:00:19 PM |
|
Yeah, this one is correct! I'm sending it back in tx c85b654a97f0ed150ff76b6c2ef50b9aa4a1911d7186d815be1c8c02dfcb3a81
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1356
aka tonikt
|
|
May 20, 2014, 01:04:44 PM |
|
With 03b4e5d3cf889840c75f0dd02ebda946151bf37e56cb888c6002c2ae5288e56de7 I'd expect address mvXf4sF4C1w5KgQyasbEWxqVyqbLNtVdnY
So you agree on the generated pubkey ? You algorithm to transform a pubkey in address does not seems right. (Hash160) I cross checked mine with brainwallet. Mine give 119787de5355172ff7934303c06967697699adb2 Oh, I had though the "public key" was the one you put after OP_RETURN. Never mind, though.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
Nicolas Dorier (OP)
|
|
May 20, 2014, 01:07:59 PM |
|
With 03b4e5d3cf889840c75f0dd02ebda946151bf37e56cb888c6002c2ae5288e56de7 I'd expect address mvXf4sF4C1w5KgQyasbEWxqVyqbLNtVdnY
So you agree on the generated pubkey ? You algorithm to transform a pubkey in address does not seems right. (Hash160) I cross checked mine with brainwallet. Mine give 119787de5355172ff7934303c06967697699adb2 Oh, I had though the "public key" was the one you put after OP_RETURN. Never mind, though. Have you done the same error on the previous transaction we made ? Maybe something does not work right and I need further testing.
|
Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
|
|
|
|