Popular Approaches For Making Fast Payments On Blockchain [Explained]
Hey! Hope you’re safe at home during the pandemic. During my free time at home nowadays, I read about blockchain. I’ve learned something really interesting about it and wanna share the same. Here I go!
- Blockchain for payment?
- Example solutions from Bitcoin, Ethereum, V Sys.
Why Blockchain for payment?
Blockchain innovation vows to encourage secure, minimal effort universal payment handling services (and different transactions) using encoded distributed records that give trusted real-time confirmation of transactions without the requirement for middle people, for example, banks and clearing houses.
Despite developing adoption of digital forms of money such as cryptocurrencies, making quick payments at scale stays a challenge. Payment Channel Networks (PCNs, for example, the Lightning Network have developed as a suitable scaling solution.
In any case, finishing payments on PCNs is challenging: payments must be routed on ways with adequate funds. As payments stream over a solitary channel (connect) in the same direction, the channel, in the long run, gets drained and can’t bolster further payments toward that path; subsequently, naive routing plans like shortest-path routing can exhaust key payment channels and incapacitate the framework.
The present PCNs additionally course payments atomically, exacerbating the issue.
- Example: Bitcoin network processes 7 transactions per second, and Ethereum 15 transactions/second, which pales in comparison to the 1,700 transactions per second achieved by the VISA network. Scalability thus remains a major hurdle to the adoption of cryptocurrencies for retail and other large-scale applications. The root of the scalability challenge is the inefficiency of the underlying consensus protocol: every transaction must go through full consensus to be confirmed, which can take anywhere from several minutes to hours.
A leading proposal among many solutions to improve cryptocurrency scalability relies on payment channels. A payment channel is a cryptocurrency transaction that escrows money on the blockchain for exchange with a pre-specified user for a predetermined duration.
- Example: Alice can set up a payment channel with Bob in which she escrows 10 tokens for a month. Now Alice can send Bob (and only Bob) signed transactions from the escrow account, and Bob can validate them privately in a secure manner without mediation on the blockchain. If Bob or Alice wants to close the payment channel at any point, they can broadcast the most recent signed transaction message to the blockchain to finalize the transfer of funds.
- The versatility of payment channels stems from payment channel networks (PCNs), in which users who do not share direct payment channels can route transactions through intermediaries for a nominal fee.
- PCNs enable fast, secure transactions without requiring consensus on the blockchain for every transaction.
Example Payment Channels
1. Ethereum Payment Channel: The Raiden Network
- Ethereum payment channels allow for off-chain transactions with an on-chain settlement. Parties open one channel with a deposit, continue to sign and verify transactions off-chain, and close the channel with one final transaction, on-chain.
- The Raiden Network allows secure transfers of tokens between participants without the need for global consensus. This is achieved using digitally signed and hash-locked transfers, called balance proofs, fully collateralized by previously setup on-chain deposits. This concept, illustrated below, is known as payment channel technology.
- Since opening and closing payment channels between two peers still requires on-chain transactions, creating channels between all possible peers becomes infeasible. However, we do not need a direct payment channel between a payer and a payee if there exists at least one route through a network of channels that connects the two parties. This network and its associated protocol for routing and interlocking channel transfers are called the Raiden Network.
- In addition, payment channel transfers, in contrast to on-chain transactions, do not require any fees. Intermediaries within the greater network, however, will want to charge fees on a low percentage basis for providing their own channels to the network, leading to complex routing and a competitive channel fee market. The Raiden protocol aims to facilitate this market by using both protocol-level features and optional auxiliary services.
2. Payment Channel Example: V Systems.
It is an open-source blockchain platform project, has recently implemented payment channel smart contracts in their version 2.0 upgrade
There are a few important variables mentioned below that are stored in the contract that define behaviour of their payment channel's functions.
- Accumulated Payment is the accumulated amount the receiver has already been paid by the sender.
- Expiration Timestamp is the timestamp at which the receiver can no longer collect payments, and the sender can unload the rest of the funds back to themselves.
- Accumulated Load is the accumulated amount the sender loads into the channel.
To ensure security, these three variables can only increase. Since the accumulated load cannot be decreased, the recipient can be sure that there is at least a certain amount of funds in the channel without having to check the contract's state values constantly. It isn't possible for the sender to withdraw their funds from the channel until it is closed.
Since it isn't possible for the accumulated payment to decrease, it is possible for the recipient to withdraw any funds they have already collected without waiting for the channel to end. This implementation allows senders to re-use their existing payment channels even after they have expired by updating the expiration timestamp and loading extra funds into the channel.
3. BitcoinJ payment channel approach
- Bitcoin is a digital currency created in January 2009 following the housing market crash. It follows the ideas set out in a white-paper by the mysterious and pseudonymous Satoshi Nakamoto. Bitcoin offers the promise of lower transaction fees than traditional online payment mechanisms and is operated by a decentralized authority, unlike government-issued currencies.
- Bitcoin’s capacity limitations are increasingly felt by users in the form of delayed transaction processing and rising transaction fees. Users currently pay about 3 to 7 US cents per transaction (independent of the amount transferred).
Long-term research has focused on two directions to improve scalability:
- Redesigning the underlying Blockchain protocol to support more transactions.
- Facilitating ‘oﬀ-chain transactions’ where transactions are only committed to the Blockchain if an adjudicator is required .
- They were ﬁrst implemented by Corallo in Bitcoinj to allow a customer to send incremental payments to a merchant. Each payment has two outputs: the ﬁrst increases the number of bitcoins sent to the merchant, and the second returns change to the customer. This introduces the Replace by Incentive rule as the merchant only signs and broadcasts the latest Payment Transaction that sends them the most bitcoins. Payments can be made until the channel expires or the whole deposit has been transferred to the merchant.
Bidirectional payment channels
- Bidirectional channels require the Payment Transaction to be associated with an Absolute Lock Time. Each incremental payment decrements the lock time by a safety margin Δ that represents the expected time for transactions to be accepted into the Blockchain. This introduces the Replace by Timelock rule as the latest Payment Transaction is guaranteed to be accepted into the Blockchain before any previously authorised transaction. Each payment requires both parties to exchange signatures and reduces the channel’s lifetime.
- Bidirectional payment channels are the building blocks of a payment channel network and allow a sender (Alice) to send funds to a receiver (Bob) and vice versa. To open a payment channel, Alice and Bob jointly create a transaction that escrows money for a fixed amount of time.
- Example(Fig 1): Suppose Alice puts 3 units in the channel, and Bob puts 4. Now, if Bob wants to transfer one token to Alice, he sends her a cryptographically-signed message asserting that he approves the new balance. This message is not committed to the blockchain; Alice simply holds on to it. Later, if Alice wants to send two tokens to Bob, she sends a signed message to Bob approving the new balance. This continues until one party decides to close the channel, at which point they publish the latest message to the blockchain asserting the channel balance.
If one party tries to cheat by publishing an earlier balance, the cheating party loses all the money they escrowed to the other party.
Payment Channel Network
A payment channel network is a collection of bidirectional payment channels. If Alice wants to send three tokens to Bob, she first finds a path to Bob that can support three tokens of payment. Intermediate nodes on the path (Charlie) will relay payments to their destination.
Hence, two transactions occur: Alice to Charlie, and Charlie to Bob. To incentivize Charlie to participate, he receives a routing fee. To prevent him from stealing funds, a cryptographic hash lock ensures that all intermediate transactions are only valid after a transaction recipient knows a private key generated by Alice.
Once Alice is ready to pay, she gives that key to Bob out-of-band; he can either broadcast it (if he decides to close the channel) or pass it to Charlie. Charlie is incentivised to relay the key upstream to Alice so that he can also get paid. Note that Charlie’s payment channels with Alice and Bob are independent: Charlie cannot move funds between them without going through the blockchain.
Little more about PCNs
PCNs are used in blockchain to scale throughput without overhauling the underlying consensus protocol. For PCNs to be economically viable, the network must be able to support high transaction throughput. This is necessary for intermediary nodes (routers) to profitably offset the opportunity cost of escrowing funds in payment channels, and for encouraging end-user adoption by providing an appealing quality of payment service. But, a transaction is successful only if all channels along its route have sufficient funds. This makes payment channel routing, the protocol by which a path is chosen for a transaction, of paramount importance.
- American Express
- Axis Bank Blockchain Paper
- High throughput with payment
We're are hackable animals and blockchain may increase our security from being hacked. If Artificial Intelligence can hack you, blockchain may act as your firewall.
Thanks, Hope you learned something new today!
Disclaimer: This article is based on the author’s knowledge through various research papers and is solely for educational purposes. The author has no vested interests whatsoever in the above-mentioned cryptocurrencies and companies.
Subscribe to get your daily round-up of top tech stories!