Building a Fully Decentralized Bitcoin Mining Pool on ICP

TL;DR:

  • Mining pools are becoming increasingly centralized and have been shown to censor the network. This is an escalating issue.
  • Loka plans to create a fully decentralized Bitcoin mining pool on ICP. This will be open-source, community-owned, resistant to censorship, and offer payment to miners in ckBTC without a minimum payout threshold.
  • It will also feature ckBTC staking. Participants can stake ckBTC to provide liquidity for mining rewards and earn additional BTC from the mining pool fees, paid out whenever the pool finds a new block.

Background

Loka is currently developing a trustless P2P Bitcoin mining protocol that connects BTC miners with retail investors.

More about our project can be found in this post:

Initially, we planned to build our own mining pool after launching our platform. However, following recent developments in the Bitcoin mining space, we are considering fast-tracking the mining pool’s development before launching the platform.

Mining Pool in a Nutshell

Every 10 minutes, a new block is created in Bitcoin, and the miner who finds the block receives a mining reward of 6.25 BTC (or 3.125 BTC after the halving in April 2024) plus transaction fees. The larger your share of the network’s hashrate, the greater your chance of success.

In essence, it’s like a lottery. Hashrate equals tickets, and finding a block equals winning the prize. The more hashrates you have, the higher your chances of winning.

How It Works

A mining pool consolidates hashrates from various Bitcoin miners into a single “pool.” When this pool finds a block, the mining reward is distributed pro-rata based on each miner’s contribution, usually every 24 hours.

Since blocks are created at 10-minute intervals, this means there are 144 new blocks every 24 hours. Statistically, a mining pool needs to consolidate approximately 0.7% (100%/144) of the world’s total hashrate to earn a reward daily on average.

This is why smaller pools like Ocean, with only a 0.07% hashrate contribution, had only find 2 new blocks in the last 3 weeks. Statistically, they are expected to find 1 new block every 10 days.

There are different types of mining pool payout methods (PPS, FPPS, FPLNS, TIDES, etc.), but the bottom line is that miners seek fair and transparent payouts, preferably every day.

For mining pools with more than 1% of the total hashrates, the payout scheme doesn’t significantly impact daily payouts. However, for pools with less than 0.7% of the total hashrate, the Full Pay Per Share (FPPS) method with typical fees of 2-4% from the mining reward is the most viable. This method ensures that connected miners are paid daily, regardless of whether the pool finds a new block.

The State of Existing Mining Pools

  • Mining pools are becoming more centralized, with the two largest pools accounting for over 50% of the total hashrate. It’s a growing problem

  • Existing pools are subject to specific jurisdictions and none are fully decentralized:
  • Smaller miners often don’t receive daily payouts due to thresholds, typically around 0.005 BTC — Ocean’s threshold is even higher at 0.01 BTC. This means miners with fewer than 40 ASIC machines might have to wait several days or weeks for their payouts.

What a Decentralized Mining Pool on ICP we imagine would look like:

  • No minimum payout, with payments in ckBTC.
  • FPPS payout scheme including 24-hour average transaction fees.
  • Fully decentralized:
    • Full Bitcoin node running on ICP canisters to access the mempool.
    • No KYC, no censorship, not bound to any jurisdiction.
  • Open source.
  • Community-owned with ckBTC “staking” feature
    • Anyone can provide liquidity for mining rewards in the pool using ckBTC
    • Low mining pool fee of 2%, mainly redistributed to ckBTC liquidity providers when a new block found.
  • The team may bootstrap liquidity and initially charge 0% fees to attract BTC miners and encourage adoption.
  • Reward tokens will be issued to participants, both liquidity providers and miners, based on their contributions.

If you like this idea and would like to contribute, please post a comment!

30 Likes

Mi intuición me dice que este puede ser un proyecto enorme por sus implicaciones, desde luego que estaré atento a vuestras actualizaciones

2 Likes

I think a decentralized mining pool on IC is a fantastic idea. How long do you estimate it would take to complete?

6 Likes

This is a wonderful idea. Lets make it happen!

3 Likes

We’re still scoping the requirements and the timeline, but aiming to launch before the bitcoin halving. On a high level; I think the steps and challenges would be:

  1. Run a full bitcoin node to access mempool on ICP canister – had a brief discussion with @THLO and @bob11 (tagging here so can join the discussion) about this – should be possible and need to test soon.
  2. Run the mining pool software on canister – we would probably choose stratumv2 as the standard
  3. Setup liquidity pool in ckBTC and payout and reward schema for miners
  4. Build the interface for miners

