Developer Shows How to Scale Ethereum for Micropayments in 50 Lines of Code



Scalability is a hot topic in the blockchain space after bitcoin’s community plunged into chaos over how to increase the network’s capacity with their dispute continuing after more than two years.

The two main options are to either increase on-chain capacity by allowing more data to move through, or to bundle many transactions into one on-chain transaction, thus requiring less on-chain space.

Ethereum’s approach is to go for both. It intends to scale on-chain to as good as unlimited, while providing the option of bundling transactions into just one so as to save money in fees and to make micropayments much more economical.

The Raiden Network intends to provide the latter solution in a convenient form, but an Ethereum developer has shown how you can easily code a method of bundling transactions called a Payment channel in just 50 lines.

Scaling Ethereum in just 50 lines of code

The developer is far better at laying out the technical details, but for non-coders, he is basically using a smart contract which locks up a certain amount of funds and tells it that a portion of them should go to a provider of a service based on certain conditions.

The simple example used is payment for twitter marketing. For each tweet made, you sign a hash with the private key used to lock up the funds, then the smart contract sends, say ten pence in eth, to the receiver.

At this stage these funds remain locked, but with each signed hash ownership changes, so you cant just get back the eth you’ve paid as that has now moved to the service provider who can at any time close the channel and receive the funds.

Once the channel is closed, say after 100 or 1,000 tweets, then an on-chain transaction happens, so whoever provided the service now receives actual eth and can use it normally just like any other eth.

This makes micropayments feasible and can further be used by two parties that often transact, say a payment processor and a merchant, or a merchant and a supplier, allowing them to undertake an unlimited number of transactions even at this stage.

It is a useful way of scaling which can be extended with the Raiden Network, a second layer on top of ethereum that may eventually make even smart contracts very cheap to set-up and operate.

While, in parallel, sharding aims to increase on-chain transaction capacity to perhaps 100,000 tx/s, allowing ethereum’s platform to handle all the necessary demand.

Leave a Reply

Notify of