I've read bits and pieces on payment channels and the benefits it would provide for micro-transactions. For example, under the current fee structure, it's not wise to send micro transactions below the mining fee since it would cost you more to send the value. Are there any mechanism to open payment channels where micro-transactions can be lumped to reduce mining fees? Either now, or within a future version of Ethereum (i.e. planned release )?

up vote 9 down vote accepted

Absolutely. In fact, there's a project currently underway to implement an Ethereum Lightning Network, which uses micropayment transaction channels, called Raiden.

For those who aren't already familiar with microtransaction channels, here's a primer. Feel free to skip the next two paragraphs if you're already familiar with the mechanism:

In the Bitcoin version, participants lock funds in a multisig "smart contract" (i.e., one or more Bitcoin transactions) and partially sign a pair of commitment transactions which are spent from by four timelocked multisig "commitment" transactions. The spending transactions are set up such that either party can send what's owed the other party immediately at the cost of having to wait some number of blocks for their funds to be released. Each time the state of the channel is updated, previous states are invalidated by participants exchanging the keys their commitment transactions spend to, thus allowing the counterparty to steal all the funds in the multisig only if a participant broadcasts an old commitment transaction.

If you want to understand all of that better, then read the first 29 pages of the Lightning Network paper. It's not important that you do in the context of this answer though. Suffice it to say, a microtransaction channel requires two parties to be able to update the channel's state off-chain, settle to the blockchain at any time, and take all the funds in the channel if the counterparty attempts to write an old channel state to the blockchain.

In Ethereum, this can be simplified quite a bit. One implementation might consist of a smart contract which accepts and verifies a signed transaction command and a nonce. (We can't just use native transactions for signing and verification like Bitcoin does because Ethereum transactions use an incrementing nonce to prevent playback attacks.)

Participants would then send ether to the smart contract after creating and exchanging signed spending transaction commands similar to the ones in the Bitcoin channels. In particular, Alice would sign a transaction command sending funds immediately to Bob and locking funds for herself to be released after some amount of time, and vice versa. The smart contract would contain the logic that any funds timelocked for the counterparty can be claimed by producing a transaction command signed by the counterparty with a higher nonce than the one which the counterparty broadcast.

This requires quite a bit less signing and private key juggling than the Bitcoin implementation does, and is (IMO) quite a bit easier to understand as well. Raiden does something similar, except instead of using nested signatures it uses hashes and "preimages" (i.e., the inputs to the hashes).

  • A "preimage" is what goes into a hash, not what comes out - in this context, "secret" and "preimage" are synonymous. – Nick Johnson May 22 '16 at 14:47

A payment channel is certainly possible to build in the current version of ethereum. The details can vary, and for an extensive explanation, I suggest reading this paper about universal payment channels, but here is the general idea:

  • Both parties send a deposit to a smart contract to ensure that they won't spend the money elsewhere in the meantime.
  • If A want to send a message to B over the payment channel, A signs a message that contains the state of the channel, (i.e. the balances of the participants) but does not send it to the network. Instead, A sends it directly to B (over whisper or email or whatever). Now, B can of course do the same thing, and when they want to send more ether to each other, they keep signing update states.
  • When a party wants to "cash out" they send the state message to the contract, that checks its signature, and the delivers the funds of the contract according to the state. There are also mechanisms to ensure that the state is the last one by keeping an internal nonce structure over the channel.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.