Bitcoin Forum
April 25, 2024, 09:05:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 4 »  All
  Print  
Author Topic: NBitcoin : Stealth Address, DarkWallet compliant  (Read 3363 times)
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 20, 2014, 01:31:05 PM
 #21

Have you done the same error on the previous transaction we made ?
Maybe something does not work right and I need further testing.

No, the previous two transaction were just broken, as far as I can check it.

The third one is fine, though - I received it with no problems and no modifications in my software.

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
1714035903
Hero Member
*
Offline Offline

Posts: 1714035903

View Profile Personal Message (Offline)

Ignore
1714035903
Reply with quote  #2

1714035903
Report to moderator
1714035903
Hero Member
*
Offline Offline

Posts: 1714035903

View Profile Personal Message (Offline)

Ignore
1714035903
Reply with quote  #2

1714035903
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714035903
Hero Member
*
Offline Offline

Posts: 1714035903

View Profile Personal Message (Offline)

Ignore
1714035903
Reply with quote  #2

1714035903
Report to moderator
1714035903
Hero Member
*
Offline Offline

Posts: 1714035903

View Profile Personal Message (Offline)

Ignore
1714035903
Reply with quote  #2

1714035903
Report to moderator
1714035903
Hero Member
*
Offline Offline

Posts: 1714035903

View Profile Personal Message (Offline)

Ignore
1714035903
Reply with quote  #2

1714035903
Report to moderator
Nicolas Dorier (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 20, 2014, 01:48:56 PM
 #22

Have you done the same error on the previous transaction we made ?
Maybe something does not work right and I need further testing.

No, the previous two transaction were just broken, as far as I can check it.

The third one is fine, though - I received it with no problems and no modifications in my software.

The first one broken.
The second one, I juste did double spent because I sent the third one just after on the same out.

The third one worked. I will make more unit tests.

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
Nicolas Dorier (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 20, 2014, 02:30:02 PM
 #23

piotr, I improved my tests and don't find any bug on it.
I don't find the reason why the first transaction would fail.

I will generate a bunch of transaction to your stealth address later today, and we'll see if they all get through.

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
May 25, 2014, 03:52:45 PM
 #24

piotr, I improved my tests and don't find any bug on it.
I don't find the reason why the first transaction would fail.

I will generate a bunch of transaction to your stealth address later today, and we'll see if they all get through.


maybe piotr you are missing a modulo somewhere in your recovery code. Usually when something in bitcoin works some of the time, I find it's because you didn't mod p somewhere.

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 25, 2014, 04:28:24 PM
 #25

No I don't think there is anything wrong in my implementation.
Besides non-zero length prefixes, I have tested it quite much.

I can exchange coins via stealth addresses between DarkWallet and my s/w, including several sends in a single tx, and they never got missed.
So I guess it means that my implementation works?

I think it is more likely that Nicolas did something wrong during the first send.
We can try few more times though, if he wants, just to be sure.
I'm always open for more testing.


BTW, @dabura667, are you working on supporting non-zero length prefixes?
I'd like to test it against a different wallet as well.

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
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
May 26, 2014, 12:04:17 PM
Last edit: May 26, 2014, 12:32:27 PM by dabura667
 #26

No I don't think there is anything wrong in my implementation.
Besides non-zero length prefixes, I have tested it quite much.

I can exchange coins via stealth addresses between DarkWallet and my s/w, including several sends in a single tx, and they never got missed.
So I guess it means that my implementation works?

I think it is more likely that Nicolas did something wrong during the first send.
We can try few more times though, if he wants, just to be sure.
I'm always open for more testing.


BTW, @dabura667, are you working on supporting non-zero length prefixes?
I'd like to test it against a different wallet as well.

I've only got sending working for Electrum. But yes, I have non-zero prefixes working for sending bitcoins.

Unfortunately, Electrum does not have testnet functionality, so I had to sacrifice 40 cents while experimenting.

Edit: Here's how I got it done in Python.

Code:
def check_prefix(pre_num, prefix, p_hash): # Check the first 'pre_num' bits of both 'prefix' and 'p_hash' and see if they match
    assert len(prefix) * 8 >= pre_num, "prefix length too large"
    byte_pos = 0
    while pre_num > 8: # This compares the first complete bytes as bytes if the pre_num is higher than 8 bits
        if prefix[byte_pos] != p_hash[byte_pos]:
            return False
        pre_num = pre_num - 8
        byte_pos = byte_pos + 1
    mask_prefix = (((1 << (8 - pre_num)) - 1) ^ 0xff) & int(prefix[byte_pos].encode('hex'), 16)
    mask_hash = (((1 << (8 - pre_num)) - 1) ^ 0xff) & int(p_hash[byte_pos].encode('hex'), 16)
    if mask_prefix == mask_hash: # In order to check only the first 'prebits' bits of the byte, we mask both bytes to change all bits past 'prebits' length to 0
        return True
    else:
        return False

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 12:08:17 PM
 #27

Unfortunately, Electrum does not have testnet functionality, so I had to sacrifice 40 cents while experimenting.
That should motivate you to add testnet support there, at some point Wink

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
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
May 26, 2014, 12:33:43 PM
 #28

Unfortunately, Electrum does not have testnet functionality, so I had to sacrifice 40 cents while experimenting.
That should motivate you to add testnet support there, at some point Wink
That would involve messing with the servers... and I'm not near good enough to add testnet support to the Electrum server repo...

heck, I'm not even good enough to do anything... but I do the best I can. :-)

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 12:42:34 PM
 #29

Unfortunately, Electrum does not have testnet functionality, so I had to sacrifice 40 cents while experimenting.
That should motivate you to add testnet support there, at some point Wink
That would involve messing with the servers... and I'm not near good enough to add testnet support to the Electrum server repo...

heck, I'm not even good enough to do anything... but I do the best I can. :-)

oh, don't be so modest.

you are certainly good enough to be a pioneer of implementing the stealth payments Smiley

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)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 26, 2014, 03:06:15 PM
 #30

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)

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 03:09:11 PM
 #31

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.

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)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 26, 2014, 03:21:16 PM
 #32

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

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 03:23:31 PM
 #33

ok.
in case if they got mined, let me know.

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)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 26, 2014, 03:23:59 PM
 #34

already mined oO
And already 3 confirmation... wow what's going on on testnet.

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 03:24:10 PM
 #35

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

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)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 26, 2014, 03:29:35 PM
 #36

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

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 03:36:25 PM
 #37

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?

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)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 26, 2014, 03:39:14 PM
 #38

Them EphemKey was 23eef32c39ccfd1267f0cd45841dc5bf8deae0184dad16993949d1707c4fb9b6
I'm checking the result against sx, one moment.

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 03:41:28 PM
 #39

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.

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 Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
May 26, 2014, 03:45:03 PM
 #40

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?

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
Pages: « 1 [2] 3 4 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!