title: How to construct bitcoin Merkle tree?
body: <p>I am learning the Bitcoin mining protocol, however, I confuse about creating a Merkle tree. Let say 1 got 1 x coinbase transaction and 3 transaction id. Is the process as illustrate in the picture below/attach correctly?</p>
  <p>From my understanding, all coinbase and transaction id must be changed first to little-endian before double sha256 hash is calculated.</p>
  <p>Hash from coinbase will become the first leaf, tx1 become the second leaf and tx3 become the last leaf.</p>
  <p>Then combine 2 hash before double hash again and so the process goes up the pyramid structure until the root is found before it is changed back to big-endian.</p>
  <p>Hope someone can guide me on this. Thanks in advance</p>
  <p><img src="https://i.stack.imgur.com/54bJd.png" alt="Picture of Structure based on my understanding" /></p>