The spec
field within each channel describes the campaign it's associated with.
campaignSpec
refers to the format of describing ad campaigns.
If a channel is associated with a campaign (in practice, all channels created by the AdEx dapp are), it's spec
field would be set to an IPFS hash to a JSON blob of the campaignSpec
wrapper.
Within the validator stack, the campaignSpec
can be either downloaded from IPFS by the watcher or submitted directly to the Sentry.
Because the campaignSpec
format needs to be able to evolve rapidly, we require that channels point to a wrapper that also contains the format version
version
: a semver version of the formatbody
: thecampaignSpec
body
Example: { "version": "1.0.0-alpha", "body": "..." }
NOTE: this format is unstable, it might change a lot
NOTE: all monetary values are represented as a string that represents a decimal BigNumber in the channel asset unit (BigNumString)
adUnits
: an array of AdUnitvalidators
: an array of Validator objects; should always be 2 elements, first being the leader, second being the followermaxPerImpression
: BigNumStr, a maximum payment per impressionminPerImpression
: BigNumStr, minimum payment offered per impressiontargeting
: an array of TargetingTag, optionalcreated
: Number, a millisecond timestamp of when the campaign was creatednonce
: BigNumStr, a random number to ensure the campaignSpec hash is uniquewithdrawPeriodStart
: Number, a millisecond timestamp of when the campaign should enter a withdraw period (no longer accept any events other thanCHANNEL_CLOSE
); a sane value should be lower thanchannel.validUntil * 1000
and higher thancreated
; it is recommended to set this at least one month prior tochannel.validUntil * 1000
Spec properties (added to ipfs and can NOT be modified)
type
: string, the type of the ad unit; currently, possible values are:legacy_250x250
,legacy_468x60
,legacy_336x280
,legacy_728x90
,legacy_120x600
,legacy_160x600
see IAB ad unit guidelines andiab_flex_{adUnitName}
(see IAB's new ad portfolio and PDF)mediaUrl
: string, a URL to the resource (usually PNG); must use theipfs://
protocol, to guarantee data immutabilitymediaMime
: string, MIME type of the media, possible values at the moment are:image/jpeg
,image/png
targetUrl
: string, the advertised URLtargeting
: an array of TargetingTag, optionaltags
: an array of TargetingTag, meant for discovery between publishers/advertisersowner
: user address from the sessioncreated
: number, UTC timestamp in milliseconds, used as nonce for escaping duplicated spec ipfs hashes
ipfs
: string, valid ipfs hash of spec props *can NOT be modified. Unit should be accessible by this ipfs hashtitle
: string, the name of the unit used in platform UIdescription
: string, arbitrary text used in platform UIarchived
: boolean, user can change it - used for filtering in platform UImodified
: number, UTC timestamp in milliseconds, changed every time modifiable property is changed
addr
: string, the corresponding value inchannel.validators
url
: string, a HTTPS URL to the validator's sentryfee
: BigNumStr, the total fee that will be paid out to this validator when they distribute the whole remaining channel deposit
tag
: string, arbitrary tag namescore
: number, from 0 to 100
NOTE: the SDK will use this by intersecting it with the user's TargetingTag
array, multiplying the scores of all TargetingTag
s with the same tag
, and summing all the products. For example, if a certain AdUnit
has [{tag: 'location_US', score: 5}, { tag: 'location_UK', score: 8 }]
, and the user has [{ tag: 'location_UK', score: 100 }]
, the end result will be 800.
@TODO max events per user? also, how to define a "user"? @TODO cancellation fee? may make fund distribution math more complex...; however, paying out the full validator fee is essentially like a cancellation fee