<<  >> (p.8)
    Author Topic: Optional Hourglass is now deployed  (Read 144 times)
    stwenhao (OP)
    Hero Member
    *****
    Offline

    Activity: 715
    Merit: 1929


    View Profile
    August 29, 2025, 09:02:38 AM
     #1

    There are many quantum proposals. Some are better, some are worse, but when it comes to deployed things, there is a lot of silence. To change it, I tried to deploy one of competing proposals, in a no-fork way. And it seems that Hourglass can be used right away, without any consensus changes, as long as it will be left optional, and users will voluntarily join, by moving their coins to specific P2WSH scripts.

    Here is the optional Hourglass envelope:
    Code:
    Input: <signature> <pubkey>
    Output: OP_SWAP OP_SIZE OP_DUP OP_ADD OP_DUP OP_ADD OP_CHECKSEQUENCEVERIFY OP_DROP OP_SWAP OP_CODESEPARATOR OP_DUP OP_HASH160 <pubkeyHash> OP_EQUALVERIFY OP_CHECKSIG

    Execution:

    <signature> <pubkey>
    <pubkey> <signature>
    <pubkey> <signature> <sigSize>
    <pubkey> <signature> <sigSize> <sigSize>
    <pubkey> <signature> <sigSize*2>
    <pubkey> <signature> <sigSize*2> <sigSize*2>
    <pubkey> <signature> <sigSize*4>
    <pubkey> <signature> <sigSize*4>
    <pubkey> <signature>
    <signature> <pubkey>
    <signature> <pubkey>
    <signature> <pubkey> <pubkey>
    <signature> <pubkey> <pubkeyHash>
    <signature> <pubkey> <pubkeyHash> <pubkeyHash>
    <signature> <pubkey>
    OP_TRUE
    To make it, all that is needed, is to take existing P2WPKH address, where coins are sent to 160-bit hash of the public key, and wrap it into the Script above. For example, if the private key is equal to one, and the public key is equal to the generator, then it can look like that:
    Code:
    decodescript 210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ac
    {
      "asm": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 OP_CHECKSIG",
      "desc": "pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)#gn28ywm7",
      "type": "pubkey",
      "p2sh": "2MvVwHhgE2JyjkjQk72CghrhrJsanKfHfqe",
      "segwit": {
        "asm": "0 751e76e8199196d454941c45d1b3a323f1433bd6",
        "desc": "addr(tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx)#0wnhlaqf",
        "hex": "0014751e76e8199196d454941c45d1b3a323f1433bd6",
        "address": "tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx",
        "type": "witness_v0_keyhash",
        "p2sh-segwit": "2NAUYAHhujozruyzpsFRP63mbrdaU5wnEpN"
      }
    }
    decodescript 7c8276937693b2757cab76a914751e76e8199196d454941c45d1b3a323f1433bd688ac
    {
      "asm": "OP_SWAP OP_SIZE OP_DUP OP_ADD OP_DUP OP_ADD OP_CHECKSEQUENCEVERIFY OP_DROP OP_SWAP OP_CODESEPARATOR OP_DUP OP_HASH160 751e76e8199196d454941c45d1b3a323f1433bd6 OP_EQUALVERIFY OP_CHECKSIG",
      "desc": "raw(7c8276937693b2757cab76a914751e76e8199196d454941c45d1b3a323f1433bd688ac)#9hnlfmtv",
      "type": "nonstandard",
      "p2sh": "2Mzw53ZN8wS8FXvNpMFkGjfP3i3hCTAhcbV",
      "segwit": {
        "asm": "0 3062edde70aad88f218ed97aa51f6003baeb94c4c4d876d86ddf8dce6f5d4c06",
        "desc": "addr(tb1qxp3wmhns4tvg7gvwm9a228mqqwawh9xycnv8dkrdm7xuum6afsrqcuzu88)#y06denaf",
        "hex": "00203062edde70aad88f218ed97aa51f6003baeb94c4c4d876d86ddf8dce6f5d4c06",
        "address": "tb1qxp3wmhns4tvg7gvwm9a228mqqwawh9xycnv8dkrdm7xuum6afsrqcuzu88",
        "type": "witness_v0_scripthash",
        "p2sh-segwit": "2N8BaDhNcPriSpqLqNKWBc1uPXhRMDuA7To"
      }
    }
    And then, coins can be sent for example to tb1qxp3wmhns4tvg7gvwm9a228mqqwawh9xycnv8dkrdm7xuum6afsrqcuzu88. Then, as long as the private key is unknown, everything will work just like for regular P2WPKH, which is tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx in this case. For signatures taking around 72 bytes, coins will be timelocked to 288 blocks (around two days), but other than that, it can work just like its P2WPKH equivalent (and it can be signed in exactly the same way, because of used OP_CODESEPARATOR, so there is no need to change signing code).

    However, when the private key will be known, then coins will be protected by a Proof of Work challenge. Lowering signature size by a single byte will allow moving them 4 blocks earlier. Which means, that even if both secp256k1 and SHA-256 will be fully broken, then 9-byte signature will still timelock coins for 36 blocks (around 6 hours). And if for example only secp256k1 will be broken, then some 40-byte signature will still need to wait 160 blocks, so it usually means more than one day of delay.

    What do you think about it? Also, as usual, check things in test networks first, before moving any of your mainnet coins to such addresses.

    Note: I slightly modified my idea from my mailing list post, because if the public key is wrapped behind OP_HASH160, and separated from the rest of the Script with OP_CODESEPARATOR, then it is more compatible with P2WPKH, and also, revealing the Script under P2WSH can be done, without revealing the corresponding public key.

    Proof of Work puzzle in mainnet, testnet4 and signet.
Page 7
Viewing Page: 8