- Payment channels, Lightning FAQ
- What are Payment channels?
- What is the Lightning Network?
- How do payment channels help Aspire users?
- What are some potential uses for payment channels and micropayments?
- Could payment channels be useful for any kind of transaction?
- What is P2SH?
- What are atomic swaps and OTC markets?
- How do I start using all of this technology with Aspire?
What are Payment channels?
Payment channels allow two users of gAsp to transact commitments to pay back and forth between each other much faster and more fluidly than gAsp’s 2 minute average block times would normally allow. These commitments are exchanged between the users outside of the gAsp blockchain. Once the users are done, they can close the payment channel by publishing the last commitment(s) to the blockchain, which will finalize the amount actually transacted.
An ideal use case for the technology is micropayments: Imagine a user making numerous very small payments (e.g. .0001 GASP) to Big Music Company as she listens to songs over a certain period. Without payment channels, the Bitcoin transaction fees from these small payments would be as much or more than the payments themselves, and each payment would take on average 10 minutes to clear. gAsp has already addressed many of Bitcoin’s issues by building a different type of blockchain, however we felt it was still important to notate payment channels.
Shawn Wilkinson of Storj provides a good overview of payment channels (which goes into detail on both unidirectional and bidirectional channels.
What is the Lightning Network?
The Lightning Network, which is still under development, allows for secure, instant off-chain payments between two arbitrary participants. The Lightning Network is one of the primary methods of scaling Bitcoin to have credit card network-like transaction throughput, while preserving its decentralized qualities.
Lightning Network technology uses bidirectional payment channels as its central component. Much like the internet routes data packets from one network point to another network point, the Lightning Network routes payments across multiple interconnected payment channels. This eliminates the need to construct a new payment channel for every party that you want to transact with. Instead, you may have a channel set up with a party you have an established relationship with, such as a payment provider like Coinbase, who (possibly through multiple degrees of separation) has a payment channel connection to the final end party.
Because the individual participants’ transactions utilize Bitcoin cryptography and are eventually committed back to the Bitcoin blockchain, transactions on the Lightning Network are essentially as secure as if they were transacted directly on Bitcoin, but without the same cost, speed and scalability limitations.
gAsp is ready and fully compatible with the Lightning Network (if and when the time is necessary).
The Lightning Network site includes more information.
How do payment channels help Aspire users?
Currently payment channels aren’t really necessary as gAsp and Aspire were built to solve the problems faced by other platform block times and fees. Individual Aspire transactions are committed directly to the gAsp blockchain. This is very secure, and quick with gAsp’s 2 minute average block times, additionally per-transaction fees are very low. The benefits of this are especially apparent when the amounts transacted are small, and/or performed frequently or on an on-going basis.
What are some potential uses for payment channels and micropayments?
- Rewarding users for specific actions they take, such as contributing content to a blog, or writing a review
- Incrementally purchasing an Aspire service offering.
- Buying in-game items with Aspire-based games.
- Payments for other digital/virtual goods, such as a “contributor” badge on a forum
- Referral network payments
- Small/regular donations to charities, projects or individuals (such as musicians and writers of very neat open source software (hint, hint!))
- Enabling rental of Aspire asset names
Could payment channels be useful for any kind of transaction?
Theoretically, any Aspire transaction could be sent in a payment channel. However, the technology is by far most appropriate for send transactions, where one would transfer an Aspire asset much like one would transfer gAsp. Payment channels don’t remove the need for on-chain transactions (and indeed, each payment channel is started from and ends with an on-chain transaction). Instead, they enable certain use-cases such as rapid incremental payments, and microtransactions.
What is P2SH?
Most commonly in Bitcoin, transactions are made to a specific user’s public key hash (colloquially known as a Bitcoin address), and are spendable by that user’s corresponding private key, the same principle applies to gAsp.
With “Pay-to-script-hash” (P2SH), transactions are sent to the hash of a “redeem script”, which is a special Bitcoin script (e.g. a Bitcoin smart contract) that can be written to do a variety of things. To “execute” the script and operate on some or all of the sent funds, another party will broadcast an additional transaction that provides the original script content, along with any required signatures.
The P2SH support implemented in Aspire makes payment channels possible, as payment channels (and Lightning Network, for that matter) require the use of these redeem scripts to work. P2SH is also commonly used for multisignature transactions since the signing process is generally more compact and streamlined than the earlier method (“bare multisig”).
You can tell if a gAsp address is for a P2SH destination because it will start with ‘3’ on GASP mainnet. Given this, you may notice that many exchanges, for instance, utilize these ‘3’ addresses for deposits. The redeem script in use with that is most definitely a multisig script of some kind, allowing secure, multi-party handling of deposited funds by the exchange.
What are atomic swaps and OTC markets?
P2SH support, the same technology implemented in Aspire that makes payment channels possible, also makes on-chain “atomic swaps” possible.
With an atomic swap, two parties perform a special process of exchanging information that completes by the parties broadcasting several transactions that they both have signed. These transactions end up exchanging (i.e. “swapping”) some quantity of one asset from one party in exchange for another. This is done in a way where one party can’t cheat the other.
The use of atomic swaps can be useful to enable the use of things like over the counter (OTC) markets and dark pools. With either structure, a third party (often known as a bookrunner) would maintain a list of bids and offers between buyers and sellers of one asset for another, such as ASP and GASP. That list may be publically published, or not. Interested parties would contact the bookrunner and place buy and sell offers. The bookrunner would match buyers to sellers, who would then perform the trade themselves utilizing an atomic swap. Using this model, risk is greatly minimized, as the bookrunner does not have to hold any assets (and thus cannot run away with them).
The concept of an OTC market may sound antiquated but in reality they are a major boon to markets, especially for large holders who can then enter or exit a market or accumulate an asset without much price “slippage”, as would oftentimes occur on an exchange. In mainstream finance, OTC markets comprise over 40% of stock trading, as well as the vast majority of bond and derivative trading (source 1, source 2).
How do I start using all of this technology with Aspire?
This technology is all in various stages of development, with some of it being complete (P2SH, for instance) and some in very early states on Aspire (such as bidirectional payment channels and Lightning Network support).
We will be publishing guides for users and developers as the respective technology becomes available and matures. Until that point, feel free to check out the newest source code and ask questions on #dev on our official Slack chat.