<p>Your question involves quite a bit.<br>
Mining is done with conjunction of a wallet.<br>
A lot of the work is handled by the wallet.<br>
See the RPC <code>getblocktemplate</code><br>
Also run <code>help getblocktemplate</code> to see more information, that will point you to a few BIPs (B22, 23, 9, and 145) for further reading.   </p>

<p>Basically (simplified) you do a <code>getblocktemplate</code> and then you repeatedly hash it (while incrementing the nonce) to get a hash that meets the difficulty criteria.</p>

<p>I hope this is enough information to get you started</p>

CC BY-SA 3.0
2017-08-04T19:14:29.880Z
2017-08-04T19:14:29.880Z
Albert S
<p>I know Javascript is not the Language for this matter, however i believe it's the easiest to understand and would be very easy to anyone to port to any other language.</p>

<p>what i am trying to understand is how do i "hash" transactions, "create my own 12.5" transaction concat, append, rehash, hash it once again... as i see here and there...  it all seems very confusing, anyone could explain a bare basic implementation of step by step on what is needed in order to create a valid btc block?</p>

<p>my ultimate goal is to get any random block here <a href="https://blockexplorer.com/" rel="nofollow noreferrer">https://blockexplorer.com/</a>, and using the exactly same nonce as input recreate the same result</p>

CC BY-SA 3.0
2017-08-04T18:25:26.487Z
[This article](http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html) may answer your question.
deepbrook
<miner-configuration>
How to create a valid BTC Block?
Rafael Milewski
# How to create a valid BTC Block?

(Asked by: username_0 on 2017-08-04)

I know Javascript is not the Language for this matter, however i believe it's the easiest to understand and would be very easy to anyone to port to any other language.

what i am trying to understand is how do i "hash" transactions, "create my own 12.5" transaction concat, append, rehash, hash it once again... as i see here and there... it all seems very confusing, anyone could explain a bare basic implementation of step by step on what is needed in order to create a valid btc block?

my ultimate goal is to get any random block here <https://blockexplorer.com/>, and using the exactly same nonce as input recreate the same result

**Tags:** miner-configuration

> **Comments:**
> **username_1**: [This article](http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html) may answer your question.  

---

## 1 answers

### Answer by username_2 on 2017-08-04. Score: 0

Your question involves quite a bit.  
Mining is done with conjunction of a wallet.  
A lot of the work is handled by the wallet.  
See the RPC `getblocktemplate`  
Also run `help getblocktemplate` to see more information, that will point you to a few BIPs (B22, 23, 9, and 145) for further reading.

Basically (simplified) you do a `getblocktemplate` and then you repeatedly hash it (while incrementing the nonce) to get a hash that meets the difficulty criteria.

I hope this is enough information to get you started


---

