langerhans / dogecoinj-new

Fork of bitcoinj ported to dogecoin
Apache License 2.0
56 stars 42 forks source link

Doesn't seem to want to finish when running "mvn clean install" #2

Closed denwi closed 10 years ago

denwi commented 10 years ago

Hello there, and I'll apologize beforehand if this is a stupid question/issue, but I've been having troubles getting this thing going.

As the title suggests, it seems to hang at "EQUALVERIFY CHECKSIG 1.00 DOGE", and it won't seem to progress any further. jqp7yrv

Reason why I'm bothering with the source is I'd just like to get to know it better, as well as maybe for a future project to port it to other cryptos which are similar to Dogecoin.

Again, I'm sorry for my ignorance and I'd just like a clear answer whether it's my fault or not. Have tried to compile on both Win7 as well as on a fresh copy of Xubuntu 13.10 in a VM.

Thanks a bunch in advance.

langerhans commented 10 years ago

Hi, it's not your fault :grinning: I haven't found the time to rewrite any of the test cases. Try compiling it with: mvn -DskipTests clean install It should work then.

denwi commented 10 years ago

Awesome, it seems to work as you said.

Now I'm pretty well ahead into my own port for FedoraCoin, but I'm seemingly stuck on getting the proper merkle root for the genesis block. If you have time it'd be great if you could check out my repo, as I'm still pretty pants-on-head at this point of time. Any pointers on what I could be doing wrong can help, really.

Regardless, thanks for your time.

langerhans commented 10 years ago

NetworkParameters.java. Line 103, the TransactionInput has a scriptsig of

04ffff001d01044c99496e2074686973206d6f6d656e74204920616d20457570686f7269632c206e6f742062656361757365206f6620616e7920676f7665726e6d656e742773206f776e206172636861696320466961742073797374656d2c206275742062656361757365206f662074686520706f776572206f66206d79206f776e204665646f7261636f696e206d696e696e6720726967202d2044655368697a7a

You somehow missed 2 bytes. This will give you the correct merkle root and genesis hash. From there, add some actual peers to SeedPeers, or implement IrcDiscovery in one of the examples. Maybe TestWallet.java. remove the Doge DNS seed from MainNetParams too.

denwi commented 10 years ago

You are a based god. It works now! That being said, how did you figure out "4c99" was required? Was I at fault for neglecting to calculate the difficulty bit?

I ask since what I did was take "04ffff001d0104084e696e746f6e646f", removed the "84e696e746f6e646f" which was for Dogecoin, and slapped on what was required for Fedoracoin.

Sorry for taking up your time, but thank you so much for the help!

EDIT: Gah, I should really stop bothering you about this but I feel like I'm this close to finishing this. Anything that comes to mind with "Difficulty hit proof of work limit"? I'm feeling it's something to do with AbstractBlockChain but again, no clue to approach this.

langerhans commented 10 years ago

You just go to your blockexplrer site, go to block 0, hit the transaction, and use the "Raw transaction" to get the required scriptSig to put in there. That's the magic :grinning:

The other message in't an error if I'm not mistaken. It just marks a diff change block. Where exactly did you get that? I can have a quick look when you tell me where to look :grinning:

denwi commented 10 years ago

The error is what I get when quickly scanning through the logcat which is produced when my port decides to call it quits at Block 9. Here's the APK to save you some time: http://a.pomf.se/tsijio.apk

Also forgot to mention that later down the logcat, it complains about "Network provided difficulty bits do not math as calulated", then spews out "ffff000000000 vs fffff00000000", the latter value having an extra f.

The actual error message per se is located in AbstractBlockChain.java @ 871 & 883. Honestly just a wild guess but could it possibly have to do with "if (storedPrev.getHeight()+1 > 10000)" which is located above? I see that you replaced this piece of code earlier on.

langerhans commented 10 years ago

First thing is not a problem, second one is though. I just checked and saw that Fedora is quite different in that aspect as ist has a fixed allowed time drift. Check the following of the fedora source to see the adjustment: https://github.com/invisibel/fedoracoin/blob/master/src/main.cpp#L1003 To find nActualTimespanMax see 946 of the same file. You will notice that it obviously hangs at block 9 as this is a diff change block (every 10 blocks).

Yuo now want to replace the code in AbstractBlockChain.java starting from line 844 with the same code you got from fedora's source. You can even copy/paste that. ;) That should give you a sync past the diff change blocks.

