[bitcoin-dev] Trustless hash-price insurance contracts

Lucas H lucash.dev at gmail.com
Fri Oct 18 22:01:54 UTC 2019


Hi,

This is my first post to this list -- even though I did some tiny
contributions to bitcoin core I feel quite a beginner -- so if my idea is
stupid, already known, or too off-topic, just let me know.

TL;DR: a trustless contract that guarantees minimum profitability of a
mining operation -- in case Bitcoin/hash price goes too low. It can be
trustless bc we can use the assumption that the price of hashing is low to
unlock funds.

The problem:

A miner invests in new mining equipment, but if the hash-rate goes up too
much (the price he is paid for a hash goes down by too much) he will have a
loss.

Solution: trustless hash-price insurance contract (or can we call it an
option to sell hashes at a given price?)

An insurer who believes that it's unlikely the price of a hash will go down
a lot negotiates a contract with the miner implemented as a Bitcoin
transaction:

Inputs: a deposit from the insurer and a premium payment by the miner
Output1: simply the premium payment to the insurer
Output2 -- that's the actual insurance
  There are three OR'ed conditions for paying it:
  A. After expiry date (in blocks) insurer can spend
  B. Both miner and insurer can spend at any time by mutual agreement
  C. Before expiry, miner can spend by providing **a pre-image that
produces a hash within certain difficulty constraints**

The thing that makes it a hash-price insurance (or option, pardon my lack
of precise financial jargon), is that if hashing becomes cheap enough, it
becomes profitable to spend resources finding a suitable pre-image, rather
than mining Bitcoin.
Of course, both parties can reach an agreement that doesn't require
actually spending these resources -- so the miner can still mine Bitcoin
and compensate for the lower-than-expected reward with part of the
insurance deposit.
If the price doesn't go down enough, the miner just mines Bitcoin and the
insurer gets his deposit back.
It's basically an instrument for guaranteeing a minimum profitability of
the mining operation.

Implementation issues: unfortunately we can't do arithmetic comparison with
long integers >32bit in the script, so implementation of the difficulty
requirement needs to be hacky. I think we can use the hashes of one or more
pre-images with a given short length, and the miner has to provide the
exact pre-images. The pre-images are chosen by the insurer, and we would
need a "honesty" deposit or other mechanism to punish the insurer if he
chooses a hash that doesn't correspond to any short-length pre-image. I'm
not sure about this implementation though, maybe we actually need new
opcodes.

What do you guys think?
Thanks for reading it all! Hope it was worth your time!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20191018/02afb5ce/attachment.html>


More information about the bitcoin-dev mailing list