At the moment, only the contract tests have been written.
To run tests:
(in a separate terminal)
npm run testrpc
npm run mocha
This repo is a (WIP) state channel system to allow an advertiser and a publisher (or their agents) to synchronize their recorded advertising impressions in real-time.
For traditional ad contracts with 30 to 60 day settlement cycles, discrepancies in impression reporting between parties are not discovered until the contract is complete. Discrepancies in tracked impressions commonly reach up to 20%. Some of these are intrinsic to browsers and networks and come from latency, network connection errors, ad blockers, and differences between ad server spam filtering techniques. The widespread acceptance of discrepancies across the industry, however, is exploited through fraudulent tampering of metrics and misreporting impressions.
By syncronizing impressions in real-time, discrepancies can be eliminated or at least discovered much more quickly.
This repo is being developed as part of the AdChain project, a collaboration between ConsenSys and MetaX.
Check out these slides for a quick overview of AdChain and the AdMarket.
State Channels is a design pattern for building scalable decentralized applications. This documentation assumes familiarity with state channels. To review, check out the following links:
Martin Koeppelmann (Oct. 2015, blog) - How offchain trading will work Robert Mccone (Oct. 2015, blog) - Ethereum Lightning Network and Beyond Jeff Coleman (Nov. 2015, blog) - State Channels (see also: discussion on /r/ethereum) Heiko Hees (Dec. 2015, talk) - Raiden: Scaling Out With Offchain State Networks Jeff Coleman (Dec. 2015, interview) - Epicenter Bitcoin: State Networks Jehan Tremback (Dec. 2015, blog) - Universal Payment Channels Martin Koeppelmann (Jan. 2016, slides) - Scalability via State Channels Vitalik Buterin (Jun. 2016, paper) - Ethereum: Platform Review (page 30) Ameen Soleimani (Sept. 2016, talk) - An Introduction to State Channels in Depth Jeff Coleman (ongoing, wiki) - State Channels Wiki Jeff Coleman (ongoing, code) - Toy State Channels Heiko Hees (ongoing, code) - Raiden Network Sergey Ukustov (ongoing, code) - Machinomy
I especially recommend Jeff Coleman's blog post and the Machinomy documentation as starting points.
The advertiser or their agent (demand) and the publisher or their agent (supply) will maintain a state channel for the duration of their business relationship, periodically checkpointing the channel state onchain.
This state channel tracks the impressions between represent an "impression ledger"
In the current implementation, both the demand and supply must be registered with the AdMarket in order to open channels.
Only the owner of the AdMarket contract may register (or deregister) supply and demand participants.
To register demand or supply, the AdMarket owner must provide their Ethereum address as well as a url string which points to their adserver which will handle state channel messages.
Once registration is complete, the supply and demand may update their own adserver urls.
In the future, registration will be separated into its own contract so an AdMarket contract can opt to instead use the AdChain Registry as its canonical source of truth regarding supply and demand identity.
The demand opens the channel initially,