Getting Started¶
1. Start the network¶
cd src/dns
deploy/scripts/up.sh
The script builds the images, starts an identity network, a relay, a DHT, an Iroh relay, a name server, a ledger and three agents. It then enrolls the agents, gives them names and funds their accounts. Use SKIP_BUILD=1 later to start without building.
| Agent | Name | Address |
|---|---|---|
| a | alice@platform.test:8080 |
http://127.0.0.1:7500 |
| b | finance-bot@platform.test:8080 |
http://127.0.0.1:7501 |
| c | carol@platform.test:8080 |
http://127.0.0.1:7502 |
2. Resolve a name¶
. deploy/.state/secrets.env
curl -s -X POST http://127.0.0.1:7500/v1/resolve -H "Authorization: Bearer $API_TOKEN_A" \
-H "Content-Type: application/json" -d '{"name": "finance-bot@platform.test:8080"}'
The answer contains the verified identifier, the network keys and the services.
3. Call the agent¶
curl -s -X POST http://127.0.0.1:7500/v1/call -H "Authorization: Bearer $API_TOKEN_A" \
-H "Content-Type: application/json" \
-d '{"name": "finance-bot@platform.test:8080", "route": "/echo", "args": {"hello": "world"}}'
{"aid": "E...", "path": "direct", "value": {"echo": {"hello": "world"}, "sender": "E..."}}
4. Pay for a service¶
curl -s -X POST http://127.0.0.1:7500/v1/call -H "Authorization: Bearer $API_TOKEN_A" \
-H "Content-Type: application/json" \
-d '{"name": "finance-bot@platform.test:8080", "route": "/compute/add", "args": {"a": 2, "b": 40}, "max_price": 5}'
The answer has a payment with "settled": true.
5. Use the page¶
Open http://127.0.0.1:7500 and enter the token of agent a, API_TOKEN_A.
6. Stop¶
deploy/scripts/down.sh