|
| 1 | +--- |
| 2 | +description: >- |
| 3 | + This guide walks you through using the PDP client tool (pdptool) to interact |
| 4 | + with a Filecoin Storage Provider running the Proof of Data Possession (PDP) |
| 5 | + service. |
| 6 | +--- |
| 7 | + |
| 8 | +# Use PDP |
| 9 | + |
| 10 | +PDP ensures that your data is verifiably stored by a Filecoin Storage Provider using cryptographic proofs without needing to retrieve the file itself. |
| 11 | + |
| 12 | +### Prerequisites |
| 13 | + |
| 14 | +Before beginning, ensure: |
| 15 | + |
| 16 | +* You have access to a terminal with internet connectivity |
| 17 | +* Your system has pdptool installed (bundled with Curio) |
| 18 | + |
| 19 | +### If pdptool is not installed: |
| 20 | + |
| 21 | +* **Option 1**: Clone Curio and build pdptool: |
| 22 | + |
| 23 | +```sh |
| 24 | +git clone |
| 25 | +https://github.com/filecoin-project/curio.git |
| 26 | + |
| 27 | +cd curio |
| 28 | +cd cmd/pdptool |
| 29 | +go build . |
| 30 | +``` |
| 31 | + |
| 32 | +* **Option 2**: Install the [Docker version ](https://github.com/LesnyRumcajs/pdp)of pdptool - Provided by our friends at [ChainSafe](https://chainsafe.io/) |
| 33 | + |
| 34 | +*** |
| 35 | + |
| 36 | +### Authenticate Your Client (JWT Token) |
| 37 | + |
| 38 | +You first need to authenticate your pdptool with a PDP-enabled Storage Provider |
| 39 | + |
| 40 | +Generate a service secret: |
| 41 | + |
| 42 | +```sh |
| 43 | +./pdptool create-service-secret |
| 44 | +``` |
| 45 | + |
| 46 | +```sh |
| 47 | +# Example output: |
| 48 | + |
| 49 | +-----BEGIN PUBLIC KEY----- |
| 50 | +LxP9MzVmHdC7KwYBvNAo1jXuIRfGXqQyo2JzE4Uctn0a5eFZbs6Wlvq3dKYgphTD |
| 51 | +XAqRsm38LPt2iVcGb9MruZJxEkBhO71wDdNyaFMoXpCJnUqRAezvKlfbIg== |
| 52 | +-----END PUBLIC KEY----- |
| 53 | +``` |
| 54 | + |
| 55 | +{% hint style="success" %} |
| 56 | +Reach out in the [#fil-pdp](https://filecoinproject.slack.com/archives/C0717TGU7V2) channel in Filecoin Slack to register your public key with a PDP-enabled Storage Provider |
| 57 | +{% endhint %} |
| 58 | + |
| 59 | +*** |
| 60 | + |
| 61 | +### Connect to a PDP Service |
| 62 | + |
| 63 | +Start by pinging the PDP service to confirm availability: |
| 64 | + |
| 65 | +```sh |
| 66 | +./pdptool ping --service-url https://yablu.net --service-name pdp-service |
| 67 | +``` |
| 68 | + |
| 69 | +{% hint style="success" %} |
| 70 | +You should see something like: |
| 71 | +{% endhint %} |
| 72 | + |
| 73 | +```sh |
| 74 | +Ping successful: Service is reachable and JWT token is valid. |
| 75 | +``` |
| 76 | + |
| 77 | +*** |
| 78 | + |
| 79 | +### Create a Proof Set |
| 80 | + |
| 81 | +Start by creating an empty proof set. This step must happen **before** uploading files: |
| 82 | + |
| 83 | +```sh |
| 84 | +./pdptool create-proof-set \ |
| 85 | + --service-url https://yablu.net \ |
| 86 | + --service-name pdp-service \ |
| 87 | + --recordkeeper 0x6170dE2b09b404776197485F3dc6c968Ef948505 |
| 88 | +``` |
| 89 | + |
| 90 | +```sh |
| 91 | +# Example output: |
| 92 | + |
| 93 | +Proof set creation initiated successfully. |
| 94 | +Location: /pdp/proof-sets/created/0xf91617ef532748efb5a51e64391112e5328fbd9a5b9ac20e5127981cea0012a5 |
| 95 | +Response: |
| 96 | +``` |
| 97 | + |
| 98 | +Use the `0x` transaction hash from the previous output to monitor proof set creation status: |
| 99 | + |
| 100 | +```sh |
| 101 | +./pdptool get-proof-set-create-status \ |
| 102 | + --service-url https://yablu.net \ |
| 103 | + --service-name pdp-service \ |
| 104 | + --tx-hash 0xf91617ef532748efb5a51e64391112e5328fbd9a5b9ac20e5127981cea0012a5 |
| 105 | +``` |
| 106 | + |
| 107 | +{% hint style="success" %} |
| 108 | +You should see something like: |
| 109 | +{% endhint %} |
| 110 | + |
| 111 | +```sh |
| 112 | +Proof Set Creation Status: |
| 113 | +Transaction Hash: 0xf91617ef532748efb5a51e64391112e5328fbd9a5b9ac20e5127981cea0012a5 |
| 114 | +Transaction Status: confirmed |
| 115 | +Transaction Successful: true |
| 116 | +Proofset Created: true |
| 117 | +ProofSet ID: 43 |
| 118 | +``` |
| 119 | + |
| 120 | +{% hint style="info" %} |
| 121 | +The proof set creation process can take a few seconds to complete |
| 122 | +{% endhint %} |
| 123 | + |
| 124 | +*** |
| 125 | + |
| 126 | +### Upload Files to the Storage Provider |
| 127 | + |
| 128 | +Once your proof set is ready, you can begin uploading files: |
| 129 | + |
| 130 | +```sh |
| 131 | +./pdptool upload-file --service-url https://yablu.net --service-name pdp-service /path/to/file.ext |
| 132 | +``` |
| 133 | + |
| 134 | +{% hint style="success" %} |
| 135 | +Example output: |
| 136 | +{% endhint %} |
| 137 | + |
| 138 | +```sh |
| 139 | +0: pieceSize: 65536 |
| 140 | +baga6ea4seaqhsevhssmv3j7jjavm4gzdckpjrvbwhhvn73sgibob5bdvtzoqkli:baga6ea4seaqhsevhssmv3j7jjavm4gzdckpjrvbwhhvn73sgibob5bdvtzoqkli |
| 141 | +``` |
| 142 | + |
| 143 | +*** |
| 144 | + |
| 145 | +### 🌳 Add File Roots to Proof Set |
| 146 | + |
| 147 | +After uploading each file, extract its CID and add it to your proof set: |
| 148 | + |
| 149 | +```sh |
| 150 | +./pdptool add-roots \ |
| 151 | + --service-url https://yablu.net \ |
| 152 | + --service-name pdp-service \ |
| 153 | + --proof-set-id <PROOF-SET-ID> \ |
| 154 | + --root <CID1>+<CID2>+<CID3>... |
| 155 | +``` |
| 156 | + |
| 157 | +Example using the information returned in the previous steps: |
| 158 | + |
| 159 | +```sh |
| 160 | +./pdptool add-roots \ |
| 161 | + --service-url https://yablu.net \ |
| 162 | + --service-name pdp-service \ |
| 163 | + --proof-set-id 43 \ |
| 164 | + --root baga6ea4seaqhsevhssmv3j7jjavm4gzdckpjrvbwhhvn73sgibob5bdvtzoqkli:baga6ea4seaqhsevhssmv3j7jjavm4gzdckpjrvbwhhvn73sgibob5bdvtzoqkli |
| 165 | +``` |
| 166 | + |
| 167 | +{% hint style="info" %} |
| 168 | +In the above example, `--proof-set-id` came from the [Create Proof Set](use-pdp.md#create-a-proof-set) step, and `--root` from the [Upload Files to the Storage Provider](use-pdp.md#upload-files-to-the-storage-provider) step. |
| 169 | +{% endhint %} |
| 170 | + |
| 171 | +{% hint style="success" %} |
| 172 | +Example output: |
| 173 | +{% endhint %} |
| 174 | + |
| 175 | +```sh |
| 176 | +Roots added to proof set ID 43 successfully. |
| 177 | +Response: |
| 178 | +``` |
| 179 | + |
| 180 | +*** |
| 181 | + |
| 182 | +### View a Piece or Proof Set |
| 183 | + |
| 184 | +You can retrieve a proof set or inspect a file root directly: |
| 185 | + |
| 186 | +```sh |
| 187 | +./pdptool get-proof-set \ |
| 188 | + --service-url https://yablu.net \ |
| 189 | + --service-name pdp-service 43 |
| 190 | +``` |
| 191 | + |
| 192 | +{% hint style="success" %} |
| 193 | +Example output: |
| 194 | +{% endhint %} |
| 195 | + |
| 196 | +```sh |
| 197 | +Proof Set ID: 43 |
| 198 | +Next Challenge Epoch: 2577608 |
| 199 | +Roots: |
| 200 | + - Root ID: 0 |
| 201 | + Root CID: baga6ea4seaqhsevhssmv3j7jjavm4gzdckpjrvbwhhvn73sgibob5bdvtzoqkli |
| 202 | + Subroot CID: baga6ea4seaqhsevhssmv3j7jjavm4gzdckpjrvbwhhvn73sgibob5bdvtzoqkli |
| 203 | + Subroot Offset: 0 |
| 204 | +``` |
| 205 | + |
| 206 | +*** |
| 207 | + |
| 208 | +### Retrieve From a Proof Set |
| 209 | + |
| 210 | +Download a file using an ordered chunks list: |
| 211 | + |
| 212 | +```sh |
| 213 | +./pdptool download-file \ |
| 214 | + --service-url https://yablu.net \ |
| 215 | + --chunk-file chunks.list \ |
| 216 | + --output-file file.ext |
| 217 | +``` |
| 218 | + |
| 219 | +{% hint style="info" %} |
| 220 | +💡In the above example, `–chunk-file` and `–output-file` flags were defined in the [Upload Files to the Storage Provider step](use-pdp.md#upload-files-to-the-storage-provider) |
| 221 | +{% endhint %} |
| 222 | + |
| 223 | +*** |
| 224 | + |
| 225 | +### You’re Done! |
| 226 | + |
| 227 | +You’ve now: |
| 228 | + |
| 229 | +✅ Connected to a PDP-enabled storage provider\ |
| 230 | +✅ Created a proof set\ |
| 231 | +✅ Uploaded files and added file roots\ |
| 232 | +✅ Verified availability and proof status |
| 233 | + |
| 234 | +🧭 Next: Track your proof sets in the PDP Explorer |
| 235 | + |
| 236 | +* [Calibration PDP Explorer](https://calibration.pdp-explorer.eng.filoz.org) |
| 237 | +* [Mainnet PDP Explorer](https://pdp-explorer.eng.filoz.org)  |
| 238 | + |
| 239 | +💬 Questions? Join the conversation on Filecoin Slack: [#fil-pdp](https://filecoinproject.slack.com/archives/C0717TGU7V2) |
0 commit comments