【问题标题】:HTLC implementation manuallyHTLC 手动实现
【发布时间】:2019-05-07 10:13:57
【问题描述】:

有没有办法手动实现HTLC来锁定闪电网络通道中的资金,并在时间锁定到期后释放资金。

【问题讨论】:

    标签: node.js bitcoin lightning-network


    【解决方案1】:

    https://bitcoin.stackexchange.com 上问这个问题可能会更好,但是如果您查看BOLT 03 transactions 上的闪电网络规范(又名 BOLT),例如,您会发现这个用于承诺交易的脚本

    # To remote node with revocation key
    OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
    OP_IF
        OP_CHECKSIG
    OP_ELSE
        <remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
        OP_NOTIF
            # To local node via HTLC-timeout transaction (timelocked).
            OP_DROP 2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
        OP_ELSE
            # To remote node with preimage.
            OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
            OP_CHECKSIG
        OP_ENDIF
    OP_ENDIF
    

    还要注意有一个standalone BIP 199 which is still a draft but specifies how to work with htlcs

    【讨论】:

    • 知道如何使用这些脚本吗?
    • 是的,您将它们放入比特币交易中,并在验证区块时执行它们。
    猜你喜欢
    • 2010-10-04
    • 2021-03-17
    • 2018-02-15
    • 1970-01-01
    • 2018-04-06
    • 2014-01-27
    • 2019-11-22
    • 1970-01-01
    • 2019-07-11
    相关资源
    最近更新 更多