Bitcoin Forum
December 12, 2024, 03:50:44 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How To Get The Data Needed To Find A Block?  (Read 1112 times)
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 20, 2012, 06:44:46 PM
 #1

can anyone explain How Can i find these:

Version : Block version number
Previous hash : Hash of the previous block
Merkle root : 256-bit hash based on all of the transactions
Timestamp : Current timestamp
"Bits" : Current target in compact format
Nonce : 32-bit number (starts at 0)


and can anyone tell me how can i increment the nonce.

and how can i check that my hash is less that current target.

and how to submit the hash to Bitcoin-Qt

and how many zero's must be there in a hash to be a block?
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
September 20, 2012, 06:47:13 PM
 #2

can anyone explain How Can i find these:

Version : Block version number
Previous hash : Hash of the previous block
Merkle root : 256-bit hash based on all of the transactions
Timestamp : Current timestamp
"Bits" : Current target in compact format
Nonce : 32-bit number (starts at 0)
You don't need any of these but the nonce. The client will process these for you. And you have to find the nonce, if there is one, by trial and error.

Quote
and can anyone tell me how can i increment the nonce.
You don't know how to add one to a number? Seriously?

Quote
and how can i check that my hash is less that current target.
You don't know how to compare two numbers to see which is greater?

Quote
and how many zero's must be there in a hash to be a block?
The hash must be lower than the target.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 20, 2012, 06:58:16 PM
 #3

i know how to add one to a number but i am asking that must the nonce be incremented or generated randomly?

how can i add one to the nonce because "42a14695" has a alphabetical character

and can anybody tell me how to compare the hash with the target?

and how can i calculate my hash without (Version, Previous hash, Merkle root, Timestamp, "Bits", Nonce) in the bitcoin hashing algorithm here https://en.bitcoin.it/wiki/Block_hashing_algorithm  all of these are used..

and how to submit the hash to Bitcoin-Qt?
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
September 20, 2012, 07:19:55 PM
 #4

The guy basically wants to know the algorithm to calculate the hash and then see if it's < target. Likely to write his own miner, or write a miner for the community or just to satisfy the thirst for knowledge.

I suggest looking at the very simple example in this C program written by someone http://pastebin.com/n8UEGA86

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 20, 2012, 07:28:43 PM
 #5

The guy basically wants to know the algorithm to calculate the hash and then see if it's < target. Likely to write his own miner, or write a miner for the community or just to satisfy the thirst for knowledge.

I suggest looking at the very simple example in this C program written by someone http://pastebin.com/n8UEGA86

even in this data the values for these :

Version : Block version number
Previous hash : Hash of the previous block
Merkle root : 256-bit hash based on all of the transactions
Timestamp : Current timestamp
"Bits" : Current target in compact format
Nonce : 32-bit number (starts at 0)


has been predefined i would like to know how to get them..
flynn
Hero Member
*****
Offline Offline

Activity: 728
Merit: 540



View Profile
September 20, 2012, 07:34:28 PM
 #6

The guy basically wants to know the algorithm to calculate the hash and then see if it's < target. Likely to write his own miner, or write a miner for the community or just to satisfy the thirst for knowledge.

I suggest looking at the very simple example in this C program written by someone http://pastebin.com/n8UEGA86

even in this data the values for these :

Version : Block version number
Previous hash : Hash of the previous block
Merkle root : 256-bit hash based on all of the transactions
Timestamp : Current timestamp
"Bits" : Current target in compact format
Nonce : 32-bit number (starts at 0)


has been predefined i would like to know how to get them..

call the "getwork" method with the client's api

(run "bitcoind", then run "getcoind getwork" and decode the json you get.)


intentionally left blank
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 20, 2012, 07:46:51 PM
 #7

The guy basically wants to know the algorithm to calculate the hash and then see if it's < target. Likely to write his own miner, or write a miner for the community or just to satisfy the thirst for knowledge.

I suggest looking at the very simple example in this C program written by someone http://pastebin.com/n8UEGA86

even in this data the values for these :

Version : Block version number
Previous hash : Hash of the previous block
Merkle root : 256-bit hash based on all of the transactions
Timestamp : Current timestamp
"Bits" : Current target in compact format
Nonce : 32-bit number (starts at 0)


has been predefined i would like to know how to get them..

call the "getwork" method with the client's api

(run "bitcoind", then run "getcoind getwork" and decode the json you get.)



is there an example on how to call "getwork" from your program using the Bitcoin-Qt GUI's 127.0.0.1?
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
September 20, 2012, 09:11:40 PM
 #8

i know how to add one to a number but i am asking that must the nonce be incremented or generated randomly?
In principle you can do it either way. If you're pulling from a mining pool, they expect you to try every nonce and may consider it abusive if you only try some of them.

Quote
how can i add one to the nonce because "42a14695" has a alphabetical character
Please don't take this the wrong way, but if it seriously mystifies you how to increment a hexadecimal number, you have no business writing this kind of code. This is like asking how to add one to seven because "seven" contains a 'v'. How you choose to write a number to communicate with others has nothing to do with how you manipulate it internally. Whether I tell you the number is "seven", "7" or ". . . . . . .", you add one to it the same way. If this is at all mystifying to you, you really should start out with some *much* simpler coding tasks.

Quote
and can anybody tell me how to compare the hash with the target?
The same way you compare, say, 571 to 541. You start with the most significant unit and if they're the same, you keep going to less and less significant units until you find a difference. (The hundreds are the same, so try the tens. The tens are different, so the one with the higher tens place is bigger.) Same idea.

Quote
and how can i calculate my hash without (Version, Previous hash, Merkle root, Timestamp, "Bits", Nonce) in the bitcoin hashing algorithm here https://en.bitcoin.it/wiki/Block_hashing_algorithm  all of these are used..
You have to try billions of nonces. Anything not dependent on the nonce should be done just once. You take over right where the nonce comes in, so you don't need anything processed prior to that. You're not going to go hashing all those things that never change for each of your 4 billion nonces. That would be awful.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!