How to build Merkle root from merkle branches?

Is there any help/tutorial on how to build the Merkle root from stratum data?

The Slushpool’s stratum protocol has an example of a mining job but it does not contain any Merkle branches and I don’t know if I am generating the Merkle root correctly.

Here is the string from Slushpool:

{"params": ["bf", "4d16b6f85af6e2198f44ae2a6de67f78487ae5611b77c6c0440b921e00000000",
"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff20020862062f503253482f04b8864e5008",
"072f736c7573682f000000000100f2052a010000001976a914d23fcdf86f7e756a64a7a9688ef9903327048ed988ac00000000", [],
"00000002", "1c2ac4af", "504e86b9", false], "id": null, "method": "mining.notify"}

Running a Bitcoin node (behind Firewall / NAT or anything else? disallowing inbound connections)

I consider running a bitcoin full node on a raspberry Pi 3. I want to attach the raspberry Pi into my home-network (wifi). When I check my IP address I have a public address to the outside (which is changing from time to time, however is only one of 5 different addresses) and via NAT given by my ISP. I don’t know what is between “my” public IP and my homenetwork in detail.

As I understand it correctly a bitcoin node does only good to the overall network iff it can accept inbound connections, therefore my raspberry pi must be publicly available (behind all this NAT whatever). If I run a bitcoin node I would like to use it at least by myself as a trusted node inside my mobile bitcoin wallet…

In the end I see two ways to do that:

  • Resolve NAT issues with one of the following techniques: Upnp, TURN, NAT hole punching, STUN, ICE, IGDP, NAT-PMP, PCP, ALG, wathever else there, I don’t know…
  • Or running a hidden service.

So my question:

  • Is it good/bad/ok to “only” allow inbound connections as a tor hidden service?
  • Is there an easy way to get a bitcoin node with “traditional” means available as a public node inside a home network?

Electrum 2.7.9 setup never went through the password and seed setup, now I can’t send coins

I installed the Electrum 2.7.9 wallet and it never went through the password and seed setup. I ended up with a default standard wallet. I then uninstalled the Electrum wallet and then reinstalled it. Once again it didn’t go through any password or seed setup and I had a default standard wallet on my pc. I made the dumb decision, because I am totally new at this, to go ahead and send my bitcoins from my coinbin wallet to the address associated with the standard default wallet and now I can’t send anything because it wants a password. Please help!

Who added the 21 million limit to Bitcoin?

After reading the white paper of Satoshi Nakamoto. The white paper does not mention anything about a limit of money supply.
I think I have read somewhere mentioned the name, but unfortunately I cannot remember it.
If I look in the main resources available online (Wikipedia, bitcoin.org, ..) they all mention Satoshi Nakamoto as the one who added this feature.
If Satoshi was not the one to add this feature, I think it is very important that we know who came up with this, and why the bitcoin dev community at the moment decided to adopt it.

Random generation of elliptic curve points: is there a preferred approach?

While most practical applications are concerned with the random generation of private keys, anyone who wishes to write unit-testing code on the secp256k1 elliptic curve group may wish to have the ability to randomly generate elliptic curve points.

I can immediately think to two approaches for doing so, one consisting in returning the elliptic point associated with a random secret, the other consisting in randomly generating X, computing X^3 + 7 until we obtain a quadratic residue mod p and compute a square root (which reduces to taking a power (p+1)/4 mod p since p = 3 mod 4). I am suspecting that the latter approach is computationally more efficient as it does not involve the scalar multiplication of the EC group, but only arithmetic operations and exponentiation mod p. Is there a known preferred approach to this question? Assuming my intuition is right, and generating X until X^3 + 7 is a quadratic residue is the way to go, another question naturally arises: what is the preferred approach to test whether a number mod p has a square root? Is it worth implementing the Legendre symbol, or is it better to simply check whether the prospective square root (raising to the power (p+1)/4) fits the bill?

Early optimization is the root of all evil, so maybe I shouldn’t be asking this question, especially as the performance of unit testing code probably doesn’t matter. But I figure that if some elements of best practice are known regarding bitcoin development, I may as well adopt them and do the right thing.

Unrecoverable Funds

If I have sent funds from one wallet to another, but locked myself out of the wallet I sent them to due to the fact I do not remember my PIN and did not write down my pass phrase. Is there any way to mine them or recover my funds?