Pages:
Author

Topic: NBitcoin : Stealth Address, DarkWallet compliant - page 2. (Read 3383 times)

legendary
Activity: 2053
Merit: 1354
aka tonikt
I fixed my response, yes this is problematic since I don't think it is good to break existing clients and scanners.
Maybe the scanner will need to handle both case Sad
nobody really uses stealth addresses yet - I don't mind changing my scanner.
it's better to do it now than to wait longer or (even worse) to check for both the values.
there are obviously two different approaches which are compatible only in 50% of cases.

I wonder which of the two is in Electrum.
hero member
Activity: 714
Merit: 661
I fixed my response, yes this is problematic since I don't think it is good to break existing clients and scanners.
Maybe the scanner will need to handle both case Sad
legendary
Activity: 2053
Merit: 1354
aka tonikt
yeah I also asked it at #darkwallet, but ATM there isn't anyone around to answer

yes - except that the value is 0x03, not 0x02:
Code:
var pBytes = new PubKey(p.GetEncoded()).Compress().ToBytes();
pBytes[0] = 0x03;
var hash = Hashes.SHA256(pBytes);

I'm happy to change it in my code, but first let's figure out which approach is the desired one
hero member
Activity: 714
Merit: 661
he is afk for now.
So if I understand, the difference lies when I calculate the shared secret after the EC multiply.

My code and SX :
Code:
var pBytes = new PubKey(p.GetEncoded()).Compress().ToBytes();
var hash = Hashes.SHA256(pBytes);

DW :

Code:
var pBytes = new PubKey(p.GetEncoded()).Compress().ToBytes();
pBytes[0] = 0x03;
var hash = Hashes.SHA256(pBytes);

It about :
c = H(eQ) = H(dP) at https://wiki.unsystem.net/index.php/DarkWallet/Stealth#Dual-key_stealth
legendary
Activity: 2053
Merit: 1354
aka tonikt
ok. let me know what you found.

sent you back the coins.
hero member
Activity: 714
Merit: 661
need to ask to genjix on irc, i'll contact him.

mwdJkHRNJi1fEwHBx6ikWFFuo2rLBdri2h
legendary
Activity: 2053
Merit: 1354
aka tonikt
I think your/sx implementation makes more sense, but if I make it like this I won't be DW compatible anymore.

Look at line 42: https://github.com/darkwallet/darkwallet/blob/develop/js/util/stealth.js
... and here, line 99: https://github.com/libbitcoin/libwallet/blob/master/src/stealth.cpp

These two functions are compatible only in 50% of the cases.
legendary
Activity: 2053
Merit: 1354
aka tonikt
What is your address?

It seems like the implantation in sx is different from the one in DW.
DW always overwrites 02 with 03 before hashing it.
sx - doesnt seem so; takes either 02 or 03, depending how it came out.
Now we need to figure how it should be.
hero member
Activity: 714
Merit: 661
dont ask me why it is always 03 - it is also strange for me.

but now at least I know how to recover the coins we lost before.
where do you want them?

You can send back to me.
However your result is not consistent with SX why is it the case ? Which one to trust ?
hero member
Activity: 714
Merit: 661
Just checked

Code:
Usage: sx stealth-uncover EPHEM_PUBKEY SCAN_SECRET SPEND_PUBKEY
NICO@aois-linux2:~$ sx stealth-uncover 02d3a7c713f0fb9eadaf23d121f5f66a11f4ca780a353ecb1c88ae48646529e1d6 cc411aab02edcd3bccf484a9ba5280d4a774e6f81eac8ebec9cb1c2e8f73020a  02a60d70cfba37177d8239d018185d864b2bdd0caf5e175fd4454cc006fd2d75ac
02bbc9fccbe03de928fc66fcd176fbe69d3641677970c6f8d558aa72f72e35e0cb

Which is the address where I sent.
legendary
Activity: 2053
Merit: 1354
aka tonikt
dont ask me why it is always 03 - it is also strange for me.

but now at least I know how to recover the coins we lost before.
where do you want them?
legendary
Activity: 2053
Merit: 1354
aka tonikt
I think I know what is your problem.

