[ANN] libcoin rebase attempt

Namecoin, NMControl
jonasbits
Posts: 47
Joined: Tue Mar 04, 2014 4:47 pm
os: linux

Re: [ANN] libcoin rebase attempt

Post by jonasbits »

khal wrote:Full blocks (34714) are now downloaded ! :)

Next steps are to test all this, mining included, which requires adding the testnet difficulty adjustment (I didn't see it in the bitcoin testnet code, strange).

Edit: code is there : https://github.com/khalahan/libcoin/com ... ointestnet
Full testnet blocks (61858) is syncing Libcoind with 2 ugly hacks regarding "Network fee to small" (2507) and "Incorrect proof of work" (34715)

At height 34715 there is a chance of getting stuck in an invalid chain, there is one other node i have seen in the logs with only 34717 blocks. A checkpoint at 34715 helps to stop that from happening

Its not pretty, but it works :-) https://github.com/jonasbits/libcoin/tree/nmc-test-3
My Namecoin address: NC3HGHk527xuWZBgMdGJ2GxjpRSw8D4oA6

biolizard89
Posts: 2001
Joined: Tue Jun 05, 2012 6:25 am
os: linux

Re: [ANN] libcoin rebase attempt

Post by biolizard89 »

jonasbits wrote:
khal wrote:Full blocks (34714) are now downloaded ! :)

Next steps are to test all this, mining included, which requires adding the testnet difficulty adjustment (I didn't see it in the bitcoin testnet code, strange).

Edit: code is there : https://github.com/khalahan/libcoin/com ... ointestnet
Full testnet blocks (61858) is syncing Libcoind with 2 ugly hacks regarding "Network fee to small" (2507) and "Incorrect proof of work" (34715)

At height 34715 there is a chance of getting stuck in an invalid chain, there is one other node i have seen in the logs with only 34717 blocks. A checkpoint at 34715 helps to stop that from happening

Its not pretty, but it works :-) https://github.com/jonasbits/libcoin/tree/nmc-test-3
Interesting, thanks for working on this. I would like to see the hacks cleaned up (and vetted by domob) prior to merging, to make sure we're not introducing any exploitable bugs. Got any documentation on exactly what you had to do and why it was necessary?
Jeremy Rand, Lead Namecoin Application Engineer
NameID: id/jeremy
DyName: Dynamic DNS update client for .bit domains.

Donations: BTC 1EcUWRa9H6ZuWPkF3BDj6k4k1vCgv41ab8 ; NMC NFqbaS7ReiQ9MBmsowwcDSmp4iDznjmEh5

domob
Posts: 1129
Joined: Mon Jun 24, 2013 11:27 am
Contact:

Re: [ANN] libcoin rebase attempt

Post by domob »

Very cool! It would be more than welcome from my side if you could make testnet work - this will be a good basis for me to start (and test :D) the commands for transactions (name_new & friends) - I think they shouldn't be too much work if I can develop them efficiently with a testnet available.

Note that I recall khal writing something about getting stuck ... not sure whether he were able to resolve it in some other way. If you have a working patch, you should rather submit it to Michael Gronager than to me for review; I don't know the "core" libcoin parts (which are involved here for risk of possible exploits) as well as I know the Namecoin (or Bitcoin) code. Michael can surely answer better whether some change is ok or not. But if you want my review, I'll also look at it, of course.
BTC: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS
Use your Namecoin identity as OpenID: https://nameid.org/

biolizard89
Posts: 2001
Joined: Tue Jun 05, 2012 6:25 am
os: linux

Re: [ANN] libcoin rebase attempt

Post by biolizard89 »

jonasbits and I were able to find the reason one of the hacks was necessary. That's resolved; he should be posting new code soon.
Jeremy Rand, Lead Namecoin Application Engineer
NameID: id/jeremy
DyName: Dynamic DNS update client for .bit domains.

Donations: BTC 1EcUWRa9H6ZuWPkF3BDj6k4k1vCgv41ab8 ; NMC NFqbaS7ReiQ9MBmsowwcDSmp4iDznjmEh5

domob
Posts: 1129
Joined: Mon Jun 24, 2013 11:27 am
Contact:

Re: [ANN] libcoin rebase attempt

Post by domob »

biolizard89 wrote:jonasbits and I were able to find the reason one of the hacks was necessary. That's resolved; he should be posting new code soon.
Cool! I guess one of the two forks was about khal's introduction of time-based difficulty reduction. Was this the issue?
BTC: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS
Use your Namecoin identity as OpenID: https://nameid.org/

biolizard89
Posts: 2001
Joined: Tue Jun 05, 2012 6:25 am
os: linux

Re: [ANN] libcoin rebase attempt