denwi commented 10 years ago

Yes! Block properly syncs up all the way now! Apparently there were two methods/functions for the timedrift in main.cpp which made everything up until Block 2500 unique from Dogecoin. However, everything past that is exactly the same. I managed to figure out the appropriate if/else-if shenanigans and I'm on the newest block.

Thank you so much for your work and time, do you have a DOGE address I can send my gratitude towards?

langerhans commented 10 years ago

Great, glad I could help. Totally didn't see the different timedrift methods... If you want to send something, then this way: DEwTHxztkSDUJEMywbPk5zVUGrupaNRqEy Thanks and if you have more questions you can also contact me under dogecoinandroid@gmail.com :)

bryantebeek commented 10 years ago

Guys, I have this problem that I can't connect with peers if I compile dogecoinj. Any ideas? It keeps giving me 'peer died' messages.

langerhans commented 10 years ago

@bryantebeek With what are you trying to connect? PeerMonitor? WalletAppkit?
You need to implement IrcDiscovery for it to work. Current DNS seed is useless.

bryantebeek commented 10 years ago

@langerhans I'm working on the Worldcoinj wallet, I added known seeds but that doesn't seem to work. I just implemented the IrcDiscovery, but that basically gives the same results:

10:11:30 11 PeerGroup.handlePeerDeath: [98.215.139.166]:11081: Peer died
10:11:30 11 NioClientManager.handleKey: Failed to connect with exception: null
10:11:30 11 PeerGroup.handlePeerDeath: [46.64.208.103]:11081: Peer died
10:11:30 11 NioClientManager.handleKey: Failed to connect with exception: null
10:11:31 11 NioClientManager.handleKey: Successfully connected to /24.145.72.162:11081
10:11:31 11 Peer.connectionOpened: Announcing to /24.145.72.162:11081 as: /DogeCoinJ:0.11-SNAPSHOT/PeerMonitor:1.0/
10:11:31 11 NioClientManager.handleKey: Failed to connect with exception: Connection refused
10:11:31 11 PeerGroup.handlePeerDeath: [80.153.230.108]:11081: Peer died
10:11:31 11 NioClientManager.handleKey: Successfully connected to /213.113.135.181:11081
10:11:31 11 Peer.connectionOpened: Announcing to /213.113.135.181:11081 as: /DogeCoinJ:0.11-SNAPSHOT/PeerMonitor:1.0/
10:11:31 11 NioClientManager.handleKey: Successfully connected to /89.65.4.115:11081
10:11:31 11 Peer.connectionOpened: Announcing to /89.65.4.115:11081 as: /DogeCoinJ:0.11-SNAPSHOT/PeerMonitor:1.0/
10:11:31 11 NioClientManager.handleKey: Successfully connected to /38.109.174.40:11081
10:11:31 11 Peer.connectionOpened: Announcing to /38.109.174.40:11081 as: /DogeCoinJ:0.11-SNAPSHOT/PeerMonitor:1.0/
10:11:31 11 NioClientManager.handleKey: Failed to connect with exception: Connection refused
10:11:31 11 PeerGroup.handlePeerDeath: [94.231.132.14]:11081: Peer died
10:11:31 11 NioClientManager.handleKey: Successfully connected to /95.78.127.77:11081
10:11:31 11 Peer.connectionOpened: Announcing to /95.78.127.77:11081 as: /DogeCoinJ:0.11-SNAPSHOT/PeerMonitor:1.0/
10:11:31 11 PeerGroup.handlePeerDeath: [213.113.135.181]:11081: Peer died
10:11:31 11 PeerGroup.handlePeerDeath: [38.109.174.40]:11081: Peer died

It won't let me connect to anyone, all die.

kashmircoin commented 10 years ago

Hello! May i ask for your help? I'm trying to port your wallet for kashmircoin, but i have a problem. The coin has a unusual value for first tx (0.001001 * COIN), as you can see there: https://github.com/kashmircoin/kashmircoin/blob/master/src/main.cpp#L2841

So, when i put it in NetworkParameters.java i get the error (cannot find symbol [ERROR] symbol : method toNanoCoins(double,int) . I'm stuck here, please, help )

langerhans commented 10 years ago

It tells you that this method doesn't take a double as parameter. There is another method, same name, string parameter. Try this one. Utils.toNanoCoins("0.001001")

kashmircoin commented 10 years ago

It works! Thank you very much!