Skip to content

A Clarity smart contract for making a decentralized video archiving platform, like YouTube

License

Notifications You must be signed in to change notification settings

CMPGFB/AutoTube

Repository files navigation

AutoTube | Decentralized Video Archiving Platform

Author: Christopher Perceptions

Powered by: NoCodeClarity v2

Overview AutoTube is a decentralized video archiving platform that allows users to store metadata or links to videos, including YouTube links, directly on the Stacks blockchain. It is designed for transparency, security, and operates fully on the Stacks blockchain using Clarity smart contracts.

Constants

  • None defined in the current contract.

Error Codes

  • ERR_UNAUTHORIZED (u100): Error when an unauthorized user attempts to update or delete a video.
  • ERR_NOT_FOUND (u404): Error when the video is not found.

Data Variables

  • video-count: A unique, auto-incrementing ID for each video.

Maps

  • videos: Stores video details including owner, title, content (link or metadata), and whether it's a YouTube link.

Public Functions

  1. upload-content

    • Uploads new video metadata or a link.
    • Parameters:
      • title (string-ascii 100): The title of the video.
      • content (buff 256): The link or metadata of the video.
      • is-youtube-link (bool): Whether the content is a YouTube link.
    • Returns: The ID of the newly created video entry.
  2. update-video

    • Allows a video owner to update their video information.
    • Parameters:
      • video-id (uint): The ID of the video to update.
      • new-title (string-ascii 100): The new title for the video.
      • new-content (buff 256): The new link or metadata for the video.
      • new-is-youtube-link (bool): Whether the new content is a YouTube link.
    • Returns: Success (ok video-id) or an error if unauthorized or video not found.
  3. delete-video

    • Allows a video owner to delete their video.
    • Parameters:
      • video-id (uint): The ID of the video to delete.
    • Returns: Success (ok video-id) or an error if unauthorized or video not found.

Read-Only Functions

  1. get-video
    • Retrieves the details of a specific video.
    • Parameters:
      • video-id (uint): The ID of the video to retrieve.
    • Returns: The video details or none if the video does not exist.

Notes

  • The content field is limited to 256 bytes, suitable for storing links or metadata rather than full video content.
  • Users can specify whether the content is a YouTube link using the is_youtube_link boolean.
  • Only the owner of a video can update or delete it.
  • The contract automatically manages video IDs, incrementing the count for each new upload.
  • All data stored in this contract is public on the blockchain.
  • There's no built-in content moderation, so users should be cautious about the information they store.
  • The contract doesn't handle any token transfers or payments.
  • This contract is generated by NoCodeClarity v2 and has NOT undergone a formal audit. Use at your own risk.
  • All transactions are executed on-chain, ensuring transparency and security.
  • The total number of videos is theoretically limited by the maximum value of uint in Clarity.

License

  • MIT

About

A Clarity smart contract for making a decentralized video archiving platform, like YouTube

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published