While you cannot use the bitcoin mining power itself to crack selected passwords, bitcoin makes it for the first time possible to encode and ensure monetary rewards for password cracking through self-enforcing contracts.
For example, you could lock up funds in a transaction that are redeemable only provided that a specific puzzle has been cracked. This can be written as a bitcoin script (scriptPubKey) which takes as input a candidate solution to the puzzle (as scriptSig) and checks that it is a solution. In formal languages lingo, given a language L = { x: R(x, w) = 1 }
such that R
is polynomially computable (and so R
being in P
and L
being in NP
), you can solve the search problem of finding a w
given an x
in L
by encoding R
as a scriptPubKey and expecting a w
as a scriptSig.
As an example, imagine you wish to find the pre-image of a given SHA256 hash. Your bitcoin redeem script could then look like this:
def spend(witness):
if SHA256(witness) == 6fe28c0...00000:
return True
return False
Indeed, the only way to spend this script is by providing a witness that cracks this problem. In formal languages lingo, in this case x = 6fe28c0...00000
and w
is the witness.
Coding it in the bitcoin script language, we get:
OP_HASH256
6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000
OP_EQUAL
In fact, this very transaction was published on the bitcoin network four years ago and paid 1 BTC to have this puzzle solved.
Interestingly, notice that if the puzzle remains unsolved, the money is forever lost – that money is solely dedicated to the puzzle solver, and if there is no one, then no one can get the money. As a sidenode, notice that this kind of transaction is not secure, as the puzzle solver will have to disclose the scriptSig in order to spend the tx – meaning that anyone can double-spend the same amount immediately before the original tx gets confirmed. There are ways to guard against such attacks by performing more complicated schemata, such as revealing the secret in a two-block process possible in Ethereum.