Bitcoin Forum
July 06, 2024, 04:43:21 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How To Find a Block?  (Read 9272 times)
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 18, 2012, 06:50:58 PM
Last edit: September 20, 2012, 10:25:18 AM by betatest512
 #1

how does the miner's find a block? e.g (what is the algorithm used in generating a block)

and what is done by a miner to find a block? e.g (what calculation's is done by a miner)

and how does the Bitcoin-Qt verify that a block is valid?

and if i were to develop my own program to mine what should i do in my program?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4681



View Profile
September 18, 2012, 07:00:35 PM
 #2

Not a lot of technical details here, but this is a good start to understanding the concept of how mining works:

http://codinginmysleep.com/bitcoin-mining-in-plain-english/

Once you've got a good understanding of what mining is, you can look at the protocol specification to figure out how to program a miner:

https://en.bitcoin.it/wiki/Protocol_specification

https://en.bitcoin.it/wiki/Getwork

weex
Legendary
*
Offline Offline

Activity: 1102
Merit: 1014



View Profile
September 18, 2012, 07:09:20 PM
 #3

You can also google for my free ebook Introduction to Bitcoin Mining to get you a nice overview.
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 18, 2012, 07:16:17 PM
 #4

Not a lot of technical details here, but this is a good start to understanding the concept of how mining works:

http://codinginmysleep.com/bitcoin-mining-in-plain-english/

Once you've got a good understanding of what mining is, you can look at the protocol specification to figure out how to program a miner:

https://en.bitcoin.it/wiki/Protocol_specification

https://en.bitcoin.it/wiki/Getwork



i would like to know what should my program do in order to find a block?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4681



View Profile
September 18, 2012, 07:46:07 PM
 #5

Not a lot of technical details here, but this is a good start to understanding the concept of how mining works:

http://codinginmysleep.com/bitcoin-mining-in-plain-english/

Once you've got a good understanding of what mining is, you can look at the protocol specification to figure out how to program a miner:

https://en.bitcoin.it/wiki/Protocol_specification

https://en.bitcoin.it/wiki/Getwork



i would like to know what should my program do in order to find a block?
Read the information at those links and you'll have the answer to your question.  If you can't figure it out from the information provided, you probably aren't capable of writing a workable computer program to accomplish your intended task.

Specifically as stated in one of those links:

Quote
The SHA256 hash that identifies each block (and which must have a run of 0 bits) is calculated from the first 6 fields of this structure (version, prev_block, merkle_root, timestamp, bits, nonce, and standard SHA256 padding, making two 64-byte chunks in all) and not from the complete block. To calculate the hash, only two chunks need to be processed by the SHA256 algorithm. Since the nonce field is in the second chunk, the first chunk stays constant during mining and therefore only the second chunk needs to be processed. However, a Bitcoin hash is the hash of the hash, so two SHA256 rounds are needed for each mining iteration. See Block hashing algorithm for details and an example.

Block hashing algorithm is seen at this link (as found in the information from one of those previous links I posted):
https://en.bitcoin.it/wiki/Block_hashing_algorithm
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 18, 2012, 07:55:00 PM
 #6

Once i generate a hash from my program what should i do to my hash after that?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4681



View Profile
September 18, 2012, 07:57:57 PM
 #7

I'm not going to write your program for you (unless you pay me up front with BTC).  I give up.
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 18, 2012, 08:07:10 PM
 #8

I'm not going to write your program for you (unless you pay me up front with BTC).  I give up.

i did not ask you to write the program for me i asked once i generate a hash from my program what should i do to my hash after that?

i am generating the hash from the info provided here : https://en.bitcoin.it/wiki/Block_hashing_algorithm

can anyone tell me what should i do to the hash once i generate it?
betatest512 (OP)
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
September 20, 2012, 10:24:51 AM
 #9

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)
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
September 20, 2012, 10:38:03 AM
 #10

Download the client. Run the client. Let it download the block chain. Issue it a "getwork" RPC request. You now need to do a double SHA-256 using every possible 32-bit nonce, all 2^32 of them. Should you find a nonce that produces a hash less than the target, report that back to the client using a "getwork" RPC as soon as possible.

See this thread: https://bitcointalk.org/index.php?topic=12862.0

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!