visit
With over 9 million transactions AdEx Network is currently the largest payment channel network on Ethereum. Here's how we did it
To put it simply, state channels refer to the process in which users interact (send funds or change the state of smart contracts) with one another directly outside of the blockchain, or ‘off-chain’. Multiple interactions between two users don’t need to be stored on the blockchain, important is only the initial and the end state between them. This saves time and resources from the need to write multiple repetitive transactions or states on the blockchain.
Payment channels are one application of the state channels technology where scaling is used for unlimited, bidirectional transfers between two participants. These transfers can be performed instantaneously and without any involvement of the actual blockchain itself, except for an initial one-time on-chain creation and an eventual closing of the channel. As the name implies, payment channels are most suitable for exchange of cryptocurrency.
The biggest payment channel network is Bitcoin’s Lightning network, having $9M locked on chain. When it comes to Ethereum solutions, there are several projects focusing on payment channels but the biggest ones that are live (operational and having some funds locked on chain) are AdEx Network, Raiden Network and Connext.
Raiden Network is an off-chain scaling solution, enabling near-instant, low-fee and scalable payments on the Ethereum blockchain, working with any ERC20 token. The Raiden Mainnet launched in late 2018 and its aim is to become "the Lightning Network for Ethereum". At the moment, Raiden network has 278 open channels and 78 unique accounts. On 12 August it had 4.57 WETH total network deposits, or around 860 USD.
Connext provides non-custodial layer 2 payment channel technology that enables instant off-chainpayments with low transaction costs. Connext launched its own its Dai Card in March 2019. The Dai Card hosts an Ethereum wallet in the user’s web browser. Users can load the card with Dai (or ETH, which will automatically be swapped for Dai). Once funded, the Dai Card can be used to send instant payments to any other Dai Card holder. On 12 August Connext had a total of $12K DAI locked and it is gradually growing.
For AdEx, using payment channels has a few important benefits:
- Firstly, it allows us to minimize the number of on-chain transactions, and that’s a huge UX improvement. In AdEx, the only on-chain transactions that you need are opening a campaign (as an advertiser) and withdrawing your earnings (as a publisher). Users do not need to learn what payment channels are or how they work, they only need to deposit/withdraw funds to AdEx.
- Secondly, because making payments does not incur any extra fees, we can use micropayments for each individual impression (or any other type of payable event).
This means publishers have a guarantee they can withdraw their revenue at any given time, unlike traditional systems where you can only withdraw your earnings for set, usually long periods, and/or only if you reach a certain threshold.
But most importantly, since the payments are per impression, this eliminates any possibility that an advertiser would cheat a publisher out of their earnings. This also makes reporting completely transparent, because you know about every impression and how much was paid for it, in real time.
We decided to call our own payment channels technology OUTPACE - Off-chain Unidirectional Trustless PAyment ChannEls. The two most important features of OUTPACE are that it’s strictly unidirectional, which simplifies the architecture, because it does not require exit games/watchtowers, and It allows multiple parties to be paid from a single channel (one-to-many).
Let's walk through the full process, with examples:
1. A channel is open by invoking channelOpen on the; this transfers DAI from the user's wallet and locks them up; see
2. The Platform will automatically submit metadata about the channel to the validators, which will ensure it does indeed exist on-chain, and will start receiving events (impressions, clicks) for it
3. The Market will detect that the validators have started processing the channel, and it's state will change from Ready to Active in the Market and the Explorer
4. The AdView will start showing ads from the campaign this channel is tied to
5. The AdView will send impression/click events to the validators, who will update the balances of earners (publishers) by exchanging NewState(balances, signature) and ApproveState(signature) messages between themselves
6. Now a publisher who's earned from this channel may withdraw, by calling and submitting the last signatures from the validators, along with a merkle proof of their balance in the balance tree; they may withdraw from multiple channels in one transaction ("sweeping"), thanks to our Identity contract, as you can. This particular transaction withdrew value incurred from ~159k micropayments, from 4 channels, and cost only $0.16 in gas fees. Keep in mind, the gas costs do not increase with larger amounts/more transactions.
In the Platform, step 6 is automated: the users see the total funds they have, no matter if on-chain or on channels. If you try to spend all your funds at once, the Platform will automatically "sweep" all channels first, making all your funds spendable on-chain.
For more details on the inner workings of the protocol, you can read.
9 million is a good number to start with in the context of blockchain transactions - but for ad impressions, it is modest. We are just starting to test AdEx Network and by the end of the year we are aimed at onboarding few hundred advertisers and publishers, so we believe numbers will rise significantly and they might become even more impressive pretty soon.
Are you interested in AdEx? Get in touch:
| | | | |