forked from lian/bitcoin-ruby
Permalink
26 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I've been busy, but I have been keeping an eye on your progress.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you able to get your code to work? I tried downloading your branch, then using
bitcoin_node --import ./ --network "dogecoin"in my~./.dogecoindirectory but it failed sayinginvalid network magic. I even tried to cheese it by changing it to whatfile.read(4)retrieves, which is\xc0\xc0\xc0\xc0but it wouldn't load my data saying some of it was invalid.36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not yet gotten it to work, no :P I was just super excited that someone pointed me at the location of the bytes in the dogecoin-qt source code.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, okay, I was worried I was doing something wrong!😆 I've been attempting to figure it out too, but without much luck... have you found where the "network magic number" resides in the block data file when reading it as binary?
Also, take a look at the Dogechain and the software that the site run's on, Abe. I think that they may hold the key to reading the Dogecoin wallet in Ruby. As far as I know, Dogecoin may be based off of Luckycoin, which is based off of Litecoin, but it might also be based off of Litecoin directly and use Luckycoin's Qt GUI.
I'm in the process of making a Stratum compliant EventMachine server for pooled Dogecoin mining, and I would like to be able to integrate other services such as merchant accounts and chain and block viewing/verification online, so I'll continue to research this and hopefully I can come up with something interesting! Fingers crossed that I actually finish the Stratum server... haha.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it turns out that those magic numbers are actually part of just the test net - take a look at this.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured it out!😃 I don't know why I didn't see it, but it was under my nose the entire time. Check out my gist and run that code in your
.dogecoindirectory, and you'll start seeing block data!Now my goal is to make a Rails version of the block viewer which will also connect to the Stratum compliant server that I'm making. If you want, I can send you a @indirect when I upload the first version to Github.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh awesome, keep me in the loop too.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey all, just chiming in to say I'm working on this too (samsonasu@04c3576) It looks to me like C0C0C0C0 is the correct magic header, and I think I pried all the other numbers from the source. I can connect to the network and request blocks, but I get errors after I request (and receive) the genesis block.
I tried connecting to the vanilla litecoin network as well and got similar errors there, so this might be an issue outside of just the settings/configuration.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I've seen on the main bitcoin-ruby issue tracker that the Litecoin support might not be working. I guess in that case we might need to do actual work on this rather than just repurpose it. :P
Anyway, I've added @samsonasu and @joshuasmock to this repo. Please feel free to push your discoveries and/or progress into my dogecoin branch so that there's at least a reasonably easy place to find this stuff. Thanks!
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also opened a ticket on the main bitcoin-ruby repo to chat with the project owners about dogecoin: lian#49
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, out of the box
bitcoin-rubydoesn't work directly with Litecoin and Litecoin-based coins, such as Dogecoin, if you are trying to import it the standard way. When you attempt to import a block throughbitcoin-ruby, it runs some validations such as checking that the merkle root matches the transactions calculated merkle root. Most of the validations pass, except for the bits validation (see https://github.com/lian/bitcoin-ruby/blob/master/lib/bitcoin/validation.rb#L79). In essence, due to Litecoin's use of scrypt, its calculation of proof of work is not the same as Bitcoin's, and this causes that validation to fail.I've gotten a working proof of work verification, after a bit of time last night! :-P So I think with that validation all of the validations pass. Right now I'm actually focusing on making the Rails block chain viewer, and once I get something basic working I'll upload it to Github, which will incorporate that new code. Check out my gist of what I made last night: https://gist.github.com/joshuasmock/8091107
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been working on my determining the chain in which the block resides, and I've found some interesting results - if my code is accurate, it looks like someone might be targeting Dogecoin and attempting to fill the blk****.dat files with junk data. Can you guys check out my gist and review the code? I raised an issue on the Dogecoin repo as well but I want to get more eyes on it to see.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, I thought that might be it but I wasn't sure. I also thought my code was wrong given that I saw so many side chains pop up, and so frequently, but I did read about the issues with the client and I updated. Crossing my fingers that it doesn't happen nearly much in the future...😦 At least the block chain is still only around 500 mb.
In better news I'm getting close to my block chain viewer - this was the most difficult because I was having a hard time getting the chain code to accurately determine the chain, and I was second guessing myself after seeing the side chain problem. Question for you guys: do you think it's useful to store the chain data in the database? I.e. store the amount of chains, where they occur, etc. Once I finish up my block chain viewer I'm gonna merge my code up to @indirect's repo.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just reran my script and it's still producing many junk chains, even after the update :(
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, just wanted to say it's nice to see so much interest in this :)
@wtogami has been working on litecoin/scrypt support, maybe he has some insight on this?
@joshuasmock if you're working on a blockchain browser, you might have a look at http://github.com/mhanne/block_browser / http://webbtc.com
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have higher priority projects elsewhere. I will eventually get back to Litecoin support in bitcoin-ruby, likely after lianj figures out what will happen with the not-yet-opened node implementation.
I have a working PoW validation for this but no time to clean it up.
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be an issue in the address generation for the dogesoin, :address_version => "30", will generate 'L' as the beginning char which represents Litecoin rather than the 'D' for doge's. I tried many things to get to the correct address with no luck, even tried bruteforce to find the correct number for doge addresses. Any ideas or suggestions on how to get this to work?
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those values need to be converted to hex:
PUBKEY_ADDRESS = 30, // DogeCoin addresses start with D
SCRIPT_ADDRESS = 22,
PUBKEY_ADDRESS_TEST = 113,
SCRIPT_ADDRESS_TEST = 196,
$ irb
2.0.0p195 :300 > 30.to_s(16)
=> "1e"
2.0.0p195 :301 > 22.to_s(16)
=> "16"
2.0.0p195 :302 > 113.to_s(16)
=> "71"
2.0.0p195 :303 > 196.to_s(16)
=> "c4"
You can also extends this configuration using hash merge tool:
module Bitcoin
NETWORKS.merge! ({
:dogecoin => {
...
})
end
It works fine for my dogecoin_testnet base58 priv key
key = Bitcoin::Key.from_base58(PRIV_KEY)
36d6ae7There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey everyone!😄 Hope you're all doing well. I assume the steam has died on this since no one's really chatting about it anymore, but I wanted to let you know that I've been working on a project that involves real-time transaction viewing and processing (including some research into esoteric transactions using the Script directives in Bitcoin) and if you guys are interested I'll post here once I get it more complete (I'm currently working on getting complete unit tests).