On a sidenote, we had launch our “shadow” mining pool that works by accepting hashrate transfer from bitcoin miners using existing mining pool (f2pool)

  • convert aggregate mining reward to ckBTC
  • miners can withdraw mining reward everyday no matter how small in ckBTC
  • they can also convert to USDT-Arbitrum & offramp to local currency (soon)

small but growing miners community from Indonesia had already started using it.
It’s live on https://miner.lokamining.com

We’re a small team with some VC funding in our pre-seed, now starts actively recruiting ICP + Rust devs that have in-depth expertise or interest in BTC & mining pool.

If you know such a person, please refer to us!

5 Likes

Full Bitcoin node will be larger than 500GB, and you must sync historical data, so do you mean a full bitcoin node runs on different ICP canisters? (Distributed) And how?

1 Like

Yes, full Bitcoin node, distributed.

Full node sits around 700 GB right now with -txindex flag. So yes, will have to be on multiple canisters. Shouldn’t be too crazy though. Maybe 15 canisters with ~47GB each. It will cost a few thousand dollars to upload all of that data, and then another couple thousand every year for storage.

The most important thing is that the canister can gossip with other Bitcoin node peers so the canister always has an up-to-date mempool. And then the canister has all of the information it needs to verify that every transaction selected for the block conforms to Bitcoin consensus rules. Then it would need to actually create that Bitcoin transaction (when it finds a new block) and broadcast that to the Bitcoin network.

5 Likes

Do you have a name and landing page/Twitter/Discord for the project yet? I would like to have a link and name to start sharing with people.

1 Like

It will be under our main project: Loka Mining
X = https://x.com/lokamining
Website = https://lokamining.com
About page = About Loka
Discord = Loka Mining

Havent put this plan officially in the roadmap or mention on the website yet btw- - will be soon.

3 Likes

Why use a full node vs a light node like the one we’re current using for the Bitcoin integration?

2 Likes

I think you’re right. Had a discussion with @lastmjs and @bob11 just now – full node is needed to be fully independent from other nodes to verify transactions, but building this on-chain going to be a huge development effort.

We’ll start with the light node first to speed up our dev time.

3 Likes

How would other bitcoin nodes peer up with the node in the canister?

Do you mean when it mines a new block? Can a canister execute for enough time to mine a block? Even if it could, can it have any meaningful chance of winning against the “traditional” nodes?

2 Likes

I agree that this is a more straightforward approach.
A decentralized Bitcoin mining pool can be built but, given the API that the Bitcoin canister exposes, the pool needs to operate a bit differently.
Once you have a design document ready, I’d be happy to review it.

8 Likes

I agree, keeping it simple is the way to go. Building a decentralized Bitcoin mining pool sounds interesting, but we might need to tweak how it operates because of the API

UPDATES

TL;DR:

  • Launched our mining pool aggregator few while ago with quite some traction from miners from Asia
  • Fasttracking acquisition by partner up with a leading Bitcoin hosting firm to supply hashrates to us
  • Launched new website

Cold Start Problem & GTM strategy

To boot up a mining pool that directly sending hashrates and receive mining reward directly from the network, economically we would need around 0.1% total hashrates in the world so that statistically we’re getting new block every week.

In this current network difficulty, that would equates to around 6,000 ASIC machines with 20MW electricity absorption.

So what we launched first is a mining pool “aggregator” that basically accept hashrates on our stratum server and forward them to other mining pools for now. It has already live since a while ago; you can check here: https://pool.lokamining.com

Our miners got benefit by being able to withdraw their mining rewards immediately without minimum threshold or fees because we’re converting the BTC to ckBTC.

And along with new smaller miners joining in our pool, we’re also speeding up by partnering with a leading bitcoin hosting company that operates in Finland & Ethiopia that specializes in renewable energy (look ma I’m featured in Coindesk).

Next steps ahead

Eventually the goal is to launch the forward hashrate marketplace protocol that connects miners directly to investors. Now that we already have some groundworks and growing community of miners, we’re several steps closer.

Next month we’re going to launch liquidity mining program for the upcoming mining pool – basically the idea is giving reward tokens to both sides of the protocol;

  • Miners for sending their hashrates
  • LP for supplying their ckBTC on the Bitcoin liquidity pool (you can unlock/withdraw anytime)

This reward token may worth something in native token airdrop after the TGE – but we can’t promise anything :wink:

We haven’t announce anything yet – stay tune and please follow our X or join our TG :slight_smile:

5 Likes

I’m really impressed with the website. I really like it. I need to start reading up on providing liquidity and how that works but immediately when I saw that Loka mining was in development and what it was capable of I was very excited. I plan to provide liquidity as things develop as well as invest should you guys tokenize via SNS. I’m gonna read more about you guys and how it all works but everything is looking good so far and I’m glad to see you guys still working. I think this will be big for BTC & ICP.

1 Like