# Tunnl Architecture

The Tunnl platform acts as a neutral third party by utilizing smart contracts and artificial intelligence. Brands create marketing agreements using the Tunnl smart contract which holds the funds and releases them when a creator successfully fulfills the agreement terms. When a content creator accepts the agreement, they make their post according to the Brand's natural language requirements and submit the post for verification. Post content is verified onchain with an LLM query performed using Chainlink Functions. After the agreement has concluded, Chainlink Automation triggers a request to transfer the funds to the creator.

<figure><img src="https://2840549272-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbQ60VLQCDO05QVRcZhPm%2Fuploads%2FwT7K3jgHa5mTi67MLmwA%2FTunnl%20Flow%20Diagram%20.png?alt=media&#x26;token=edae4757-9a9a-4616-9565-b8afffefbedb" alt=""><figcaption><p>Tunnl Flow Diagram</p></figcaption></figure>

## How does it work?

### 1. Brand Creates a Marketing Agreement

Brands define agreement parameters including content requirements using natural language, deadlines, and payment. After approving token spend and finalizing the agreement, it is sent to a creator.

Agreement terms and content requirements are encrypted to maintain privacy for all users.

### 2. Creator Accepts an Agreement

Upon reviewing the details, creators must either accept or decline the agreement. If accepted, creators have 24 hours to make a post and submit it on Tunnl. The payout date is scheduled for 4 days after acceptance, ensuring the content remains live for at least 72 hours before final verification and payout.

### 3. Agreement Funds Are Transferred to the Tunnl Smart Contract

Once the creator accepts the agreement, the approved funds are transferred from the brand’s wallet to the Tunnl smart contract.

### 4. Non-Submission & Declination

If the creator declines the agreement or fails to submit the content within 24 hours of acceptance, the offer expires, and the funds are returned to the brand.

### 5. Posting Content & Submitting to Tunnl

After making the post, creators must submit the URL to Tunnl for onchain verification.

### 6. Tunnl Verifies Content Using AI via Chainlink Functions

Once submitted, the content undergoes verification against the brand’s requirements using an LLM tailored for Tunnl marketing agreements. Chainlink Functions enable the use of AI models to verify content and bring the results onchain, with verification taking up to 60 minutes to prevent post-submission edits.

### 7. Payment Upon Successful Verification

4 days after acceptance, if the content is successfully verified and the post is still live, Chainlink Automation sends a payout request through Chainlink Functions. Payment is then automatically calculated and sent from the Tunnl contract to the creator’s wallet.

### 8. Ineligibility for Payment

If the content is not live at the time of final verification, the creator is ineligible for payment and the funds are returned to the brand.
