What is Micropayment Channels?

NO IMAGE

How It Works In Short

This explanation is for quick understanding. Detail comes later.

For example, when Alice wants to send 100 Satoshi many times to Bob,

1: Create Alice and Bob’s 2-of-2 multisig address

Funding the channel (ex. 1000 satoshis):

2: Alice deposits 1000 satoshis in 2-of-2 multisig address BUT HOLDS THE TRANSACTION. DOES NOT BROADCAST.
3: Set time limit refund of 1000 satoshis sent in #2 to Alice by using nLockTime and get Bob to sign it.
4: Once Alice receives the signed nLockTime from Bob, Alice broadcasts the 1000 satoshis to 2-of-2 mutisig address from #2.

Spending money in-channel (ex. 100 satoshis):

5: Set time limit refund of 900 satoshis with 1 output to Bob with 100 satoshis. The nLockTime should be EARLIER than the funding refund from #3. Bob receives the signed transaction from Alice and holds on to it. (does not broadcast)
6: Bob can always redeem the 100 satoshi transaction EARLIER than Alice can redeem hers in the event of Alice being a thief. Also, Alice can always get her money back minus any money she agreed to send in the micropayment channel. By Bob or Alice broadcasting their transactions.

Settling channel:

7: Alice signs a transaction with no nLockTime and the proper outputs going to Alice and Bob. Bob checks that those are correct, and signs then broadcasts. The 2-of-2 multisig is now empty.

Pros and Cons

Pros

  • Faster confirmations
  • Lower fees
  • Less blockchain transactions (off-chain)

Cons

  • You have to deposit some BTC first
  • More complex

Prerequisite Knowledge

  • How Bitcoin transaction works
  • How Bitcoin script works
  • nLockTime
  • Multi-sigunature
  • BIP

How It Works In Detail

Quote from Bitcoin Wiki

We define the client to be the party sending value, and the server to be the party receiving it. This is written from the clients perspective.

Create a public key (K1). Request a public key from the server (K2).
Create and sign but do not broadcast a transaction (T1) that sets up a payment of (for example) 10 BTC to an output requiring both the server’s private key and one of your own to be used. A good way to do this is use OP_CHECKMULTISIG. The value to be used is chosen as an efficiency tradeoff.
Create a refund transaction (T2) that is connected to the output of T1 which sends all the money back to yourself. It has a time lock set for some time in the future, for instance a few hours. Don’t sign it, and provide the unsigned transaction to the server. By convention, the output script is “2 K1 K2 2 CHECKMULTISIG”
The server signs T2 using its private key associated with K2 and returns the signature to the client. Note that it has not seen T1 at this point, just the hash (which is in the unsigned T2).
The client verifies the servers signature is correct and aborts if not.
The client signs T1 and passes the signature to the server, which now broadcasts the transaction (either party can do this if they both have connectivity). This locks in the money.
The client then creates a new transaction, T3, which connects to T1 like the refund transaction does and has two outputs. One goes to K1 and the other goes to K2. It starts out with all value allocated to the first output (K1), ie, it does the same thing as the refund transaction but is not time locked. The client signs T3 and provides the transaction and signature to the server.
The server verifies the output to itself is of the expected size and verifies the client’s provided signature is correct.
When the client wishes to pay the server, it adjusts its copy of T3 to allocate more value to the server’s output and less to its own. It then re-signs the new T3 and sends the signature to the server. It does not have to send the whole transaction, just the signature and the amount to increment by is sufficient. The server adjusts its copy of T3 to match the new amounts, verifies the signature and continues.
This continues until the session ends, or the 1-day period is getting close to expiry. The AP then signs and broadcasts the last transaction it saw, allocating the final amount to itself. The refund transaction is needed to handle the case where the server disappears or halts at any point, leaving the allocated value in limbo. If this happens then once the time lock has expired the client can broadcast the refund transaction and get back all the money.

Quote from

  • Bitcoin Wiki: Example 7: Rapidly-adjusted (micro)payments to a pre-determined party

Developer Guide – Bitcoin at bitcoin.org

Documents

Use Cases

Startup

Library

Thanks

Thank you for the review to

  • Jonathan Underwood
     

免責事項

本記事に掲載されている記事の内容につきましては、正しい情報を提供することに務めてはおりますが、提供している記事の内容及び参考資料からいかなる損失や損害などの被害が発生したとしても、弊社では責任を負いかねます。実施される際には、法律事務所にご相談ください。

技術・サービス・実装方法等のレビュー、その他解説・分析・意見につきましてはblock-chani.jp運営者の個人的見解です。正確性・正当性を保証するものではありません。本記事掲載の記事内容のご利用は読者様個人の判断により自己責任でお願いいたします。

     

コンセンサス・ベイス(株)とブロックチェーン事業を行なってみませんか?

当サイトを運営するコンセンサス・ベイス株式会社は、2015年設立の国内で最も古いブロックチェーン専門企業です。これまでに、大手企業の顧客を中心に、日本トップクラスのブロックチェーンの開発・コンサルティング実績があります。

ブロックチェーンに関わるビジネスコンサル・システム開発・教育・講演などご希望でしたら、お気軽にお問い合わせください。

     
     

ブロックチェーン学習に最適の書籍の紹介

図解即戦力 ブロックチェーンのしくみと開発がこれ1冊でしっかりわかる教科書

ブロックチェーン イーサリアムへの入り口 第二版 (ブロックチェーン技術書籍)

本書は、ブロックチェーン技術に興味を持ったエンジニアや、その仕組みを学び、自分の仕事に活かしたいビジネスパーソンを対象にして、ブロックチェーンのコア技術とネットワーク維持の仕組みを平易な言葉で解説しています。この本を読んだうえで、実際にコードを書くような専門書、ブロックチェーンビジネスの解説書を読むことで、理解度が飛躍的に高まるでしょう。(はじめにより)

ビットコイン(Bitcoin)カテゴリの最新記事