filecoin 0.0.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +139 -10
- package/bin/filecoin.js +7 -0
- package/dist/chunks/_esm-BBXTTBLC.js +9 -0
- package/dist/chunks/_esm-BBXTTBLC.js.map +7 -0
- package/dist/chunks/ccip-TGFMQFIR.js +3 -0
- package/dist/chunks/ccip-TGFMQFIR.js.map +7 -0
- package/dist/chunks/chunk-2VZELE36.js +124 -0
- package/dist/chunks/chunk-2VZELE36.js.map +7 -0
- package/dist/chunks/chunk-35V77X3C.js +12 -0
- package/dist/chunks/chunk-35V77X3C.js.map +7 -0
- package/dist/chunks/chunk-3TJUKWFC.js +6 -0
- package/dist/chunks/chunk-3TJUKWFC.js.map +7 -0
- package/dist/chunks/chunk-5CKSVYCY.js +4 -0
- package/dist/chunks/chunk-5CKSVYCY.js.map +7 -0
- package/dist/chunks/chunk-7MEK5RQ7.js +11 -0
- package/dist/chunks/chunk-7MEK5RQ7.js.map +7 -0
- package/dist/chunks/chunk-AHVL5QFR.js +4 -0
- package/dist/chunks/chunk-AHVL5QFR.js.map +7 -0
- package/dist/chunks/chunk-CC75NTEJ.js +5 -0
- package/dist/chunks/chunk-CC75NTEJ.js.map +7 -0
- package/dist/chunks/chunk-D63BUPKY.js +3 -0
- package/dist/chunks/chunk-D63BUPKY.js.map +7 -0
- package/dist/chunks/chunk-FCVBKUS5.js +4 -0
- package/dist/chunks/chunk-FCVBKUS5.js.map +7 -0
- package/dist/chunks/chunk-I5AWWJGL.js +3 -0
- package/dist/chunks/chunk-I5AWWJGL.js.map +7 -0
- package/dist/chunks/chunk-IFG72OQD.js +4 -0
- package/dist/chunks/chunk-IFG72OQD.js.map +7 -0
- package/dist/chunks/chunk-JUFFOBKU.js +59 -0
- package/dist/chunks/chunk-JUFFOBKU.js.map +7 -0
- package/dist/chunks/chunk-P2G2GV6U.js +3 -0
- package/dist/chunks/chunk-P2G2GV6U.js.map +7 -0
- package/dist/chunks/chunk-PSXNKYPA.js +3 -0
- package/dist/chunks/chunk-PSXNKYPA.js.map +7 -0
- package/dist/chunks/chunk-QAYTK26Z.js +4 -0
- package/dist/chunks/chunk-QAYTK26Z.js.map +7 -0
- package/dist/chunks/chunk-QLZRQUR6.js +4 -0
- package/dist/chunks/chunk-QLZRQUR6.js.map +7 -0
- package/dist/chunks/chunk-RK6JJQZL.js +41 -0
- package/dist/chunks/chunk-RK6JJQZL.js.map +7 -0
- package/dist/chunks/chunk-S2DTA2FM.js +3 -0
- package/dist/chunks/chunk-S2DTA2FM.js.map +7 -0
- package/dist/chunks/chunk-SVWQJYA5.js +3 -0
- package/dist/chunks/chunk-SVWQJYA5.js.map +7 -0
- package/dist/chunks/chunk-TCUXKQ65.js +4 -0
- package/dist/chunks/chunk-TCUXKQ65.js.map +7 -0
- package/dist/chunks/chunk-UW35AN2V.js +186 -0
- package/dist/chunks/chunk-UW35AN2V.js.map +7 -0
- package/dist/chunks/chunk-VGOSQFKJ.js +3 -0
- package/dist/chunks/chunk-VGOSQFKJ.js.map +7 -0
- package/dist/chunks/chunk-YIAP3JO3.js +3 -0
- package/dist/chunks/chunk-YIAP3JO3.js.map +7 -0
- package/dist/chunks/chunk-ZAMDBJVN.js +3 -0
- package/dist/chunks/chunk-ZAMDBJVN.js.map +7 -0
- package/dist/chunks/delete-SPJVG4ZK.js +3 -0
- package/dist/chunks/delete-SPJVG4ZK.js.map +7 -0
- package/dist/chunks/doctor-AQGSDILX.js +3 -0
- package/dist/chunks/doctor-AQGSDILX.js.map +7 -0
- package/dist/chunks/get-C4RUQWRS.js +3 -0
- package/dist/chunks/get-C4RUQWRS.js.map +7 -0
- package/dist/chunks/inspect-NXI72CUH.js +3 -0
- package/dist/chunks/inspect-NXI72CUH.js.map +7 -0
- package/dist/chunks/inspect-SBGOKBEP.js +3 -0
- package/dist/chunks/inspect-SBGOKBEP.js.map +7 -0
- package/dist/chunks/login-3LYCAAPW.js +4 -0
- package/dist/chunks/login-3LYCAAPW.js.map +7 -0
- package/dist/chunks/logout-JLRMENQI.js +3 -0
- package/dist/chunks/logout-JLRMENQI.js.map +7 -0
- package/dist/chunks/ls-N5D6HCA4.js +3 -0
- package/dist/chunks/ls-N5D6HCA4.js.map +7 -0
- package/dist/chunks/ls-O5RNPZCH.js +3 -0
- package/dist/chunks/ls-O5RNPZCH.js.map +7 -0
- package/dist/chunks/map-error-QLS3CQMO.js +3 -0
- package/dist/chunks/map-error-QLS3CQMO.js.map +7 -0
- package/dist/chunks/put-GTJP7IFM.js +3 -0
- package/dist/chunks/put-GTJP7IFM.js.map +7 -0
- package/dist/chunks/resume-BCEYVRX7.js +3 -0
- package/dist/chunks/resume-BCEYVRX7.js.map +7 -0
- package/dist/chunks/secp256k1-2OHXXNYZ.js +3 -0
- package/dist/chunks/secp256k1-2OHXXNYZ.js.map +7 -0
- package/dist/chunks/skills.run-E7FJPXEM.js +5 -0
- package/dist/chunks/skills.run-E7FJPXEM.js.map +7 -0
- package/dist/chunks/status-IWMRFMPV.js +3 -0
- package/dist/chunks/status-IWMRFMPV.js.map +7 -0
- package/dist/main.js +3 -0
- package/dist/main.js.map +7 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +49 -10
- package/skills/filecoin/SKILL.md +41 -0
- package/basic_types.md +0 -94
- package/chain.md +0 -280
- package/index.js +0 -1
- package/messages.md +0 -1684
- package/state.md +0 -1415
package/package.json
CHANGED
|
@@ -1,16 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filecoin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Command-line interface for Filecoin storage",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Hugo Dias <hugomrdias@gmail.com>",
|
|
7
|
+
"homepage": "https://github.com/filecoin-project/agents/tree/main/packages/filecoin-cli#readme",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "git+https://github.com/filecoin-project/agents.git",
|
|
11
|
+
"directory": "packages/filecoin-cli"
|
|
9
12
|
},
|
|
10
|
-
"
|
|
11
|
-
"filecoin"
|
|
12
|
-
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/filecoin-project/agents/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"bin": {
|
|
18
|
+
"filecoin": "./bin/filecoin.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"bin",
|
|
22
|
+
"dist",
|
|
23
|
+
"skills",
|
|
24
|
+
"README.md"
|
|
13
25
|
],
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@filoz/synapse-core": "^0.10.1",
|
|
28
|
+
"@ipld/car": "^5.4.7",
|
|
29
|
+
"@types/node": "26.5.1",
|
|
30
|
+
"clipact": "0.4.0",
|
|
31
|
+
"env-paths": "^4.0.0",
|
|
32
|
+
"esbuild": "0.28.2",
|
|
33
|
+
"ipfs-unixfs-exporter": "^16.2.3",
|
|
34
|
+
"ipfs-unixfs-importer": "^17.1.1",
|
|
35
|
+
"iso-conf": "^0.4.2",
|
|
36
|
+
"multiformats": "^14.0.5",
|
|
37
|
+
"typescript": "7.0.2",
|
|
38
|
+
"viem": "^2.56.9",
|
|
39
|
+
"zod": "4.6.5"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=24"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"clean": "rm -rf dist skills",
|
|
49
|
+
"build": "node scripts/build.ts",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
51
|
+
"test": "node --test 'test/**/*.test.ts'",
|
|
52
|
+
"lint": "biome check .",
|
|
53
|
+
"check": "pnpm typecheck && pnpm test && pnpm lint"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: filecoin
|
|
3
|
+
description: Store files and folders on Filecoin with the filecoin CLI, return links to share them, and retrieve and verify them later. Use when the user asks to publish, store, share, back up, retrieve, or verify content on Filecoin.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Filecoin for Agents
|
|
7
|
+
|
|
8
|
+
`filecoin` stores a file (its exact bytes) or a folder (a UnixFS CAR served over IPFS) on Filecoin and returns links to share it. A person owns the wallet and approves what you may do. You never hold the wallet key.
|
|
9
|
+
|
|
10
|
+
## Run it
|
|
11
|
+
|
|
12
|
+
Run `filecoin` when it is on the PATH. Otherwise run `npx -y filecoin` in its place, which needs Node.js 24 or newer.
|
|
13
|
+
|
|
14
|
+
Every command writes one JSON object to stdout: `data` on success or `error` on failure, then optional `next` steps. Branch on `error.code`, never on stderr text.
|
|
15
|
+
|
|
16
|
+
Don't guess flags or fields. The installed CLI describes itself:
|
|
17
|
+
|
|
18
|
+
- `filecoin --help` lists the commands, and `filecoin <command> --help` shows examples and flags.
|
|
19
|
+
- `filecoin schema <command>` gives the input and output JSON Schemas, and what each error code means.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. `filecoin status` shows whether a session key is approved and the account is funded.
|
|
24
|
+
2. `filecoin put <path> --dry-run` reports the size, provider, cost, and missing authorization without storing anything.
|
|
25
|
+
3. `filecoin put <path>` stores it. Give the user `data.urls.browser` exactly as returned, with `data.resource.ref`.
|
|
26
|
+
4. `filecoin get <ref>` downloads the content and verifies it. `filecoin ls` and `filecoin inspect <ref>` find what was stored.
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
- Never ask for or pass a private key. Logging in needs the user: `auth_required` or `login_pending` means relay the `by: "user"` step (the filecoin-app approval link) and stop. After the user approves, run `filecoin login --check` once to confirm. On `session_conflict`, keep the saved key unless the user agrees to approve a new one.
|
|
31
|
+
- `insufficient_funds` and `session_expired` also need the user. Relay their `next` steps.
|
|
32
|
+
- `filecoin delete <ref>` needs `--yes`. On `confirmation_required`, relay the reason and rerun with `--yes` only after the user agrees.
|
|
33
|
+
- Never repeat a failed or interrupted `put` or `delete`: that starts a new paid operation. Run the `filecoin operations resume <id>` command from `next` instead. Errors with a filecoin CLI code also carry the ID in `error.details.operationId`. Find lost operation IDs with `filecoin operations ls --incomplete`.
|
|
34
|
+
- Retry only when `error.retryable` is `true`, after `retryAfterSeconds` when present.
|
|
35
|
+
|
|
36
|
+
## Read more only when you need it
|
|
37
|
+
|
|
38
|
+
Fetch these pages; each is Markdown:
|
|
39
|
+
|
|
40
|
+
- No browser to open, or a disk that is gone when the session ends, such as a cloud sandbox: read [Cloud agents](https://poc.filecoin.cloud/agents.md#cloud-agents) before `filecoin login`.
|
|
41
|
+
- A link returns 404, the user wants proof the content is intact, or `filecoin ls` is missing content stored elsewhere: read [Retrieve and verify](https://poc.filecoin.cloud/docs/retrieve.md).
|
package/basic_types.md
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Filecoin Data Structures Basic Types
|
|
2
|
-
|
|
3
|
-
These types are used throughout the Filecoin data structures.
|
|
4
|
-
|
|
5
|
-
```ipldsch
|
|
6
|
-
# Address is a `https://github.com/filecoin-project/go-address` in its binary byte format.
|
|
7
|
-
# It may be used as a hamt key, and will be often visualized or presented to users
|
|
8
|
-
# in its more readable string form.
|
|
9
|
-
type Address bytes
|
|
10
|
-
|
|
11
|
-
# Go big.Int
|
|
12
|
-
# Prefer presenting to users either as a number or a string view of the decimal number
|
|
13
|
-
# for readability.
|
|
14
|
-
type BigInt bytes
|
|
15
|
-
|
|
16
|
-
# An indicator of which RPC method on an actor a message should trigger execution of.
|
|
17
|
-
type MethodNum int
|
|
18
|
-
|
|
19
|
-
# The 'f0...' subset of Addresses used for the actual indexes of actors in a state root.
|
|
20
|
-
type ActorID int
|
|
21
|
-
|
|
22
|
-
# the height of a block in the chain. Should fit in an Int64
|
|
23
|
-
type ChainEpoch int
|
|
24
|
-
|
|
25
|
-
# the ChainEpoch as bytes, where the integer is converted to its string form and
|
|
26
|
-
# the string's bytes are used
|
|
27
|
-
type ChainEpochBytes bytes
|
|
28
|
-
|
|
29
|
-
type TokenAmount BigInt
|
|
30
|
-
|
|
31
|
-
type PaddedPieceSize int
|
|
32
|
-
|
|
33
|
-
type PeerID bytes
|
|
34
|
-
|
|
35
|
-
type SectorSize int
|
|
36
|
-
|
|
37
|
-
type SectorNumber int
|
|
38
|
-
|
|
39
|
-
# the SectorNumber as bytes, where the integer is encoded as a uvarint and the
|
|
40
|
-
# resulting bytes are used
|
|
41
|
-
type SectorNumberBytes bytes
|
|
42
|
-
|
|
43
|
-
type PartitionNumber int
|
|
44
|
-
|
|
45
|
-
type BitField bytes
|
|
46
|
-
|
|
47
|
-
type StoragePower BigInt
|
|
48
|
-
|
|
49
|
-
type DataCap StoragePower
|
|
50
|
-
|
|
51
|
-
type DealID int
|
|
52
|
-
|
|
53
|
-
# the DealID as bytes, where the integer is encoded as a uvarint and the resulting
|
|
54
|
-
# bytes are used
|
|
55
|
-
type DealIDBytes bytes
|
|
56
|
-
|
|
57
|
-
type DealWeight BigInt
|
|
58
|
-
|
|
59
|
-
type Multiaddr bytes
|
|
60
|
-
|
|
61
|
-
type RegisteredSealProof int
|
|
62
|
-
|
|
63
|
-
type TransactionID # TxnID
|
|
64
|
-
|
|
65
|
-
# the TransactionID as bytes, where the integer is encoded as a varint (not uvarint)
|
|
66
|
-
# and the resulting bytes are used
|
|
67
|
-
type TransactionIDBytes bytes
|
|
68
|
-
|
|
69
|
-
# A quantity of space x time (in byte-epochs) representing power committed to the network for some duration.
|
|
70
|
-
type Spacetime BigInt
|
|
71
|
-
|
|
72
|
-
type ExitCode int
|
|
73
|
-
|
|
74
|
-
# Message parameters are encoded as DAG-CBOR and the resulting bytes are
|
|
75
|
-
# embedded as `Params` fields in some structs.
|
|
76
|
-
# See the Filecoin Messages Data Structures document for encoded DAG-CBOR message
|
|
77
|
-
# params
|
|
78
|
-
type CborEncodedParams Bytes
|
|
79
|
-
|
|
80
|
-
# Message receipt returns are encoded as DAG-CBOR and the resulting bytes are
|
|
81
|
-
# embedded as the `Return` field in `MessageReceipt`.
|
|
82
|
-
# See the Filecoin Messages Data Structures document for encoded DAG-CBOR message
|
|
83
|
-
# returns
|
|
84
|
-
type CborEncodedReturn Bytes
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Crypto Types
|
|
88
|
-
|
|
89
|
-
```ipldsch
|
|
90
|
-
type Signature union {
|
|
91
|
-
SignatureSecp256k1 1
|
|
92
|
-
SignatureBLS 2
|
|
93
|
-
} representation byteprefix
|
|
94
|
-
```
|
package/chain.md
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
# Filecoin Main Chain Data Structures
|
|
2
|
-
|
|
3
|
-
* [Genesis Block](#genesis-block)
|
|
4
|
-
* [Chain](#chain)
|
|
5
|
-
* [Messages](#messages)
|
|
6
|
-
* [Actors](#actors)
|
|
7
|
-
* [Actor type linking](#actor-type-linking)
|
|
8
|
-
|
|
9
|
-
## Genesis Block
|
|
10
|
-
|
|
11
|
-
There is a single block at the base of the entire chain with this layout. It is
|
|
12
|
-
the only structure that uses an actual Map at the representation level (other
|
|
13
|
-
structs use the `tuple` representation which encodes them as Lists). It is
|
|
14
|
-
encoded with DAG-CBOR with a SHA2-256 which gives the CID:
|
|
15
|
-
`bafyreiaqpwbbyjo4a42saasj36kkrpv4tsherf2e7bvezkert2a7dhonoi`.
|
|
16
|
-
|
|
17
|
-
This block is not referenced as height `0` as this is reserved for the first
|
|
18
|
-
`BlockHeader` block which carries the initial state (see below). This block
|
|
19
|
-
links Filecoin to the Ethereum chain.
|
|
20
|
-
|
|
21
|
-
Note that this block does not conform to strict DAG-CBOR in that its Map keys
|
|
22
|
-
are not sorted according to canonical rules. Therefore it does not round-trip
|
|
23
|
-
cleanly through current DAG-CBOR codecs, although current codecs are able to
|
|
24
|
-
decode it.
|
|
25
|
-
|
|
26
|
-
```ipldsch
|
|
27
|
-
type Genesis struct {
|
|
28
|
-
Datetime String
|
|
29
|
-
Network String
|
|
30
|
-
Token String
|
|
31
|
-
TokenAmounts TokenAmounts
|
|
32
|
-
Message String
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type TokenAmounts struct {
|
|
36
|
-
TotalSupply String
|
|
37
|
-
Miners String
|
|
38
|
-
ProtocolLabs {String:String}
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Chain
|
|
43
|
-
|
|
44
|
-
`TipSetKey` is the type for linking to the parent `BlockHeader`s. It is
|
|
45
|
-
important to note that its type hint, of referring to only `BlockHeader` blocks,
|
|
46
|
-
does not hold true at chain height **`0`** (CID
|
|
47
|
-
`bafy2bzacecnamqgqmifpluoeldx7zzglxcljo6oja4vrmtj7432rphldpdmm2`). This block
|
|
48
|
-
contains a single parent CID referring to the `Genesis` (above, CID
|
|
49
|
-
`bafyreiaqpwbbyjo4a42saasj36kkrpv4tsherf2e7bvezkert2a7dhonoi`).
|
|
50
|
-
|
|
51
|
-
```ipldsch
|
|
52
|
-
# The `ParentStateRoot` link will point either directly to `ActorsHAMT' for v0
|
|
53
|
-
# or `StateRoot` which links to `ActorsHAMT` for v2.
|
|
54
|
-
# See Lotus chain/state/LoadStateTree()
|
|
55
|
-
type StateRootLink &Any
|
|
56
|
-
|
|
57
|
-
# See note above about the single case where this type hint does not hold true.
|
|
58
|
-
type TipSetKey [&BlockHeader]
|
|
59
|
-
|
|
60
|
-
type BlockHeader struct {
|
|
61
|
-
Miner Address
|
|
62
|
-
Ticket nullable Ticket
|
|
63
|
-
ElectionProof nullable ElectionProof
|
|
64
|
-
BeaconEntries [BeaconEntry]
|
|
65
|
-
WinPoStProof [PoStProof]
|
|
66
|
-
Parents TipSetKey
|
|
67
|
-
ParentWeight Bytes
|
|
68
|
-
Height ChainEpoch
|
|
69
|
-
ParentStateRoot StateRootLink
|
|
70
|
-
ParentMessageReceipts &MessageReceiptAMT
|
|
71
|
-
Messages &TxMeta
|
|
72
|
-
BLSAggregate nullable Signature
|
|
73
|
-
Timestamp Int
|
|
74
|
-
BlockSig nullable Signature
|
|
75
|
-
ForkSignaling Int
|
|
76
|
-
ParentBaseFee TokenAmount
|
|
77
|
-
} representation tuple
|
|
78
|
-
|
|
79
|
-
type Ticket struct {
|
|
80
|
-
VRFProof Bytes
|
|
81
|
-
} representation tuple
|
|
82
|
-
|
|
83
|
-
type ElectionProof struct {
|
|
84
|
-
WinCount Int
|
|
85
|
-
VRFProof Bytes
|
|
86
|
-
} representation tuple
|
|
87
|
-
|
|
88
|
-
type BeaconEntry struct {
|
|
89
|
-
Round Int
|
|
90
|
-
Data Bytes
|
|
91
|
-
} representation tuple
|
|
92
|
-
|
|
93
|
-
type PoStProof struct {
|
|
94
|
-
PoStProof Int
|
|
95
|
-
ProofBytes Bytes
|
|
96
|
-
} representation tuple
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**AMT**: This is an ADL representing `type MessageReceiptList [MessageReceipt]`.
|
|
100
|
-
|
|
101
|
-
```ipldsch
|
|
102
|
-
type MessageReceiptAMT struct {
|
|
103
|
-
height Int
|
|
104
|
-
count Int
|
|
105
|
-
node MessageReceiptAMTNode
|
|
106
|
-
} representation tuple
|
|
107
|
-
|
|
108
|
-
# This can also be the root of a block
|
|
109
|
-
type MessageReceiptAMTNode struct {
|
|
110
|
-
bitmap Bytes
|
|
111
|
-
children [&MessageReceiptAMTNode]
|
|
112
|
-
values [&Message]
|
|
113
|
-
} representation tuple
|
|
114
|
-
|
|
115
|
-
type MessageReceipt struct {
|
|
116
|
-
ExitCode ExitCode
|
|
117
|
-
Return CborEncodedReturn
|
|
118
|
-
GasUsed Int
|
|
119
|
-
} representation tuple
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
```ipldsch
|
|
123
|
-
type StateRoot struct {
|
|
124
|
-
Version Int
|
|
125
|
-
Actors &ActorsHAMT
|
|
126
|
-
Info &StateInfo
|
|
127
|
-
} representation tuple
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Note that `StateInfo` is an [empty struct](https://github.com/filecoin-project/lotus/blob/f225b7b928de73e20dd8b8d4d075a56fbf3b8a25/chain/types/state.go#L26), which encodes as an empty CBOR array (`0x80`).
|
|
131
|
-
|
|
132
|
-
```ipldsch
|
|
133
|
-
type StateInfo struct {
|
|
134
|
-
} representation tuple
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Messages
|
|
138
|
-
|
|
139
|
-
See **[Filecoin Messages Data Structures](messages.md)** for details on the CBOR encoded message `Params` and message returns.
|
|
140
|
-
|
|
141
|
-
```ipldsch
|
|
142
|
-
type TxMeta struct {
|
|
143
|
-
BlsMessages &MessageLinkAMT
|
|
144
|
-
SecpkMessages &SignedMessageLinkAMT
|
|
145
|
-
} representation tuple
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
```ipldsch
|
|
149
|
-
type Message struct {
|
|
150
|
-
Version Int
|
|
151
|
-
To Address
|
|
152
|
-
From Address
|
|
153
|
-
Nonce Int
|
|
154
|
-
Value BigInt
|
|
155
|
-
GasLimit Int
|
|
156
|
-
GasFeeCap BigInt
|
|
157
|
-
GasPremium BigInt
|
|
158
|
-
Method MethodNum
|
|
159
|
-
Params CborEncodedParams
|
|
160
|
-
} representation tuple
|
|
161
|
-
|
|
162
|
-
type SignedMessage struct {
|
|
163
|
-
Message Message
|
|
164
|
-
Signature Signature
|
|
165
|
-
} representation tuple
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**AMT**: This is an ADL representing `type MessagesList [&Message]`.
|
|
169
|
-
|
|
170
|
-
```ipldsch
|
|
171
|
-
type MessageLinkAMT struct {
|
|
172
|
-
height Int
|
|
173
|
-
count Int
|
|
174
|
-
node MessageLinkAMTNode
|
|
175
|
-
} representation tuple
|
|
176
|
-
|
|
177
|
-
# This can also be the root of a block
|
|
178
|
-
type MessageLinkAMTNode struct {
|
|
179
|
-
bitmap Bytes
|
|
180
|
-
children [&MessageLinkAMTNode]
|
|
181
|
-
values [&Message]
|
|
182
|
-
} representation tuple
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
**AMT**: This is an ADL representing `type SignedMessagesList [&SignedMessage]`.
|
|
186
|
-
|
|
187
|
-
Note this is identical in layout to `MessagesList` and contains links at the leaves, but is listed here for completeness.
|
|
188
|
-
|
|
189
|
-
```ipldsch
|
|
190
|
-
type SignedMessageLinkAMT struct {
|
|
191
|
-
height Int
|
|
192
|
-
count Int
|
|
193
|
-
node SignedMessageLinkAMTNode
|
|
194
|
-
} representation tuple
|
|
195
|
-
|
|
196
|
-
# This can also be the root of a block
|
|
197
|
-
type SignedMessageLinkAMTNode struct {
|
|
198
|
-
bitmap Bytes
|
|
199
|
-
children [&SignedMessageLinkAMTNode]
|
|
200
|
-
values [&SignedMessage]
|
|
201
|
-
} representation tuple
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Actors
|
|
205
|
-
|
|
206
|
-
See **[Filecoin Actor State Data Structures](state.md)** for details on the Actor State objects that attach to the state tree `ActorsHAMT` as `ActorStateLink` and are differentiated by the type `Code` described below.
|
|
207
|
-
|
|
208
|
-
### Actor type linking
|
|
209
|
-
|
|
210
|
-
Actors are identified by a Code which is represented as a CID. The current form
|
|
211
|
-
uses a `raw` codec combined with an `identity` multihash to encode a set of
|
|
212
|
-
fixed strings uniquely representing the Actor type. Version 0 Actors use the
|
|
213
|
-
prefix `fil/1/` while version 2 Actors use the prefix `fil/2/`, followed by the
|
|
214
|
-
Actor name.
|
|
215
|
-
|
|
216
|
-
The `code` field in the `Actor` struct contains this CID and indicates the type
|
|
217
|
-
of block to be found when following the `head` link to load the specific Actor
|
|
218
|
-
state.
|
|
219
|
-
|
|
220
|
-
| Code string | Actor state type | CID | CID Bytes |
|
|
221
|
-
| --- | --- | --- | --- |
|
|
222
|
-
| `"fil/1/init"` | [`InitV0State`](#initv0state) | `bafkqactgnfwc6mjpnfxgs5a` | `0x0155000a66696c2f312f696e6974` |
|
|
223
|
-
| `"fil/2/init"` | [`InitV2State`](#initv2state) | `bafkqactgnfwc6mrpnfxgs5a` | `0x0155000a66696c2f322f696e6974` |
|
|
224
|
-
| `"fil/1/cron"` | [`CronV0State`](#cronv0state) | `bafkqactgnfwc6mjpmnzg63q` | `0x0155000a66696c2f312f63726f6e` |
|
|
225
|
-
| `"fil/2/cron"` | [`CronV2State`](#cronv2state) | `bafkqactgnfwc6mrpmnzg63q` | `0x0155000a66696c2f322f63726f6e` |
|
|
226
|
-
| `"fil/1/reward"` | [`RewardV0State`](#rewardv0state) | `bafkqaddgnfwc6mjpojsxoylsmq` | `0x0155000c66696c2f312f726577617264` |
|
|
227
|
-
| `"fil/2/reward"` | [`RewardV2State`](#rewardv2state) | `bafkqaddgnfwc6mrpojsxoylsmq` | `0x0155000c66696c2f322f726577617264` |
|
|
228
|
-
| `"fil/1/account"` | [`AccountV0State`](#accountv0state) | `bafkqadlgnfwc6mjpmfrwg33vnz2a` | `0x0155000d66696c2f312f6163636f756e74` |
|
|
229
|
-
| `"fil/2/account"` | [`AccountV2State`](#accountv2state) | `bafkqadlgnfwc6mrpmfrwg33vnz2a` | `0x0155000d66696c2f322f6163636f756e74` |
|
|
230
|
-
| `"fil/1/storagemarket"` | [`MarketV0State`](#marketv0state) | `bafkqae3gnfwc6mjpon2g64tbm5sw2ylsnnsxi` | `0x0155001366696c2f312f73746f726167656d61726b6574` |
|
|
231
|
-
| `"fil/2/storagemarket"` | [`MarketV2State`](#marketv2state) | `bafkqae3gnfwc6mrpon2g64tbm5sw2ylsnnsxi` | `0x0155001366696c2f322f73746f726167656d61726b6574` |
|
|
232
|
-
| `"fil/1/storageminer"` | [`MinerV0State`](#minerv0state) | `bafkqaetgnfwc6mjpon2g64tbm5sw22lomvza` | `0x0155001266696c2f312f73746f726167656d696e6572` |
|
|
233
|
-
| `"fil/2/storageminer"` | [`MinerV2State`](#minerv2state) | `bafkqaetgnfwc6mrpon2g64tbm5sw22lomvza` | `0x0155001266696c2f322f73746f726167656d696e6572` |
|
|
234
|
-
| `"fil/1/multisig"` | [`MultisigV0State`](#multisigv0state) | `bafkqadtgnfwc6mjpnv2wy5djonuwo` | `0x0155000e66696c2f312f6d756c7469736967` |
|
|
235
|
-
| `"fil/2/multisig"` | [`MultisigV2State`](#multisigv2state) | `bafkqadtgnfwc6mrpnv2wy5djonuwo` | `0x0155000e66696c2f322f6d756c7469736967` |
|
|
236
|
-
| `"fil/1/paymentchannel"` | [`PaychV0State`](#paychv0state) | `bafkqafdgnfwc6mjpobqxs3lfnz2gg2dbnzxgk3a` | `0x0155001466696c2f312f7061796d656e746368616e6e656c` |
|
|
237
|
-
| `"fil/2/paymentchannel"` | [`PaychV2State`](#paychv2state) | `bafkqafdgnfwc6mrpobqxs3lfnz2gg2dbnzxgk3a` | `0x0155001466696c2f322f7061796d656e746368616e6e656c` |
|
|
238
|
-
| `"fil/1/storagepower"` | [`PowerV0State`](#powerv0state) | `bafkqaetgnfwc6mjpon2g64tbm5sxa33xmvza` | `0x0155001266696c2f312f73746f72616765706f776572` |
|
|
239
|
-
| `"fil/2/storagepower"` | [`PowerV2State`](#powerv2state) | `bafkqaetgnfwc6mrpon2g64tbm5sxa33xmvza` | `0x0155001266696c2f322f73746f72616765706f776572` |
|
|
240
|
-
| `"fil/1/verifiedregistry"` | [`VerifregV0State`](#verifregv0state) | `bafkqaftgnfwc6mjpozsxe2lgnfswi4tfm5uxg5dspe` | `0x0155001666696c2f312f76657269666965647265676973747279` |
|
|
241
|
-
| `"fil/2/verifiedregistry"` | [`VerifregV2State`](#verifregv2state) | `bafkqaftgnfwc6mrpozsxe2lgnfswi4tfm5uxg5dspe` | `0x0155001666696c2f322f76657269666965647265676973747279` |
|
|
242
|
-
| `"fil/1/system"` | [`SystemV0State`](#systemv0state) | `bafkqaddgnfwc6mjpon4xg5dfnu` | `0x0155000c66696c2f312f73797374656d` |
|
|
243
|
-
| `"fil/2/system"` | [`SystemV2State`](#systemv2state) | `bafkqaddgnfwc6mrpon4xg5dfnu` | `0x0155000c66696c2f322f73797374656d` |
|
|
244
|
-
|
|
245
|
-
**HAMT**: This is an ADL representing `type ActorsMap {Address:Actors}`.
|
|
246
|
-
|
|
247
|
-
```ipldsch
|
|
248
|
-
# An inline CID encoded as raw+identity, see above
|
|
249
|
-
type ActorCode &Any
|
|
250
|
-
|
|
251
|
-
# An implicit union of each actor state types, keyed by the `ActorCode` (`code`)
|
|
252
|
-
# field and its variations listed above
|
|
253
|
-
type ActorStateLink &Any
|
|
254
|
-
|
|
255
|
-
type ActorsHAMT struct {
|
|
256
|
-
map Bytes
|
|
257
|
-
data [ ActorsHAMTElement ]
|
|
258
|
-
} representation tuple
|
|
259
|
-
|
|
260
|
-
type ActorsHAMTElement union {
|
|
261
|
-
| ActorsHAMTLink "0"
|
|
262
|
-
| ActorsHAMTBucket "1"
|
|
263
|
-
} representation keyed
|
|
264
|
-
|
|
265
|
-
type ActorsHAMTLink &ActorsHAMT
|
|
266
|
-
|
|
267
|
-
type ActorsHAMTBucket [ ActorsHAMTBucketEntry ]
|
|
268
|
-
|
|
269
|
-
type ActorsHAMTBucketEntry struct {
|
|
270
|
-
key Address
|
|
271
|
-
value Actor # inline
|
|
272
|
-
} representation tuple
|
|
273
|
-
|
|
274
|
-
type Actor struct {
|
|
275
|
-
code ActorCode
|
|
276
|
-
head ActorStateLink
|
|
277
|
-
nonce CallSeqNum
|
|
278
|
-
balance BigInt
|
|
279
|
-
} representation tuple
|
|
280
|
-
```
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log('See README.md for an index of documents available in this package')
|