Post by biolizard89 »

domob wrote:
biolizard89 wrote:jonasbits and I were able to find the reason one of the hacks was necessary. That's resolved; he should be posting new code soon.
Cool! I guess one of the two forks was about khal's introduction of time-based difficulty reduction. Was this the issue?
The testnet's base name fee is supposed to be 10 cents, compared to the main network's 50 coins. Looks like jonasbits's code changed "COIN" to "CENT" but neglected to change 50 to 10.

-Jeremy
Jeremy Rand, Lead Namecoin Application Engineer
NameID: id/jeremy
DyName: Dynamic DNS update client for .bit domains.

Donations: BTC 1EcUWRa9H6ZuWPkF3BDj6k4k1vCgv41ab8 ; NMC NFqbaS7ReiQ9MBmsowwcDSmp4iDznjmEh5

jonasbits
Posts: 47
Joined: Tue Mar 04, 2014 4:47 pm
os: linux

Re: [ANN] libcoin rebase attempt

Post by jonasbits »

This is the latest code https://github.com/jonasbits/libcoin/tree/nmc-test-3

I will create a nicer branch when the below obstacles are clear:
0) Dead end leg of chain
height
34715

1) Incorrect pow - 1584 st occurance
height
39765

2) Incorrect pow (limit) - only one occurance
height
40355
Somehow I always start syncing with the node that only has 34717 blocks (34715 has a checkpoint that prevent syncing down the wrong chain), and i need to specify --connect= (remove endpoints.sqlite and --addnode= is another option) to be able to sync beyond that height.

With

Code: Select all

grep -A1 PEER debug.log
I can detect at least one peer that are broadcasting height 34717 using version 37300
My Namecoin address: NC3HGHk527xuWZBgMdGJ2GxjpRSw8D4oA6

jonasbits
Posts: 47
Joined: Tue Mar 04, 2014 4:47 pm
os: linux

Re: [ANN] libcoin rebase attempt

Post by jonasbits »

Nicer testnet branch of libcoin
https://github.com/jonasbits/libcoin/tr ... stnet-beta
Hacks only active when running namecoin testnet:
1) Incorrect pow - 1677 st occurance
height
39765

2) Incorrect pow (limit) - only 2 occurance
height
1 and 40355
Now with:
  • example contrib/namecoind.conf file
  • building to namecoind target.
Libcoin detects the process filename and selects the appropriate chain and conf file from your ~/.libcoin directory

Hope to attract more eyes to look at the code and try to figure out how to remove the above hacks, without them testnet wont sync.

Also there is a bug in the RPC auth code that only works with lowercase base64 string. I found one you can use:

Code: Select all

v:a
use example:

Code: Select all

curl --user 'v:a' --data-binary '{"jsonrpc":"1.0","id":1,"method":"getbalance","params":[]}' -H 'Content-Type: application/json' -H 'Accept: application/json' http://127.0.0.1:18336
My Namecoin address: NC3HGHk527xuWZBgMdGJ2GxjpRSw8D4oA6

domob
Posts: 1129
Joined: Mon Jun 24, 2013 11:27 am
Contact:

Re: [ANN] libcoin rebase attempt

Post by domob »

Was anyone able to import a wallet from namecoind into libcoin yet? I've got an implementation of name_list that is "completed" but absolutely untested, and libcoind wouldn't recognize my wallet.dat to test it. It always keeps crashing right after the start. I've asked Michael, but maybe someone else also has experience with that before he finds time to reply.
BTC: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS
Use your Namecoin identity as OpenID: https://nameid.org/

jonasbits
Posts: 47
Joined: Tue Mar 04, 2014 4:47 pm
os: linux

Re: [ANN] libcoin rebase attempt

Post by jonasbits »

This is the hard way:
1. dumpprivkey from legacy namecoin/d/qt
2. use brainwallet.github.io to create a DER string
3. extract a text file of wallet.dat (with db_dump) and then insert 3 lines, like this:
https://gist.github.com/jonasbits/160ff ... /revisions
4. use db_load to save your new creation into a frankenwallet.dat

The easier way:
1. use ./pywallet.py --dumpwallet --testnet --datadir= (RPC command "backupwallet" solves the problem pywallet have with reading sometimes)
2. transplant 3 lines like above

The only method i know for sure works is to transplant from one libcoin wallet to another, and

Code: Select all

pywallet --importprivkey=
does not work for libcoin (my build is with Berkeley DB 5.3)

PS. This Post on bitcointalk, how to find the secret exponent from a DER string can be helpfull DS.
My Namecoin address: NC3HGHk527xuWZBgMdGJ2GxjpRSw8D4oA6

Post Reply