一键导入
act
Guide to Swarm ACT encryption and access control: create grantees, upload protected data, grant/revoke access, and troubleshoot not-found/history issues.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide to Swarm ACT encryption and access control: create grantees, upload protected data, grant/revoke access, and troubleshoot not-found/history issues.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | act |
| description | Guide to Swarm ACT encryption and access control: create grantees, upload protected data, grant/revoke access, and troubleshoot not-found/history issues. |
Guide a developer through encrypting data on Swarm and controlling who can read it. ACT (Access Control Trie) lets you define per-account read permissions using Ethereum public keys.
When presenting to the user, use consistent labels before each code block:
filename: — file contents the user should write to diskAdd a --- horizontal rule before each labeled code block to visually separate it from surrounding text.
Silently check node status (curl -s http://localhost:1633/node) and stamp availability (swarm-cli stamp list). If the node is down, offer to walk through /setup-bee-interactive. If no usable stamp exists, route to /stamps.
npm install -g @ethersphere/swarm-clinpm install @ethersphere/bee-jsswarm-cli upload test.txt --act --stamp <BATCH_ID>
First upload — omit --act-history-address to create a new history. The response returns:
Warning: Save the history reference securely. Losing it means permanent, irrecoverable loss of access to your encrypted data. There is no recovery mechanism.
For subsequent uploads to the same history:
swarm-cli upload test.txt --act --stamp <BATCH_ID> --act-history-address <HISTORY_REF>
swarm-cli download <SWARM_HASH> output.txt \
--act \
--act-history-address <HISTORY_REF> \
--act-publisher <PUBLIC_KEY>
--act-publisher — the uploader's public key (needed for decryption). Get it from swarm-cli addresses → "Public Key:" field.--act-timestamp — optional, defaults to current time. Use to access a specific version.Without the ACT flags, the download will fail with "not found".
Create a JSON file with the public keys of accounts that should have access:
{
"grantees": [
"03ec55e9fb2aefb8600f69142abaad79311516c232b28919d66efb4d41bce15bfa",
"03fdcab22b455ce08a481d929a4cb9f447752545818eded1ad1785c51581e822c6"
]
}
swarm-cli grantee create grantees.json --stamp <BATCH_ID>
Returns a grantee reference and history reference — save both.
Create a patch JSON:
{
"add": ["03fdcab22b455ce08a481d929a4cb9f447752545818eded1ad1785c51581e822c6"],
"revoke": ["03ec55e9fb2aefb8600f69142abaad79311516c232b28919d66efb4d41bce15bfa"]
}
swarm-cli grantee patch grantees-patch.json \
--reference <GRANTEE_REF> \
--history <GRANTEE_HISTORY_REF> \
--stamp <BATCH_ID>
Note: Wait at least 1 second between grantee list updates — updating within the same second causes an error.
swarm-cli grantee get <GRANTEE_REF>
import { Bee } from '@ethersphere/bee-js'
const bee = new Bee('http://localhost:1633')
// Upload a file with ACT encryption enabled
const result = await bee.uploadFile(batchId, 'Secret data', 'secret.txt', {
act: true
})
const historyAddress = result.historyAddress.getOrThrow()
console.log('Encrypted reference:', result.reference.toHex())
console.log('History address:', historyAddress.toHex())
// WARNING: Save both — losing the history address means permanent loss of access to encrypted data
import { Bee } from '@ethersphere/bee-js'
const bee = new Bee('http://localhost:1633')
// Get the publisher's public key (share this with grantees):
const publisherAddresses = await bee.getNodeAddresses()
const publisherPublicKey = publisherAddresses.publicKey // not pssPublicKey
const file = await bee.downloadFile(encryptedReference, 'secret.txt', {
actHistoryAddress: historyAddress,
actPublisher: publisherPublicKey
})
console.log('Decrypted:', file.data.toUtf8())
// Without ACT parameters, this returns "not found"
import { Bee } from '@ethersphere/bee-js'
const bee = new Bee('http://localhost:1633')
// Create grantee list
const granteeResult = await bee.createGrantees(batchId, [
'03ec55e9fb2aefb8600f69142abaad79311516c232b28919d66efb4d41bce15bfa'
])
const granteeReference = granteeResult.ref
const historyReference = granteeResult.historyref
console.log('Grantee ref:', granteeReference.toHex())
console.log('History ref:', historyReference.toHex())
// Get current grantees
const granteesResult = await bee.getGrantees(granteeReference)
console.log('Grantees:', granteesResult.grantees.map(k => k.toCompressedHex()))
// Update access — add and revoke
await bee.patchGrantees(batchId, granteeReference, historyReference, {
add: ['03fdcab22b455ce08a481d929a4cb9f447752545818eded1ad1785c51581e822c6'],
revoke: ['03ec55e9fb2aefb8600f69142abaad79311516c232b28919d66efb4d41bce15bfa']
})
| Error | Fix |
|---|---|
| "not found" on download | Missing ACT flags, wrong history address, or access revoked |
| "act: invalid history" | Wrong history address — double-check reference |
| "stamp not usable" | Wait 2-3 minutes after buying |
| 1-second update error | Wait at least 1 second between grantee list updates |
| Other errors | Route to /troubleshoot |
For any conceptual or technical question not covered by the steps above, invoke /docs to find the relevant authoritative source rather than answering from prior knowledge.
Build and publish a Swarm blog with a permanent feed-manifest URL, post management workflow, and optional ENS domain mapping.
Scaffold a Swarm app or add bee-js to an existing project, with core upload/download patterns and node-compatibility guidance.
Answer Swarm conceptual questions from official docs with source links; use for APIs, behavior, configuration, and architecture clarifications.
Create and manage Swarm feeds for stable, updateable URLs using bee-js or swarm-cli, including manifest creation and feed updates.
Deploy and update static websites on Swarm via one-off or feed-based publishing, with optional ENS integration and stamp lifecycle notes.
Show all Swarm skills, check node status, and route developers to setup, storage, website, app, security, messaging, or troubleshooting flows.