ordfs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseORDFS - Ordinals File System
ORDFS - 铭文文件系统
HTTP gateway for accessing on-chain content (inscriptions) from BSV blockchain.
Live Gateway: https://ordfs.network
Repository: https://github.com/b-open-io/go-ordfs-server
用于从BSV区块链访问链上内容(铭文)的HTTP网关。
Quick Reference
快速参考
| Endpoint | Purpose |
|---|---|
| Direct content access |
| Content with options |
| Specific version |
| File from directory |
| Preview HTML code |
| Metadata only |
| 端点 | 用途 |
|---|---|
| 直接访问内容 |
| 带选项的内容访问 |
| 特定版本内容 |
| 目录中的文件 |
| 预览HTML代码 |
| 仅获取元数据 |
Content Access Patterns
内容访问模式
Basic Content URL
基础内容URL
https://ordfs.network/{txid}_{vout}Example:
https://ordfs.network/abc123...def_0https://ordfs.network/{txid}_{vout}示例:
https://ordfs.network/abc123...def_0Outpoint Formats
输出点格式
All formats resolve to the same content:
| Format | Example |
|---|---|
| Underscore | |
| Period | |
| Txid only | |
所有格式都指向相同内容:
| 格式 | 示例 |
|---|---|
| 下划线分隔 | |
| 点分隔 | |
| 仅Txid | |
Content Endpoint with Options
带选项的内容端点
/content/{pointer}[:{sequence}][/{filepath}]Query Parameters:
| Param | Default | Description |
|---|---|---|
| true | Include content data |
| false | Include MAP metadata |
| false | Include raw output (base64) |
| false | Include parent reference |
| - | Return directory JSON instead of index.html |
Examples:
/content/abc123..._0?map=true # With MAP metadata
/content/abc123..._0?content=false # Metadata only
/content/abc123..._0?raw # Directory listing/content/{pointer}[:{sequence}][/{filepath}]查询参数:
| 参数 | 默认值 | 说明 |
|---|---|---|
| true | 包含内容数据 |
| false | 包含MAP元数据 |
| false | 包含原始输出(base64编码) |
| false | 包含父级引用 |
| - | 返回目录JSON而非index.html |
示例:
/content/abc123..._0?map=true # 包含MAP元数据
/content/abc123..._0?content=false # 仅获取元数据
/content/abc123..._0?raw # 目录列表Sequence Versioning
版本序列管理
Track inscription updates using sequence numbers.
通过序列号跟踪铭文更新。
Special "-1" (Latest)
特殊值“-1”(最新版本)
/content/{pointer} # Same as :-1, gets latest version
/content/{pointer}:-1 # Explicit latestBehavior: Short TTL caching (60s), returns most recent version.
/content/{pointer} # 等同于:-1,获取最新版本
/content/{pointer}:-1 # 显式指定最新版本行为: 短TTL缓存(60秒),返回最新版本内容。
Specific Sequence
特定版本序列
/content/{pointer}:0 # Original inscription
/content/{pointer}:5 # 5th updateBehavior: Long TTL caching (30 days), immutable content.
/content/{pointer}:0 # 原始铭文
/content/{pointer}:5 # 第5次更新版本行为: 长TTL缓存(30天),内容不可变。
Response Headers
响应头
| Header | Description |
|---|---|
| Current outpoint |
| Original inscription outpoint |
| Sequence number |
| JSON MAP metadata |
| Parent inscription outpoint |
| 响应头 | 说明 |
|---|---|
| 当前输出点 |
| 原始铭文输出点 |
| 版本序列号 |
| JSON格式的MAP元数据 |
| 父级铭文输出点 |
Directories (ord-fs/json)
目录(ord-fs/json)
Inscriptions with content type represent directories.
ord-fs/json内容类型为的铭文代表目录。
ord-fs/jsonDirectory Format
目录格式
json
{
"index.html": "ord://abc123..._0",
"style.css": "abc123..._1",
"app.js": "def456..._0"
}Values can be:
- - Full ordinal reference
ord://txid_vout - or
txid_vout- Direct referencetxid
json
{
"index.html": "ord://abc123..._0",
"style.css": "abc123..._1",
"app.js": "def456..._0"
}值可以是:
- - 完整序数引用
ord://txid_vout - 或
txid_vout- 直接引用txid
Accessing Directory Files
访问目录中的文件
/content/{directory_pointer}/index.html
/content/{directory_pointer}/style.css
/content/{directory_pointer}/app.js/content/{directory_pointer}/index.html
/content/{directory_pointer}/style.css
/content/{directory_pointer}/app.jsSPA Routing
SPA路由
For SPAs, unknown paths fall back to :
index.html/content/{pointer}/unknown/path → Returns index.html对于单页应用(SPA),未知路径会回退到:
index.html/content/{pointer}/unknown/path → 返回index.htmlRaw Directory JSON
原始目录JSON
Add to get the directory listing instead of index.html:
?raw/content/{pointer}?raw添加参数可获取目录列表的JSON数据,而非index.html:
?raw/content/{pointer}?rawPreview Endpoint
预览端点
Test HTML inscriptions before broadcasting.
在广播前测试HTML铭文。
Base64 HTML Preview
Base64编码HTML预览
/preview/{base64EncodedHtml}Example:
javascript
const html = "<html><body>Hello!</body></html>";
const b64 = btoa(html);
const previewUrl = `https://ordfs.network/preview/${b64}`;/preview/{base64EncodedHtml}示例:
javascript
const html = "<html><body>Hello!</body></html>";
const b64 = btoa(html);
const previewUrl = `https://ordfs.network/preview/${b64}`;POST Preview
POST方式预览
bash
curl -X POST https://ordfs.network/preview \
-H "Content-Type: text/html" \
-d "<html><body>Hello!</body></html>"bash
curl -X POST https://ordfs.network/preview \
-H "Content-Type: text/html" \
-d "<html><body>Hello!</body></html>"Recursive Inscriptions
递归铭文
Reference other inscriptions from HTML/JS content.
在HTML/JS内容中引用其他铭文。
Pattern
模式
html
<script src="/content/abc123..._0"></script>
<img src="/def456..._0" />
<link href="/content/style123..._0/main.css" rel="stylesheet">html
<script src="/content/abc123..._0"></script>
<img src="/def456..._0" />
<link href="/content/style123..._0/main.css" rel="stylesheet">Base Path Handling
基础路径处理
ORDFS sets up base paths for recursive content to resolve correctly.
ORDFS会为递归内容设置基础路径,确保引用正确解析。
API Endpoints
API端点
V1 Endpoints
V1端点
| Endpoint | Purpose |
|---|---|
| Latest block info |
| Block by height |
| Block by hash |
| Raw transaction |
| 端点 | 用途 |
|---|---|
| 获取最新区块信息 |
| 通过高度获取区块 |
| 通过哈希获取区块 |
| 获取原始交易数据 |
V2 Endpoints
V2端点
| Endpoint | Purpose |
|---|---|
| Raw transaction |
| Merkle proof |
| BEEF format proof |
| Specific output |
| Latest block header |
| Current height |
| Inscription metadata |
| Streaming content |
| 端点 | 用途 |
|---|---|
| 获取原始交易数据 |
| 获取默克尔证明 |
| 获取BEEF格式的证明 |
| 获取指定输出 |
| 获取最新区块头 |
| 获取当前区块高度 |
| 获取铭文元数据 |
| 流式获取内容 |
DNS-Based Access
基于DNS的访问
Map custom domains to inscriptions.
将自定义域名映射到铭文。
DNS TXT Record
DNS TXT记录
Create :
_ordfs.yourdomain.com_ordfs.yourdomain.com IN TXT "ordfs=abc123..._0:5"Format:
ordfs={pointer}[:{sequence}]创建记录:
_ordfs.yourdomain.com_ordfs.yourdomain.com IN TXT "ordfs=abc123..._0:5"格式:
ordfs={pointer}[:{sequence}]How It Works
工作原理
- User visits
yourdomain.com/path/to/file - ORDFS resolves DNS TXT record
- Returns content from inscription directory
- 用户访问
yourdomain.com/path/to/file - ORDFS解析DNS TXT记录
- 返回对应铭文目录中的内容
Common Usage Patterns
常见使用模式
Image Display
图片展示
typescript
// Using bitcoin-image for normalization
import { getDisplayUrl } from "bitcoin-image";
const imageUrl = await getDisplayUrl("ord://abc123..._0");
// Returns: https://ordfs.network/abc123..._0
// Direct construction
const url = `https://ordfs.network/${txid}_${vout}`;typescript
// 使用bitcoin-image进行URL标准化
import { getDisplayUrl } from "bitcoin-image";
const imageUrl = await getDisplayUrl("ord://abc123..._0");
// 返回:https://ordfs.network/abc123..._0
// 直接构造URL
const url = `https://ordfs.network/${txid}_${vout}`;Fetch Content
获取内容
typescript
// Get inscription content
const response = await fetch(`https://ordfs.network/${origin}`);
const content = await response.text();
// Get with metadata
const metaResponse = await fetch(
`https://ordfs.network/content/${origin}?map=true`
);
const mapData = metaResponse.headers.get("X-Map");typescript
// 获取铭文内容
const response = await fetch(`https://ordfs.network/${origin}`);
const content = await response.text();
// 附带元数据获取
const metaResponse = await fetch(
`https://ordfs.network/content/${origin}?map=true`
);
const mapData = metaResponse.headers.get("X-Map");Check Latest Version
检查最新版本
typescript
// Get latest sequence
const response = await fetch(`https://ordfs.network/content/${origin}`);
const sequence = response.headers.get("X-Ord-Seq");
const currentOutpoint = response.headers.get("X-Outpoint");typescript
// 获取最新版本序列
const response = await fetch(`https://ordfs.network/content/${origin}`);
const sequence = response.headers.get("X-Ord-Seq");
const currentOutpoint = response.headers.get("X-Outpoint");Caching Behavior
缓存行为
| Request Type | Cache TTL |
|---|---|
Specific sequence ( | 30 days |
| Latest sequence (default) | 60 seconds |
| Block headers (depth 100+) | 30 days |
| Block headers (depth 4-99) | 1 hour |
| Block tip | No cache |
| 请求类型 | 缓存有效期(TTL) |
|---|---|
特定版本序列( | 30天 |
| 最新版本(默认) | 60秒 |
| 区块头(深度100+) | 30天 |
| 区块头(深度4-99) | 1小时 |
| 区块顶端 | 无缓存 |
Additional Resources
其他资源
Reference Files
参考文档
- - Complete API documentation
references/api-reference.md - - DNS, streaming, directories
references/advanced-features.md
- - 完整API文档
references/api-reference.md - - DNS、流式传输、目录功能详解
references/advanced-features.md
Examples
示例代码
- - Content fetching patterns
examples/fetch-content.ts - - Recursive inscription example
examples/recursive-inscription.html
- - 内容获取示例
examples/fetch-content.ts - - 递归铭文示例
examples/recursive-inscription.html
Related Packages
相关包
- - URL normalization for ordfs.network
bitcoin-image - - Create inscriptions
js-1sat-ord - - Inscription templates
@bopen-io/templates
- - 为ordfs.network提供URL标准化功能
bitcoin-image - - 创建铭文
js-1sat-ord - - 铭文模板
@bopen-io/templates