Version 2.0
WTTP is a blockchain-based protocol that implements HTTP-like functionality for decentralized web resources. It provides a standardized way to store, retrieve, and manage web content on the blockchain with built-in content addressing and royalty mechanisms.
wttp://<host>[:<network>]/<path>[?<query>]
host
: Contract address or ENS namenetwork
: Optional network identifier (e.g., mainnet, sepolia)path
: Resource pathquery
: Optional query parameters
Retrieves a resource from a WTTP site.
GET {
requestLine: { protocol: "WTTP/2.0", path: string },
requestHeader: {
accept: bytes2[],
acceptCharset: bytes2[],
acceptLanguage: bytes4[],
ifModifiedSince: uint256,
ifNoneMatch: bytes32
},
getRequest: {
host: address,
rangeStart: uint32,
rangeEnd: uint32
}
}
Retrieves resource metadata without content.
HEAD {
host: address,
requestLine: { protocol: "WTTP/2.0", path: string }
}
Creates or replaces a resource.
PUT {
requestLine: { protocol: "WTTP/2.0", path: string },
mimeType: bytes2,
charset: bytes2,
location: bytes2,
publisher: address,
data: bytes
}
Updates a multi-part resource.
PATCH {
requestLine: { protocol: "WTTP/2.0", path: string },
data: bytes,
chunk: uint256,
publisher: address
}
Gets resource location information.
LOCATE {
host: address,
requestLine: { protocol: "WTTP/2.0", path: string }
}
Sets resource metadata and permissions.
DEFINE {
host: address,
requestLine: { protocol: "WTTP/2.0", path: string },
header: HeaderInfo
}
{
head: {
responseLine: {
protocol: "WTTP/2.0",
code: number
},
headerInfo: {
cache: CacheControl,
methods: uint16,
redirect: Redirect,
resourceAdmin: address
},
metadata: {
size: number,
version: number,
modifiedDate: number
},
dataStructure: {
mimeType: string,
charset: string
},
etag: bytes32
},
body: bytes
}
- 200: OK
- 201: Created
- 204: No Content
- 206: Partial Content
- 301: Moved Permanently
- 302: Found
- 304: Not Modified
- 307: Temporary Redirect
- 308: Permanent Redirect
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 405: Method Not Allowed
- 413: Payload Too Large
- 415: Unsupported Media Type
- 416: Range Not Satisfiable
- 500: Internal Server Error
- 501: Not Implemented
- 505: WTTP Version Not Supported
Accept
: Acceptable MIME typesAccept-Charset
: Acceptable character setsAccept-Language
: Acceptable languagesContent-Type
: Resource MIME type and charsetContent-Location
: Resource location typeIf-None-Match
: Conditional request based on ETagIf-Modified-Since
: Conditional request based on timestampRange
: Request specific chunksPublisher
: Resource publisher address
Content-Type
: Resource MIME type and charsetContent-Length
: Resource size in bytesETag
: Resource identifierLast-Modified
: Last modification timestampCache-Control
: Caching directivesAllow
: Allowed methodsLocation
: Redirect locationRegistry-Address
: DataPoint registry address
Atomic storage units containing:
- Content data
- MIME type
- Charset
- Location type
- Publisher address
Composite structures containing:
- Metadata
- DataPoint references
- Version information
- Access controls
royalty = baseRate * dataSize + publisherFee
- 90% to content publisher
- 10% to protocol (TW3)
Identical content shares the same DataPoint to reduce storage costs.
- Recommended chunk size: 16KB
- Maximum tested file size: 10MB
- Average operations:
- Write: 23ms per chunk
- Read: 24ms per chunk
- Gas: 2.85M per chunk
Supports standard HTTP caching mechanisms:
max-age
s-maxage
no-store
no-cache
must-revalidate
immutable
- Site-level administration
- Resource-level permissions
- Publisher verification
- Method restrictions
- ETag-based integrity checking
- Content addressing
- Publisher signatures
- Parse WTTP URL
- Build appropriate request structure
- Handle network switching if specified
- Execute request through WTTP contract
- Process response according to status code
- Implement required WTTP methods
- Handle DataPoint storage
- Manage access controls
- Process royalty payments
- Maintain resource metadata