alikim (OP)
Member
Offline
Activity: 80
Merit: 11
|
|
February 13, 2011, 02:57:18 AM |
|
Can anyone please point me to the info about what exactly needs to be solved to generate coins?
I'd like to see an example of a block, what the cryptographic problem is, and what the valid answer looks like
Thanks!
|
|
|
|
|
|
|
|
"In a nutshell, the network works like a distributed
timestamp server, stamping the first transaction to spend a coin. It
takes advantage of the nature of information being easy to spread but
hard to stifle." -- Satoshi
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
theymos
Administrator
Legendary
Offline
Activity: 5194
Merit: 12983
|
|
February 13, 2011, 03:03:00 AM |
|
|
1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
|
|
|
LZ
Legendary
Offline
Activity: 1722
Merit: 1072
P2P Cryptocurrency
|
|
February 13, 2011, 03:22:24 AM Last edit: February 13, 2011, 03:51:09 AM by lzsaver |
|
The block example (it is №107764): { "hash":"00000000000271de9d8b94afff543366e290e995f3e3e337bb86a0b7bf02e8d1", "ver":1, "prev_block":"00000000000148c04e58dca8e1a2df251339c81e2dfe1ff0e9d655b7b4ca428d", "mrkl_root":"72febc107470c4f83e224f9683a5c7fb24c4dece8412b9d95db277c8dd75451d", "time":1297566305, "bits":453150034, "nonce":329961997, "n_tx":2, "size":473, "tx":[ { "hash":"d74f0f8e979dc08d028f0fd97e06b97b81b3f42f41c80ce5e4a900003c202abe", "ver":1, "vin_sz":1, "vout_sz":1, "lock_time":0, "size":134, "in":[ { "prev_out":{ "hash":"0000000000000000000000000000000000000000000000000000000000000000", "n":4294967295 }, "coinbase":"045285021b0135" } ], "out":[ { "value":"50.00000000", "scriptPubKey":"045ac21e53fc77ea47b72ae306840bd7eb16709b04488a0daf177df6a2476bbd6fabf76731e1cbfa75ec55c575454fe89e41ce58993f1cbd3dcf497b85bbebab80 OP_CHECKSIG" } ] }, { "hash":"8ddf80cb3f3286922752da908f3b3f96c4bd8114cd67f3e00ae6a130e7d37b6e", "ver":1, "vin_sz":1, "vout_sz":2, "lock_time":0, "size":258, "in":[ { "prev_out":{ "hash":"4f41d46faa2e34b718e7edf051e27fbfe2e77055e5a4519eda67068cc060141b", "n":0 }, "scriptSig":"3045022013402505fee0e884206e6ae22b8057227ce2de970fae57ad4ab95c616fc60418022100aa52d63f3cd6c9e17c2ba4a7410d68e8f4c25e77f7f08f161c2f1af116cc065401 045216f2b5745cf08681a1409aa83e1554c788a7365600c7378665895a5377960eb49a86e3a2128d2ffe5f52e6a6e5ed453a1b87ebf08e5fdbe0b98352be2719cf" } ], "out":[ { "value":"0.05000000", "scriptPubKey":"OP_DUP OP_HASH160 8707482c01949460fad582ef14558cbf1a2baf28 OP_EQUALVERIFY OP_CHECKSIG" }, { "value":"47.98000000", "scriptPubKey":"OP_DUP OP_HASH160 5b83f29112290e0baf004db04a85c1e32a7f4242 OP_EQUALVERIFY OP_CHECKSIG" } ] } ], "mrkl_tree":[ "d74f0f8e979dc08d028f0fd97e06b97b81b3f42f41c80ce5e4a900003c202abe", "8ddf80cb3f3286922752da908f3b3f96c4bd8114cd67f3e00ae6a130e7d37b6e", "72febc107470c4f83e224f9683a5c7fb24c4dece8412b9d95db277c8dd75451d" ] } The hash of that block header: 00000000000271de9d8b94afff543366e290e995f3e3e337bb86a0b7bf02e8d1 The current target: 0000000000028552000000000000000000000000000000000000000000000000 The cryptoproblem is that the block header SHA-256 hash should be below the current target.
|
My OpenPGP fingerprint: 5099EB8C0F2E68C63B4ECBB9A9D0993E04143362
|
|
|
alikim (OP)
Member
Offline
Activity: 80
Merit: 11
|
|
February 13, 2011, 03:49:35 AM |
|
Thanks!
|
|
|
|
alikim (OP)
Member
Offline
Activity: 80
Merit: 11
|
|
February 14, 2011, 09:28:02 AM |
|
after some thinking, I have a few more questions... hope it's not very annoying 1. which part of the above code is actually "the block header"? 2. as I understand it, you need to add nonce to the block header and then calculate SHA256? Or you need to add nonce to the hash of the block header? 3. what is the nonce in the code: "nonce":329961997, is that the successful one for the previous block? 4. do I always have to start with nonce=0 and increment it, or I can start with any number? 5. when a job is sent to a miner worker, is it a certain range of nonces I need to calculate, or is it a part of the SHA256? Thanks!
|
|
|
|
redcodenl
Newbie
Offline
Activity: 12
Merit: 0
|
|
February 14, 2011, 05:54:12 PM |
|
Good questions, I'm trying to answer those as well. Some things I've found out:
- The nonce is what a miner itself increases after every try. - I think you need to hash quite some fields, the nonce, timestamp, and more (merkle root?) - The generated hash needs to be smaller then the current target (which you can retrieve)
I'm also quite puzzled after reading the wiki-page, I don't think there is enough information currently on that page to create you own miner (which I plan to do).
Who can enlighten us? When you get a block, which steps do you need to do to generate a (possible) new block? Can somebody write it down in pseudo code?
|
|
|
|
jgarzik
Legendary
Offline
Activity: 1596
Merit: 1091
|
|
February 14, 2011, 06:39:36 PM |
|
Good questions, I'm trying to answer those as well. Some things I've found out:
- The nonce is what a miner itself increases after every try. - I think you need to hash quite some fields, the nonce, timestamp, and more (merkle root?) - The generated hash needs to be smaller then the current target (which you can retrieve)
I'm also quite puzzled after reading the wiki-page, I don't think there is enough information currently on that page to create you own miner (which I plan to do).
To mine, you really need to know the bitcoin data structures quite intimately... ultimately that means reading the bitcoind source code.
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
redcodenl
Newbie
Offline
Activity: 12
Merit: 0
|
|
February 14, 2011, 09:36:00 PM |
|
I'm also quite puzzled after reading the wiki-page, I don't think there is enough information currently on that page to create you own miner (which I plan to do).
To mine, you really need to know the bitcoin data structures quite intimately... ultimately that means reading the bitcoind source code. Not that I don't want to dive into the source code to find out, but it can't really be that hard to explain how a miner works can it? Most likely it just takes some data, hashes it with one or two changing variables and tests if it fits the current target? I doubt knowing the data structures intimately is really necessary, but I get the feeling it is more adviced and/or encouraged? Rather then having to read sources and decypher the algorithm I'd rather see it described somewhere. I know a little C/C++ so I'll probably be able to decypher the code. When/if I find the time I'll dive into the source code to find out how it works. If I do, I'll write a more elaborate description.
|
|
|
|
|