HashLinks - Actions, Blocks, and Assembly Standard
Status: DraftDirect link to Status: Draft
AuthorsDirect link to Authors
- Kantorcodes https://twitter.com/kantorcodes
AbstractDirect link to Abstract
HashLinks provides a framework for building interactive experiences on Hedera without the overhead of smart contracts. The standard combines WebAssembly modules for logic execution, WordPress Gutenberg blocks for UI components, and an assembly layer for composition.
Normative language in this document uses the key words MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY as described in RFC 2119.
MotivationDirect link to Motivation
Hedera's ecosystem needs better composability solutions. While smart contracts offer powerful capabilities, they're often expensive and complex for many use cases. HashLinks addresses this gap by providing:
- Deterministic logic execution through WebAssembly without smart contract fees
- Reusable UI components based on proven standards (Gutenberg)
- On-chain verification without relying on centralized infrastructure
- Seamless integration with existing Hedera wallets and tools
The standard consists of three interconnected layers:
- Actions - WASM modules for deterministic execution
- Blocks - UI components for user interaction
- Assembly - Composition layer for combining actions and blocks
For implementation details, see the Standards SDK HCS-12 Guide which documents the TypeScript/JavaScript implementation.
Architecture OverviewDirect link to Architecture Overview
The HashLinks architecture consists of three core components:
- Actions: WebAssembly modules that execute business logic
- Blocks: UI components built on the Gutenberg block standard
- Assembly: Composition layer that binds actions to blocks
Basic ArchitectureDirect link to Basic Architecture
The relationship between components:
Detailed ArchitectureDirect link to Detailed Architecture
Complete system architecture including all dependencies:
Topic SystemDirect link to Topic System
HashLinks leverages HCS-2 for registry management, following the principle of no admin keys to ensure decentralization.
Topic TypesDirect link to Topic Types
Registry structure and storage locations:
| Topic Type | Purpose | Configuration |
|---|---|---|
| Action Registry | Stores WASM module references | Non-indexed (latest version) |
| Assembly Registry | Complete HashLink configurations | Indexed (maintains history) |
| HashLinks Registry | Global directory of HashLinks | Non-indexed |
| Block Storage | Block definitions and templates | HCS-1 protocol |
| Resource References | Asset loading mechanism | HCS-3 protocol |
Registries SHOULD support HIP-991 fee collection for sustainability.
Topic Memo FormatDirect link to Topic Memo Format
Following HCS-2 specification:
hcs-12:{indexed}:{ttl}:{type}:[additional parameters]
Where:
indexedindicates whether all messages need to be read (0) or only the latest message (1)ttlspecifies a time-to-live in seconds for cachingtypedefines the component type using an enum value- Additional parameters vary by topic type
Type Enum Values
| Type Enum | Component Type | Description |
|---|---|---|
0 | Action | WASM module registry (non-indexed, similar to HCS-6) |
1 | Assembly | Composition registry (indexed) |
2 | HashLinks | Global directory registry (non-indexed) |
Action Registry Topic Memo
hcs-12:1:60:0
Assembly Registry Topic Memo
hcs-12:0:60:1
HashLinks Registry Topic Memo
hcs-12:1:60:2
WebAssembly Interface StabilityDirect link to WebAssembly Interface Stability
HashLinks implementations MUST store both the WASM binary and its JavaScript wrapper on-chain. This ensures consistent execution across different environments:
- JavaScript Wrapper Requirement - The wasm-bindgen generated JavaScript must be inscribed alongside the WASM
- Version Tracking - The
interface_versionfield tracks the wasm-bindgen version used - Stable Execution - Both files together ensure deterministic execution regardless of client implementation
This approach addresses the inherent instability of WebAssembly imports and the complexity of wasm-bindgen's memory management.
Operation ReferenceDirect link to Operation Reference
This section defines all operations available in the HCS-12 protocol. Operations MUST be submitted as JSON messages to the appropriate registry topics.
Action Registry OperationsDirect link to Action Registry Operations
| Operation | Description | Required Fields |
|---|---|---|
register | Register a new WASM action module | p, op, t_id, hash, wasm_hash |
Register ActionDirect link to Register Action
Registers a new WASM module with its metadata and verification hashes. Messages MUST include the required fields noted above and MAY include optional fields where specified:
{
"p": "hcs-12",
"op": "register",
"t_id": "0.0.123456",
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"wasm_hash": "a1b2c3d4e5f6789012345678901234567890123456789012345678901234567890",
"js_t_id": "0.0.123457",
"js_hash": "5f6e7d8c9b0a1234567890123456789012345678901234567890123456789012",
"interface_version": "0.2.92",
"info_t_id": "0.0.123458",
"validation_rules": {
"amount": {
"type": "number",
"min": 0,
"max": 1000000
}
},
"m": "Token transfer action v1.0.0"
}
Assembly Registry OperationsDirect link to Assembly Registry Operations
| Operation | Description | Required Fields |
|---|---|---|
register | Create a new assembly | p, op, name, version |
add-action | Add an action to the assembly | p, op, t_id, alias |
add-block | Add a block to the assembly | p, op, block_t_id |
update | Update assembly metadata | p, op |
Register AssemblyDirect link to Register Assembly
Creates a new assembly that can combine actions and blocks:
{
"p": "hcs-12",
"op": "register",
"name": "defi-dashboard",
"version": "1.0.0",
"description": "Complete DeFi dashboard with swapping and staking",
"tags": ["defi", "trading", "staking"],
"author": "0.0.123456"
}
Add ActionDirect link to Add Action
Adds a WASM action to the assembly:
{
"p": "hcs-12",
"op": "add-action",
"t_id": "0.0.123456",
"alias": "swap",
"config": {
"slippage": 0.5,
"deadline": 300
}
}
Add BlockDirect link to Add Block
Adds a UI block to the assembly:
{
"p": "hcs-12",
"op": "add-block",
"block_t_id": "0.0.234568",
"actions": {
"swap": "0.0.123456",
"approve": "0.0.123457"
},
"attributes": {
"title": "Quick Swap",
"defaultToken": "HBAR"
}
}
Update AssemblyDirect link to Update Assembly
Updates assembly metadata:
{
"p": "hcs-12",
"op": "update",
"description": "Updated DeFi dashboard with new features",
"tags": ["defi", "trading", "staking", "lending"]
}
HashLinks Registry OperationsDirect link to HashLinks Registry Operations
| Operation | Description | Required Fields |
|---|---|---|
register | Register a HashLink in the global directory | p, op, t_id, name |
Register HashLinkDirect link to Register HashLink
Registers an assembly in the global HashLinks directory:
{
"p": "hcs-12",
"op": "register",
"t_id": "0.0.567890",
"name": "Ultimate DeFi Dashboard",
"description": "All-in-one DeFi management interface",
"tags": ["defi", "featured"],
"category": "finance",
"author": "0.0.123456",
"website": "https://example.com"
}
Security ConsiderationsDirect link to Security Considerations
Key security requirements:
- Hash Verification: Clients MUST verify WASM, JavaScript wrapper, and metadata hashes before execution.
- Template Security: Templates MUST NOT include inline scripts; all resources MUST be loaded via HCS-3.
- State Isolation: Blocks MUST be isolated by default, with explicit permission required for communication.
- Action Validation: All actions MUST be registered with parameter validation and HTML sanitization.
- Interface Verification: The JavaScript wrapper MUST match the WASM module interface version.
Implementation GuideDirect link to Implementation Guide
Step 1: Create Your WASM ActionDirect link to Step 1: Create Your WASM Action
Step 2: Create UI BlockDirect link to Step 2: Create UI Block
Step 3: Create AssemblyDirect link to Step 3: Create Assembly
Step 4: Register in Global DirectoryDirect link to Step 4: Register in Global Directory
Step 5: User Interaction FlowDirect link to Step 5: User Interaction Flow
Client ArchitectureDirect link to Client Architecture
Required components for HashLinks client implementation: