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
Mirror stamp
file
data to a local filesystem
Migrate stamp
file
data out of the counterparty database and provide a stamp
file
mirroring solution.
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.
stamp
- Anyissuance
transaction with thestamp:
prefix in thedescription
fieldfile
- Any file typemime-type
- Any of the currently defined MIME / Media Types according to the IANA Spec
The following modifications are needed to support this CIP.
-
When parsing an issuance with a
stamp:
prefix :- remove
stamp:
prefix - Parse
stamp
file
data according to theSTAMP Protocol
formats - Write
file
data to local filesystem - Determine basic info about
file
data (size, mime-type, extension, etc) - Save
file
info tostamps
table - Replace
description
field value withSTAMP
text to indicate description points to record instamps
table - Save
issuances
data - Save
messages
data
- remove
-
Create
stamps
table which includes the following data :tx_hash
- Transaction hash ofstamp
transactionstamp_index
- Officialstamp
file
numbermime-type
- File MIME / Media Type (image/png, application/json, etc.)file-size
- Size of the file in bytesextension
- File extension (png, pdf, zip, etc.)hash
- Hash of thestamp
file
data
-
Add
stamp-filesystem
tofednode
stack- Create new 'STAMPS' configuration (optional component)
- Add container with nginx webserver to serve out
stamp
file
data
-
Update
counterparty-lib
API to support queryingstamps
viaget_{table}
requests.
This document is placed in the public domain.