Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 3.28 KB

cip-0027.md

File metadata and controls

61 lines (45 loc) · 3.28 KB
    CIP: 27
    Title: STAMP Filesystem
    Author: Jeremy Johnson (J-Dog)
    Discussions-To: https://forums.counterparty.io/t/cip27-stamp-filesystem/6565
    Status: Draft
    Type: Standards
    Created: 2023-04-20

Abstract

Mirror stamp file data to a local filesystem

Motivation

Migrate stamp file data out of the counterparty database and provide a stamp file mirroring solution.

Rationale

The popularity of blockchain file encoding protocols such as Inscriptions and Bitcoin Stamps indicates users want to store file data on a highly-available and permanent medium.

Currently stamp file data is stored in the description field in both the issuances and messages database tables in counterparty-lib. Storing this data in multiple tables is unnecessary, is bloating the database, and will have a long-term performance impact as we support stamping larger files, and multiple files in the same transaction.

Writing stamp file data to files on a local filesystem allows for removal of the data from database tables, which helps ensure that the database stays as small and fast as possible.

Updating the Counterparty fednode stack to serve out stamp file data from a local filesystem, effectively makes every Counterparty node a stamp file mirror,

The STAMP Filesystem proposal further ensures the availablity of stamp file data by making it not only available on the Bitcoin blockchain, but also on every Counterparty node.

Definitions

  • stamp - Any issuance transaction with the stamp: prefix in the description field
  • file - Any file type
  • mime-type - Any of the currently defined MIME / Media Types according to the IANA Spec

Specification

The following modifications are needed to support this CIP.

  1. When parsing an issuance with a stamp: prefix :

    • remove stamp: prefix
    • Parse stamp file data according to the STAMP Protocol formats
    • Write file data to local filesystem
    • Determine basic info about file data (size, mime-type, extension, etc)
    • Save file info to stamps table
    • Replace description field value with STAMP text to indicate description points to record in stamps table
    • Save issuances data
    • Save messages data
  2. Create stamps table which includes the following data :

    • tx_hash - Transaction hash of stamp transaction
    • stamp_index - Official stamp file number
    • mime-type - File MIME / Media Type (image/png, application/json, etc.)
    • file-size - Size of the file in bytes
    • extension - File extension (png, pdf, zip, etc.)
    • hash - Hash of the stamp file data
  3. Add stamp-filesystem to fednode stack

    • Create new 'STAMPS' configuration (optional component)
    • Add container with nginx webserver to serve out stamp file data
  4. Update counterparty-lib API to support querying stamps via get_{table} requests.

Copyright

This document is placed in the public domain.