Matt Corallo is an accomplished developer in the Bitcoin space. His experience traces back to working on the Bitcoin Core code as early as 2011.
His resume is unarguably impressive. Corallo played a role in founding the Bitcoin development company Blockstream and currently works as an engineer at Chaincode Labs.
Corallo’s role at Chaincode Labs goes beyond making contributions to Bitcoin Core. Chaincode Labs is a privately funded research lab that works towards strengthening the health of the wider Bitcoin ecosystem.
One project which Corallo created is BetterHash. BetterHash is a mining protocol designed to allow miners to connect to a pool to reduce the variance in their payment while still being able to run a full node and select their own transactions.
Today’s mining world consists of two major protocols. Stratum is the dominant mining protocol that almost all mining devices use to connect to mining pools. Getblocktemplate is the other major mining protocol. Corallo has noted the downsides to both these protocols in previous presentations and interviews.
A key concern is that the protocols are completely unauthenticated, making the hash rate of mining pools vulnerable to attacks such as BGP hijacking. This type of attack has been successfully carried out before on altcoin mining pools.
Another important factor in the decentralization of Bitcoin is the role that the actual miners play. While pools reduce the variance of payouts, the existing mining protocols mean that the pools also take control of all of the following:
- Running a full node
- Choosing what transactions go into a block
- Determining the previous block to build upon
The primary reason which pools exist is to reduce the variance of mining reward payouts made to miners. But that is entirely unrelated to the above tasks. Giving control of these functions to mining pools weakens some of the key properties that the decentralized Bitcoin network provides such as censorship resistance.
The BetterHash protocol allows miners to optionally take back control of the above roles, strengthening the degree of decentralization. Corallo noted on the Off Chain podcast with Jimmy Song that in the case that BetterHash was adopted as the standard mining protocol, there could theoretically be just one mining pool for the entire network and it would not degrade decentralization or security.
Corallo has discussed the technical and general advantages of the BetterHash protocol several times previously. We interviewed Corallo and got updates on how BetterHash is progressing. We delved into the issue of adoption and got Corallo’s thoughts on mining centralization.
Can you give a high-level description of BetterHash?
BetterHash is an attempt at modernising the Bitcoin mining protocols, the protocols used by hardware devices to talk to pools. The current mining protocols were designed to get something working. They were definitely not designed to be a paragon of protocol design and security.
It’s an attempt to modernise these protocols and add all kinds of new features. This includes adding a lot of security to the protocol, adding a lot of efficiency for miners, and adding decentralization to mining again by allowing miners to pick their own work, run their own full node, and actually fully participate in the decentralization of Bitcoin.
Can you dive into the efficiency gains miners would benefit from by using BetterHash?
The efficiency gains are only relatively minor but they come in two forms. Firstly, the protocol is much more efficient. It uses less bandwidth. It is supported from the ground up to support proxies.
Some pools provide this as an option but it is actually coded into the protocol with BetterHash. Imagine you are a farm operator with little internet connection. BetterHash allows you to connect all your hardware to one little device such as a Raspberry Pi and all you need is the bandwidth of a dial-up line. Lower bandwidth means lower overhead and you can hopefully reduce latency there as well.
The other angle of more efficiency gains is block propagation. If miners are running a full node, they know the actual contents of the block they are working on. With Stratum, miners only know the coinbase transaction and the header of the block. When miners have the transaction information, they can start propagating it right away. You can cut off an extra bit of latency.
This especially helps if you’re on the west coast and your pool server is on the east coast, or you’re in North America and your pool server is in Europe. It lets you get a head start on block propagation which matters a lot. If you’re making 10% margin on your mining and you can improve your block propagation by even 1%, that’s a huge difference.
You’ve previously noted the challenges of adoption. Is there any updates?
I’ve spoken to some miners who want to use this and they can’t because there is no pool who uses this. I’ve spoken to some people who want to build out pools to help miners use this but it would not necessarily be available right away. There’s a chicken and egg problem. Hopefully, there will be big news there soon.
You might be working with Slush Pool on blending some parts of BetterHash into Stratum v2. What’s the plan in that regard?
It’s more akin to BetterHash rewritten than it is to some variant of Stratum. Slush Pool had some really valuable feedback on the protocol and are really interested in it. However, at the moment, they’ve been very busy with the BraiinsOS work and all kinds of other work that they have been doing. Hopefully, there will be some big news there also shortly.
Would you say Slush Pool are the top contender for a mining pool to adopt BetterHash?
Of existing pools, yes. Slush Pool know their customer base. Their customer base tends to be more ideologically aligned Bitcoiners. They are more likely to want to run their own full node.
The Slush Pool folks are aligned with the Bitcoin ideology also. They’re a fan of helping Bitcoin decentralization.
There is also a lot of interest from people who want to build out new pools. Some have new models and ideas for how a pool should work which is very cool.
There was a naming collision for BetterHash. Are you considering a new name?
That’s where the idea of Stratum v2 came from. The BetterHash name happens to be an existing business. We may very well run with Stratum v2.
Is there ongoing development in BetterHash or is it just a matter of adoption now?
There is some ongoing work to adopt some of the feedback that Slush Pool gave. They have been working a little bit on it too. The biggest question is about adoption. Getting things right is more of an adoption question than a software engineering question.
It seems there is a lot of friction in the process of adopting BetterHash in terms of technical barriers and operational barriers.
Operational is a big one. We’re not going to see adoption with existing farms, it has to be new farms. It’s about making the process extremely easy so that new farms can pick the protocol as an option on day one. Getting existing farms to displace their infrastructure is a hard pitch, especially when its working.
From your discussions with miners, have you seen much interest from them in running a full node?
From some, yes. Certainly from some of the more ideological miners. There is also a lot of miners out there who care about Bitcoin but don’t have the operational expertise to run a full node.
It’s important to make it really easy for miners to run a full node. It needs to be as easy as getting something similar to a Casa node and being able to plug it in from day one so that miners have both a full node and are mining on the network right from the start.
Of course, there are also miners who don’t care about running a full node and that’s why it is optional. As the Bitcoin mining industry continues to professionalise, the number of miners that don’t care about running a full node will likely dwindle.
It doesn’t really matter if all the small farms don’t run a full node. It’s a problem when the big farms that represent a large share of total hash rate don’t run a full node.
You have talked a lot about miner centralization in the Bitcoin network. Do you still see that as one of the biggest attack vectors?
Totally. Four servers control a large percentage of Bitcoin. That makes those four servers a big target. Someone could steal all the hash rate that’s on the Bitcoin network and that’s not a good situation to be in for a network that people rely on for monetary transactions.
Going forward, this has to change. BetterHash is a great option to address these attack vectors. BetterHash keeps the current model where miners connect to mining pools, it keeps the current pools, and people can still have pools that provide a lot of the services.
Miners can allow pools to control transaction selection if they wish. But they can slowly opt-in over time to privileges which BetterHash offers them such as running their own full node, selecting their own transactions, and actually really contributing to the decentralization of Bitcoin.
I think it’s critical that we move there eventually. I don’t pretend that this is going to happen on a short-term horizon. Getting people to deploy infrastructure is hard and a slow process but its very clearly critical for Bitcoin in the long-run.
You have also talked about BGP attacks which took place on altcoin mining pools many years ago. How possible is this on the Bitcoin network and is it actually a significant threat?
Absolutely. Stratum is completely unauthenticated in any meaningful way. If someone can get in the middle of the connection between devices and pools, they can make you mine something else but they can also cause your device to connect to a different pool and it will stay on the other pool until the device restarts.
This means if you do a temporary attack where you somehow are man-in-the-middle between clients and their pools, you can cause them to redirect to a new pool until they restart all of their devices physically. And you don’t have to keep running the attack, you can just do it for five minutes. As for the BGP hijacks themselves, they are really easy.
There is some work being done to improve routing security on the internet but it’s a very, very slow process. On the topic of people not deploying upgraded infrastructure, people who have million dollar racks of routers also do not like to deploy new infrastructure.
We saw a BGP hijack a few months ago on MyEtherWallet and the hijack was against Amazon. It was against Amazon EC2, one of the biggest hosts in the world. If Amazon can’t secure their servers against this type of attack, do we have any hope for every pool securing their servers? In fact, a lot of pool servers are hosted on Amazon.
There is a million cases of BGP hijacks. The most famous one is Pakistan accidentally taking down Youtube. Pakistan was trying to block Youtube internally and accidentally took it down for the world. They BGP hijacked YouTube.
These things, they just happen and they happen to be really easy to do. I am really concerned about this type of attack.
Is there profit incentive for people to launch this type of attack?
Totally. You steal hash rate. Hash rate includes money.
But you can only redirect to another pool?
There’s two types of attack. There’s an attack I would believe is happening somewhere and no one knows about it. If your ISP decides that they want to skim 1% off the top of your payouts, they can intercept 1% of the connections between you and your pool, rewrite the username, and then they’re done. And the payouts will now go to the ISP’s account, on the pool.
The BGP hijack attack is more fraud. If you were to do it, you would probably run your own full node, run your own pool, rewrite the entire networks hash rate to your pool and then solo mine and mine a bunch of blocks.
With BetterHash, what technological features have you put in place to stop all of these from happening?
Just basic cryptographic authentication. Your device will recognise if it is being hijacked and will try fallbacks.
You’re saying the technology is not necessarily that difficult but it just wasn’t put in place at Stratum?
Yes. Stratum was designed to work. It wasn’t designed to be the best thing that anyone could come up with. I don’t think any of the folks who worked on Stratum would disagree with this
MinerUpdate will be keeping up to date with the progress on BetterHash. We will be sure to inform our readers when relevant updates are made and are looking forward to hearing more from Matt in the future.