This commit is contained in:
benbierens 2024-07-08 10:54:32 +02:00
commit 48d96c49cc
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
2 changed files with 24 additions and 18 deletions

View File

@ -17,7 +17,8 @@ This document will show you several useful API calls.
An easy way to check that your node is up and running is: An easy way to check that your node is up and running is:
```shell ```shell
curl http://localhost:8080/api/codex/v1/debug/info curl http://localhost:8080/api/codex/v1/debug/info \
--write-out '\n'
``` ```
This will return a JSON structure with plenty of information about your local node. It contains peer information that may be useful when troubleshooting connection issues. This will return a JSON structure with plenty of information about your local node. It contains peer information that may be useful when troubleshooting connection issues.
@ -29,8 +30,9 @@ Once you upload a file to Codex, other nodes in the testnet can download it. Ple
```shell ```shell
curl --request POST \ curl --request POST \
--url http://localhost:8080/api/codex/v1/data \ http://localhost:8080/api/codex/v1/data \
--header 'Content-Type: application/octet-stream' \ --header 'Content-Type: application/json' \
--write-out '\n' \
-T <FILE> -T <FILE>
``` ```
@ -57,7 +59,8 @@ Note that Codex does not store content-type or extension information. If you get
You can view which datasets are currently being stored by your node. You can view which datasets are currently being stored by your node.
```shell ```shell
curl http://localhost:8080/api/codex/v1/data curl http://localhost:8080/api/codex/v1/data \
--write-out '\n'
``` ```
## Create storage availability ## Create storage availability
@ -69,8 +72,9 @@ In order to start selling storage space to the network, you must configure your
```shell ```shell
curl --request POST \ curl --request POST \
--url http://localhost:8080/api/codex/v1/sales/availability \ http://localhost:8080/api/codex/v1/sales/availability \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--write-out '\n' \
--data '{ --data '{
"totalSize": "8000000", "totalSize": "8000000",
"duration": "7200", "duration": "7200",
@ -83,29 +87,30 @@ For descriptions of each parameter, please view the [Spec](https://github.com/co
## Purchase storage ## Purchase storage
To purchase storag space from the network, first you must upload your data. Once you have the CID, use the following to create a request-for-storage. To purchase storage space from the network, first you must upload your data. Once you have the CID, use the following to create a request-for-storage.
Set your CID: Set your CID:
```shell ```shell
CID="..." # paste your CID from the previous step here between the quotes CID="..." # paste your CID from the previous step here between the quotes
echo CID: $CID echo "CID: ${CID}"
``` ```
Next you can run: Next you can run:
```shell ```shell
curl --request POST \ curl --request POST \
--url http://localhost:8080/api/codex/v1/storage/request/$CID \ "http://localhost:8080/api/codex/v1/storage/request/${CID}" \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data '{ --write-out '\n' \
"duration": "3600", --data '{
"reward": "1", "duration": "3600",
"proofProbability": "5", "reward": "1",
"expiry": "600", "proofProbability": "5",
"nodes": 5, "expiry": "600",
"tolerance": 2, "nodes": 5,
"collateral": "1" "tolerance": 2,
"collateral": "1"
}' }'
``` ```
@ -124,7 +129,8 @@ PURCHASE_ID="..."
Then: Then:
```shell ```shell
curl "http://localhost:8080/api/codex/v1/storage/purchases/${PURCHASE_ID}" curl "http://localhost:8080/api/codex/v1/storage/purchases/${PURCHASE_ID}" \
--write-out '\n'
``` ```
This will display state and error information for your purchase. This will display state and error information for your purchase.

0
scripts/download_online.sh Normal file → Executable file
View File