Timelock: time-release encryption incentivised by Bitcoins

Timelock: time-release encryption incentivised by Bitcoins
From: Peter Todd @ 2014-06-04 12:54 UTC (permalink / raw)
  To: bitcoin-development;  Amir Taaki

[-- Attachment #1: Type: text/plain, Size: 15959 bytes --]

Decided to take a break yesterday and write some code...


Timelock
========

Create a secret key that can be decrypted in a known amount of time
using parallel-serial hash chains. The creator can compute the timelock
in parallel, taking advantage of the large amount of cheap parallelism
available today, while others are forced to compute it serially,
constrained by the lack of scalar performance growth.

The chains are constructed such that Bitcoin addresses can be derived
from them and bounties placed, incentivizing third-parties to crack the
timelocks. This gives us a valuable chance to incentivize others to push
the envelope of scalar performance - important knowledge if we are going
to have any hope of knowing how soon our timelocked secrets will
actually be revealed! The Bitcoin secret keys and addresses are
constructed from the chains as follows:

    iv -> <chain> -> privkey -> pubkey -> secret -> hashed_secret

    secret        = SHA256(pubkey)
    hashed_secret = RIPEMD160(secret)

Unlocking a given chain starting from the initialization vector gives
the person doing the work the private key, giving them an exclusive
opportunity to collect the bounty. Collecting that bounty forces them to
reveal the pubkey, from which the secret is derived. The hashed_secret
is then just a standard Bitcoin address, letting everyone see how large
the bounty is for unlocking the timelock.

Only a single algorithm - SHA256 - is supported by design: timelock
encryption works best if we're all on an even playing field.

Sourcecode: https://github.com/petertodd/timelock

Credit goes to Amir Taaki for helping develop the idea.


To make things interesting I've made a ~256 hour timelock with 32
chains, 8 hours per chain. The addresses associated are as follows:

1ERvMr5J8FETF7zj4QM98u8ZANaL1o9XGZ
18h7LwKpd9c6u8zJka3vMCASa8BfbiZFd4
1DBJDp57QmbigLEbUsFeqJT3mkArGzH3gv
1C1d6Tj7mZADurfj5yJ64p5BeRstquk7pu
1FsH58jnq5Kc6D7hb7vmUhjh8fwnijiWss
1PDwPYStrrkKpGtV2zX71XCDYL3E2g3KM7
1BF6oYLeTG7WxNWJjC8p4SHz62q7vgZhXX
1DxFiHr9ehVvi8JR2Cc5pcD4DEURUeFFda
1NKg3buX5BzhYgSY6Yvws9kMqZ6F1xnneD
1Kptov9sgDqQcavz1rVsuQvfi8PcQcL4rc
1P9k1HEfe3Z8LaiFejqsuDLjWXPZk1coDL
1Mw25mU89Wp2b9zyMCSnjAVQ7x4AVWx3sf
1B8gdbd1StpVnV99Few1ae1XXfKH6iry1D
13bisx8T42CzmFA2oAm1evEytcijrHJ2iR
1DyR6aNSbrJCzwqdeo9UN5obGR9L73Y2sa
1Fx7j3gU3q7bQdoni2zZhGQx7BnLt8xNeK
19q541m17opVcAxwisem7ak7YPuSpdS3Uj
1DYWzBpLBDd7fpta2JYLf7QZ7nAYiZiamR
13sZYBMdyzffwvCkzhGTu49pCGGR5C5B9v
1DFSjViJLTNhNj5wvsqRwoqPyR9UTAzLgW
13Zi9eawpkzZwRC8RgHJausQmUS4ECBzho
1BCQ5GVkAEzNYZ5WroAwXSspgpYfhQrojd
1K1gbE7qGLwbJDEoRyrCGxCsgJ4mHcFKwP
14Z4EawE1Kd3HRut43vWjgYUWYR3ZV5i2p
1NZTFVXVzKXvPMsFKZfkhZCBcbzqm7cGCj
1GFBBahQC5DzpLuJc6X1yVvvSKP2kCpUGf
184PkQFdzhPR3TjoCxddsNK7sr3DVVhJ45
14SLK5fXWdajoQZ2AX5WmAGbvRtLpdTgMq
1LagrzYykb8w4NveKrw2SDcpKMezwxX72Z
16XdtV2U3ksdhKkByRpiq3VN61aB62Ndgh
1Mu1SaUBu7aV4DHzEc4hxcgGzaYWdvuaAh
1EJWWxwZckP9eLS2VzgbUwqzxFDZKZcF9b

I've funded them with 10mBTC each, 320mBTC total. The full timelock
definition is as follows:

{
    "chains": [
        {
            "algorithm": "sha256", 
            "encrypted_iv": null, 
            "hashed_secret": "1ERvMr5J8FETF7zj4QM98u8ZANaL1o9XGZ", 
            "i": 0, 
            "iv": "353b124909ec8774325d3f2f6b0a01c839e79e3ce687ee6e893310368afdf336", 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "495c6092c9004dc23c2deefb1db1deba88f8895a319f5d9f7ce8a53b2a9ecfe9", 
            "hashed_secret": "18h7LwKpd9c6u8zJka3vMCASa8BfbiZFd4", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "8cbdf731374a71f22d59251890997ea001c2efa6e9c0bf808700c3d432ccf269", 
            "hashed_secret": "1DBJDp57QmbigLEbUsFeqJT3mkArGzH3gv", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "bc4d75fa5ec8f28e121cd73806ce058e82036577130cffb3bd596f2aa59b2a7f", 
            "hashed_secret": "1C1d6Tj7mZADurfj5yJ64p5BeRstquk7pu", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "80c622521c7aed318dac2b3c7d929e4e504d3c60650009b1abc0bae18fff979b", 
            "hashed_secret": "1FsH58jnq5Kc6D7hb7vmUhjh8fwnijiWss", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "1ba76f9a694f987e1758dbc65cf104984dbedfae01b134fe09135b64cb8c4034", 
            "hashed_secret": "1PDwPYStrrkKpGtV2zX71XCDYL3E2g3KM7", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "1cedd5a71a96f439c20e9f4f5957b8c159b23d472063fa07a05121333888cdf5", 
            "hashed_secret": "1BF6oYLeTG7WxNWJjC8p4SHz62q7vgZhXX", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "30d88e0fd113ce38d22a210012914e5331bd89dda408d85dfa9e9bfcbd40d8eb", 
            "hashed_secret": "1DxFiHr9ehVvi8JR2Cc5pcD4DEURUeFFda", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "5e654bfc1534b03e45548b59d407518b5915c3ae51c266e374ea8a368f72433c", 
            "hashed_secret": "1NKg3buX5BzhYgSY6Yvws9kMqZ6F1xnneD", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "10095f9aa85ceb221d00975a1db66fcffcae516c1d3d5dee66995567522f68ab", 
            "hashed_secret": "1Kptov9sgDqQcavz1rVsuQvfi8PcQcL4rc", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "6ecfd5282c650b1ebabbf39f5e72dd0e8e9724456e6b357e83c53a9a144b49eb", 
            "hashed_secret": "1P9k1HEfe3Z8LaiFejqsuDLjWXPZk1coDL", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "197796e5010f189165c2010cd7cfb0f3b933670276231292555b5540765bb6fa", 
            "hashed_secret": "1Mw25mU89Wp2b9zyMCSnjAVQ7x4AVWx3sf", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "58fe436839724b03f3ffd41e864d5dc030de2eeb5a3c4df19ed65ef9abe21cc2", 
            "hashed_secret": "1B8gdbd1StpVnV99Few1ae1XXfKH6iry1D", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "d2af3dd9cdfbb081149212ead19cbd85f6dcc31177de586d1c6dd6139c16141f", 
            "hashed_secret": "13bisx8T42CzmFA2oAm1evEytcijrHJ2iR", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "512f20d2a4f342cb635d5c73a0c3ad30272bdd84d73f2bb0f2849d17557f162f", 
            "hashed_secret": "1DyR6aNSbrJCzwqdeo9UN5obGR9L73Y2sa", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "75cb98d4abfd84318347220547f017f8285333dd55b41622c9220ece49e227e2", 
            "hashed_secret": "1Fx7j3gU3q7bQdoni2zZhGQx7BnLt8xNeK", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "d1d264674ba9b1c4baba189809a0d37ca4b8f402f91a145303907c3730ff890c", 
            "hashed_secret": "19q541m17opVcAxwisem7ak7YPuSpdS3Uj", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "31f2df6ae00e118f72063cb640c150bad5c0c015d12533826439d45f593ebb89", 
            "hashed_secret": "1DYWzBpLBDd7fpta2JYLf7QZ7nAYiZiamR", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "8113452a165b673957f6d707f19d6b407683499ef6a08e03ba35ca79306b8e3b", 
            "hashed_secret": "13sZYBMdyzffwvCkzhGTu49pCGGR5C5B9v", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "c0b8e246cd4a2a1abe760b1d2763931c8e04960e6a2e69f0f6723dd4892413ae", 
            "hashed_secret": "1DFSjViJLTNhNj5wvsqRwoqPyR9UTAzLgW", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "c4d0bc902093f21e1745193345909e080dee5b4cc410108a637ded75fcdc9e01", 
            "hashed_secret": "13Zi9eawpkzZwRC8RgHJausQmUS4ECBzho", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "588d778adb3180a9783781a175171790d8099d7942190fa853b235262c074a99", 
            "hashed_secret": "1BCQ5GVkAEzNYZ5WroAwXSspgpYfhQrojd", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "643b3afe4b674b44fee943507559d6218c5f53671ab01b09c8aaafa65f9f2e37", 
            "hashed_secret": "1K1gbE7qGLwbJDEoRyrCGxCsgJ4mHcFKwP", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "62e65d48eb215734c00165130027a6cb04842d95cc570a278968f7070d41936f", 
            "hashed_secret": "14Z4EawE1Kd3HRut43vWjgYUWYR3ZV5i2p", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "f89566d49c4765522cd382c16589486b90702cc99caff6801a4e8b504694ab6b", 
            "hashed_secret": "1NZTFVXVzKXvPMsFKZfkhZCBcbzqm7cGCj", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "3d9acd9785f12890b88f30576d81d583ba0ada2d98c9a17f6cc79a0ed1b7e027", 
            "hashed_secret": "1GFBBahQC5DzpLuJc6X1yVvvSKP2kCpUGf", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "4d886799cfef728add5c14b27e780f96511b78060d86d3b77b0d0ed5130f6f02", 
            "hashed_secret": "184PkQFdzhPR3TjoCxddsNK7sr3DVVhJ45", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "24b495c95129ca0062297b019af3684b12303382e4282e032ba5fd2ab805b127", 
            "hashed_secret": "14SLK5fXWdajoQZ2AX5WmAGbvRtLpdTgMq", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "0eec24b55713a85a41c996904def8f8b5b61a9efa2491dacf63f7161a71a6514", 
            "hashed_secret": "1LagrzYykb8w4NveKrw2SDcpKMezwxX72Z", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "1b3ecc11b7f6cd80a5111b11a15fa2cb8b1c006041f8ad5b7c7316947de2e3fa", 
            "hashed_secret": "16XdtV2U3ksdhKkByRpiq3VN61aB62Ndgh", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "7fed7012e601fb9431d48c072d060c391b1985fd9717d51b12bbcb7e271f656f", 
            "hashed_secret": "1Mu1SaUBu7aV4DHzEc4hxcgGzaYWdvuaAh", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }, 
        {
            "algorithm": "sha256", 
            "encrypted_iv": "7f3a0c156be2c08714b9296999dddca8c178385e145aa3156ea00ffd742075f8", 
            "hashed_secret": "1EJWWxwZckP9eLS2VzgbUwqzxFDZKZcF9b", 
            "i": 0, 
            "iv": null, 
            "midstate": null, 
            "n": 86400000000, 
            "seckey": null, 
            "secret": null
        }
    ], 
    "version": 1
}

-- 
'peter'[:-1]@petertodd.org
00000000000000002d204cce4ee5e7976a0a485d658b4a15ebf31cdbce8a4915

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 685 bytes --]

 permalink raw reply	[|nested]