The sha256 hashing that you do at the EphemKey
Before hashing it always has 03 byte in front, despite whether the calculated key had 02 or 03.
hero member
Activity: 714
Merit: 661
Them EphemKey was 23eef32c39ccfd1267f0cd45841dc5bf8deae0184dad16993949d1707c4fb9b6
I'm checking the result against sx, one moment.
legendary
Activity: 2053
Merit: 1354
aka tonikt
Can you check what is going on with txid 7efb90526034f0eac6b4f897ea0dcf617b03b29e8b0b4f1660b1fb76740b45f1

the metadata:
Code:
0600000000:02d3a7c713f0fb9eadaf23d121f5f66a11f4ca780a353ecb1c88ae48646529e1d6

...multiplied with the secret scan key:
Code:
cc411aab02edcd3bccf484a9ba5280d4a774e6f81eac8ebec9cb1c2e8f73020a

... comes down to the secret C of:
Code:
ba05b377c50e08b4ad293d58f6e1c494c2e55c829a12c7a289ae015d307193f7

.. and this tells me to expect the coins at address mhBmC8iBR422X5mUYZ2NqT4qin8rGrmMgj (key: 03f6ceafe6669e8c8d0439bbbd4c644779b6ab98b077d61e9d26492ee4d026e217)
your coins went to: mh1A4K7kK5wr7WxCNaHuzhC4LDU8TseBnU

would you like me to expand all the steps, how it goes to it?
hero member
Activity: 714
Merit: 661
There is something waky here... (7 of 13 worked)
Can you check what is going on with txid 7efb90526034f0eac6b4f897ea0dcf617b03b29e8b0b4f1660b1fb76740b45f1

http://blockexplorer.com/testnet/tx/7efb90526034f0eac6b4f897ea0dcf617b03b29e8b0b4f1660b1fb76740b45f1
legendary
Activity: 2053
Merit: 1354
aka tonikt
I received 7 of them

Code:
21 245388 2014/05/26 17:28 21af862200c988833069cd2f03c2d71204b17ac927a134b918289ad91d6f0702 1 0.04615384 @mmFbAfaoku8yiFm29FMzaWs1KjWmR97Gp1
22 245388 2014/05/26 17:28 26edb0e8fe514d687a747643c909da55cd528fe6707727cfc42cf93eb29830aa 1 0.04615384 @mhvGm1Jn1A34zeRpde1DyjN2bqyBdybQP5
23 245388 2014/05/26 17:28 3f65e6bb638e9cbb03a6faa5f6ecda63b68ce7a170415e3fd7043117b4bf315f 1 0.04615384 @muKQnGmRv5LRw74nHUNYjrP5nexU6NoKKk
24 245388 2014/05/26 17:28 405842102fd3ca84784be5ea4401185a0063f0335090ebd7350430e41bac5128 1 0.04615384 @mp7JcYzerKnFjf8sVPesr8ing7XEwpvWEK
25 245388 2014/05/26 17:28 5f951ff1f7b33d315b7c8e6b650a0ed4803f4d4b9980b16dc0ab28be3d62f6f0 1 0.04615384 @n4grftiTd4VuFAbBwTNcr62RBvyQ3UKyQn
26 245388 2014/05/26 17:28 a655de23abb19fb8c006acc6687c5c810390d4dc58fc658040a1cd19be507b26 1 0.04615384 @mtJoTeZ7MdS2mh1anzAGD9PoEXiucm8ixq
27 245388 2014/05/26 17:28 cb51a3ec324996633613f9ef2aff0971c1430b9460fd75a6ebfff343f1e31870 1 0.04615384 @mngp9i8D9nYv6y4EqPVeZyNa1iajNVE2mj
hero member
Activity: 714
Merit: 661
already mined oO
And already 3 confirmation... wow what's going on on testnet.
legendary
Activity: 2053
Merit: 1354
aka tonikt
ok.
in case if they got mined, let me know.
hero member
Activity: 714
Merit: 661
ok all sent, you should get in a block in one hour or more. I did not included fees.
I have all my ephem keys
legendary
Activity: 2053
Merit: 1354
aka tonikt
piotr_n,
I am going to send 13 transactions to waPYjXyrTrvXjZHmMGdqs9YTegpRDpx97H5G3xqLehkgyrrZKsxGCmnwKexpZjXTCskUWwYywdUvrZK 7L2vejeVZSYHVns61gm8VfU
Do you confirm you have the spend priv key and scan priv key ?
(Scan = cc411aab02edcd3bccf484a9ba5280d4a774e6f81eac8ebec9cb1c2e8f73020a)
yes - go ahead, send.
Pages:
Jump to: