ERC-7580 On-chain Advertising Tracking Interface (Advertisement Tracking Interface)
Draft · Other · created 2023-12-13
A standard interface that records the start and end of a specific user action within a contract, so that an advertising (promotion) protocol can confirm the action occurred and distribute rewards.
Why it is needed
When a project wants to run a promotion that rewards users of another app for performing a specific action, it needs a way to confirm that the action actually took place. For example, even if project A wants to give a bonus to users who executed a specific function in app B, app B has no common way to identify and verify which users came for A's reward. If every app builds its own tracking method, it becomes hard to connect advertising protocols with apps and difficult to create a new economic cycle around on-chain advertising. This standard proposes a minimal common interface that signals the start and end of an action, letting any app participate in an advertising protocol, deliver rewards to users, and receive a proportional reward itself.
What to implement
event onTrackStartRecorded(uint256 track_id, address contract_address, bytes32 function_hash);: An event emitted when tracking starts. It records the track id, the address of the tracked contract, and a function hash including parameters.event onTrackEndRecorded(uint256 track_id, address contract_address, bytes32 function_hash);: An event emitted when tracking ends. It records the same three pieces of information as the start event.function onTrackStart(uint256 track_id, address contract_address, bytes32 function_hash) external;: Records that the behavior of a specified contract function has started. Called by the project contract before the promotion-targeted action begins.function onTrackEnd(uint256 track_id, address contract_address, bytes32 function_hash);: Records that the behavior of a specified contract function has ended. Called by the project contract after the promotion-targeted action ends.
In depth
Two Tracking Functions
The standard defines two functions, onTrackStart and onTrackEnd. Both take three parameters: track_id (uint256), contract_address (address), and function_hash (bytes32). track_id is the tracking id, contract_address is the address of the tracked contract, and function_hash is the hash of the tracked function including its parameters. Calls to these two functions mark the start and end of a region of interest within a single transaction. In the source code, onTrackStart is declared with external, while the onTrackEnd declaration is not.
Tracking Record Events
Two events, onTrackStartRecorded and onTrackEndRecorded, are defined, carrying the same three parameters as the functions (track_id, contract_address, function_hash). The implementing contract uses these events to define the region of interest within a transaction. The promotion contract gathers the project's action information based on these records.
General Operating Procedure
The source lays out a four-step procedure. First, the project receives a seed id (hash) from the promotion side. Before the target promotion action begins, the project contract calls onTrackStart(id, contract_address, function_hash), and after the action ends it calls onTrackEnd(id, contract_address, function_hash). Finally, the promotion contract collects the project's action information and distributes rewards to the project.
Example of a Connection Between Two Contracts
The source gives an example of two parties with contracts A and B. A wants to give a bonus or airdrop to users who performed a specific key action in contract B (e.g. executing a specific function), and B also receives a reward in the process. To do this, B needs to identify the user and verify that they came to receive A's bonus. The tracking mechanism that enables this kind of business is the purpose of this standard.
Minimal-Constraint Design
This standard is designed to include only the universal functionality strictly necessary for tracking user actions, keeping constraints to a minimum. This is to leave as much room for innovation as possible on the airdrop (advertising) protocol side. So initially it provides only the two functions, onTrackStart and onTrackEnd, which populate the basic information and link the required points. The source states that it will be updated later if demand arises for more functionality. It explicitly states there are no backwards compatibility concerns.
Proposal in Draft status
This ERC was created in December 2023 and is in Draft status, so its contents may change going forward. The Security Considerations section of the source is also still empty, meaning security discussion has not yet been filled in.