Pages:
Author

Topic: [ANN] Genesis Block Generator - page 3. (Read 30836 times)

legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
April 21, 2013, 04:04:29 AM
#6
I was able to implement the block hashing part, will clean it up and release later.
legendary
Activity: 1484
Merit: 1005
April 21, 2013, 01:10:42 AM
#5
I am glad it works for you. But a lot of users, me included are on Windows.
http://www.evanjones.ca/unicode-in-c.html

But you can also just pass it as binary by converting it to hex reading from a UTF-8 file containing the string...
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
April 21, 2013, 01:07:41 AM
#4
I am glad it works for you. But a lot of users, me included are on Windows.
sr. member
Activity: 448
Merit: 252
April 21, 2013, 12:54:22 AM
#3
Interesting, the Litecoin genesis block seems to have a Unicode "smart quote" (fancier apostrophe) encoded in UTF-8.  With my console configured for UTF-8 encoding, this seems to work to reproduce the LTC genesis tx:

Quote
./genesisgen 040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08 dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9 "NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56" 486604799

Coinbase: 04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732 c204170706c65e280997320566973696f6e6172792c2044696573206174203536

PubkeyScript: 41040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa 08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9ac

Merkle Hash: d9ced4ed1130f7b7faad9be25323ffafa33232a17c3edf6cfd97bee6bafbdd97
Byteswapped: 97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9

(Notice "Apple’s" as opposed to "Apple's")  This seems to correspond with the genesis tx at this block explorer.  Cool, thanks OP!

(Also, this timestsamp may work in bash without terminal settings: "`echo -en NY Times 05/Oct/2011 Steve Jobs, Apple\\\\xE2\\\\x80\\\\x99s Visionary, Dies at 56`")
hero member
Activity: 756
Merit: 500
April 20, 2013, 11:59:26 PM
#2
Wow, it's been made.
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
April 20, 2013, 11:50:39 PM
#1
Ok, thread title is a bit misleading, I haven't actually done the genesis block calculation part done. I'd like to also take a minute or two and explain to you that I aren't exactly a good coder, I started doing C in my early days of mining in 2011 and playing with cgminer and nonces and stuff. I refused to read a book on C, so everything I've learned about C is through trial&error, well OK I have not learned much so trial&error is how I get my results. The equivalent of this would be trying to drive a car as if you have 10 years behind the wheel without actually knowing how to.

So basically do not expect the best code, I could have done things in there that aren't efficient, or just plain simply wrong and that would be because I don't know how to do them in a different way.

The code is here http://pastebin.com/nhuuV7y9, pure C. No binaries for obvious reasons. The code relies on OpenSSL. Since you will need OpenSSL either way, as it is a Bitcoin dependency, I believe it won't be an issue.
*Implemented Genesis Block finder

Cons
  • Program assumes one input and one output. So trying to create a merkle hash like the one in Freicoin with multiple inputs and outputs is not possible with this program.
  • Program at the moment assumes 50 coins, but this can be changed in the code very easily.
  • This is probably the most important one. I can re-create the Bitcoin merkle hash with ease, but when I tried to test it with Litecoin's timestamp message, it failed. Something to do with Unicode. I will not lie, my understanding of Unicode and ASCII is even less than my understanding of C. Basically, try to avoid apostrophes,commas and other special characters. Someone more knowledgeable can patch this

Usage
Quote
program

Example
Quote
programname 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" 486604799
Which will output
Quote
Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f7 2206f6e206272696e6b206f66207365636f6e6420
6261696c6f757420666f722062616e6b73

PubkeyScript: 4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce f38c4f35504e51ec112de5c384df7ba0b8d57
8a4c702b6bf11d5fac

Merkle Hash: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
Byteswapped: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b

The timestamp needs to be in quotes if it's longer than a word, because it will get treated as separate arguments than a whole string.

So yeah, more cons than pros, but if you like what I've done, please drop some reward to the address on my signature Smiley
Pages:
Jump to: