pull down to refresh

This will be a series of increasingly difficult Bitcoin math puzzles, designed to walk through the game theory of various bitcoin scenarios in a formal way. We're currently taking a look at selfish mining.

We're now on question 2. We've developed preliminaries and notation, and are now ready to write down the full recursive Bellman equation. Take me to the problems

Also, cool thing: based on my understanding of the literature on selfish mining, this approach is new relative to the literature, which did not set up their models with things like continuous time discounting and flow-rate of costs. If we solve this, it could be a genuine contribution to the literature! Since I am not really part of that literature, I am happy for others to take this idea and run with it, or even to collaborate. If no one does, I may do it myself as well.


Model SetupModel Setup

There are two miners, Alice and Bob. Bob is an honest miner and always mines on the public (longest) chain. Alice is a potentially honest, potentially selfish miner who can decide to mine on the public chain, or to secretly work on a private chain, only to publicly broadcast her private chain later.

For the purposes of this problem, we'll use the notation set forth in these posts: #1473180, #1475564, and #1477308.

In particular, we'll assume the following:

  • Alice has a hash rate of , measured in EH/s
  • Bob has a hash rate of , measured in EH/s
  • Alice's hash rate is less than Bob's:
  • The effective difficulty is , measured in EH. Effective difficulty is the average number of exahashes required to find a block
  • The block reward for a found block is , measured in sats (includes any transaction fees, which we'll assume are constant and deterministic)
  • The cost to produce 1 exahash is , measured in sats per EH, for both Alice and Bob
  • The discount rate is , measured in percent per year, for both Alice and Bob

For now, we'll ignore difficulty adjustments, ignore block subsidy halvings, and ignore latency.


PreliminariesPreliminaries

Based on the above assumptions, we can say the following:

  • Alice's block finding rate is
  • Bob's block finding rate is
  • At any given moment, the probability that Alice finds the next block is
  • At any given moment, the probability that Bob finds the next block is
  • The average amount of time for Alice to find a block is
  • The average amount of time for Bob to find a block is

Description of selfish miningDescription of selfish mining

Whenever Alice and Bob are both mining on the same public chain, we'll call that chain C.

If Bob finds the next block, the chain becomes C-B. He immediately publishes it, and both Alice and Bob will mine on that new chain. Since they're both mining on the same chain, we rename C-B → C.

If Alice finds the next block, she now has chain C-A. Since Alice is selfish, she can decide whether to publish it or not.

  • If she publishes it, the public chain becomes C-A and both Alice and Bob will mine on it, so we rename C-A → C.
  • If, however, Alice decides to hide her private chain, the two miners are now mining on different chains. Alice is now mining on C-A and Bob is now mining on C. If Bob finds the next block after that, Alice now has C-A and Bob has C-B. However, if Alice finds the next block after that, she now has C-A-A while Bob still has C. Alice can again decide whether she wants to publish C-A-A, or to keep it private.

In other words, Bob always publishes any block he finds, and always mines on top of the longest chain. Alice, when she finds a block, may decide whether to keep her chain private and mine on it secretly, or to publicize her chain.

In this series of problems, we're going to derive conditions under which Alice has an incentive to not publish her chain, but rather to mine privately.


Value function and state notationValue function and state notation

The strategic state space can be described by two numbers, a and b. a measures how many blocks Alice has mined on top of C in her private chain, and b measures how many blocks Bob has mined on top of C in the public chain (only when the private chain and the public chain diverge).

So for example:

  • If Alice is mining on C-A while Bob is mining on C, then (a,b) = (1,0).
  • If Alice is mining on C-A while Bob is mining on C-B, then (a,b) = (1,1).
  • If Alice is mining on C-A-A while Bob is mining on C, then (a,b) = (2,0).
  • If Alice and Bob are both mining on C, then (a,b) = (0,0).
  • In fact, if at any time Alice and Bob are both mining on the same public chain, then (a,b) = (0,0).
  • If Alice ever publishes her private chain which is ahead of the public chain, the state resets to (a,b) = (0,0) because Bob always mines on the longest published chain.

Let be Alice's value function in state (a,b) (i.e. the net present value of mining while the state is a, b).

Let be Alice's value function of publishing her private chain while in state (a,b). We note that:

This is because if Alice publishes when , then her chain becomes the longest public chain (which Bob now mines on), and she earns the accumulated rewards she had hidden up to this point. But if she publishes when , her chain is not the longest and will not be accepted as the public chain.


ProblemsProblems

  1. Write a Bellman equation for the value function .

    Solved (#1480916):
  2. Now write the generic Bellman equation for the value function in any state.

Bounty: 1000 sats to the best answer with explanation. Suspected AI use will be ignored.

If I make a mistake in my puzzles, please do let me know. We're working this through together!


Hint on Bellman equations

If the current state is that gives flow utility , and two possible events could happen, event 1 and event 2, with Poisson rates and , and event 1 pushes you into state while event 2 pushes you into state , the Bellman equation would be:

1,000 sats bounty
SimpleStacker's bounties

It's like you don't even want to win ~econ prizes

reply

It's like you don't even want to solve recursive Bellman equations

reply

It do be like that

reply

i even set up the state space beautifully! you're missing the alley oop!

reply

I might get out some paper and a pencil tomorrow at work, if no one else has gotten it.

reply

I think @Murch has been the only other one who has engaged

It's actually not hard, but just too notation heavy for most people I think. But I can't really think of a way to do it with less notation.

reply

The main difference seems to be that the chain doesn't trivially reduce if Bob finds the next block after Alice has chosen not to publish a previous block, so you have to include that possibility as well.

reply

This is almost correct, except Alice still has to decide whether to publish what she has when Bob finds the next block, or keep mining privately.

So the correct equation is:

I'll give you the bounty since it was close enough.

The trick is now figuring out when , i.e. when it would be preferable to mine in secret versus publishing.

71 sats \ 1 reply \ @Murch 7 May

I’m attending a workshop this week, I’ll have to skip this one, sorry.

reply

no worries, feel free to try it whenever

Other people aren't doing graduate macro for fun?

reply

I started off thinking the math would be fairly simple, then realized that the right way to do it would have to be continuous time dynamic programming

THE 1,000 SATS ARE GHOSTING. * Target:https://www.google.com/search?q=https://stacker.news/items/1469360

  • Answer: 232,792,560
  • Logic: $16 \cdot 9 \cdot 5 \cdot 7 \cdot 11 \cdot 13 \cdot 17 \cdot 19 = 232,792,560$.

Smallest positive number divisible by 1-20: 232,792,560.

Mathematical Logic:

The LCM(1..20) is the product of prime powers $p^k$ where $p^k \le 20$:

$2^4 = 16$, $3^2 = 9$, $5^1 = 5$, $7^1 = 7$, $11^1 = 11$, $13^1 = 13$, $17^1 = 17$, $19^1 = 19$.

Calculation: $16 \times 9 \times 5 \times 7 \times 11 \times 13 \times 17 \times 19 = 232,792,560$.

The smallest positive number evenly divisible by all numbers from 1 to 20 is 232,792,560.

Mathematical Reasoning:

The Least Common Multiple (LCM) for a range of integers is the product of the highest power of each prime $p \le n$. For $n=20$:

  • $2^4 = 16$
  • $3^2 = 9$
  • $5^1 = 5$
  • $7^1 = 7$
  • $11^1 = 11$
  • $13^1 = 13$
  • $17^1 = 17$
  • $19^1 = 19$

Calculation: $16 \times 9 \times 5 \times 7 \times 11 \times 13 \times 17 \times 19 = 232,792,560$.