To get started, clone the repository containing all the necessary files:
# Clone locally
git clone --recurse-submodules <https://github.com/ritual-net/infernet-container-starter>
# Navigate to the repository
cd infernet-container-starter
hello-world
ContainerOnce inside the repository directory, you can deploy the hello-world
container by running the following command. This will bootstrap the rest of the Infernet Node stack.
make deploy-container project=hello-world
To check if your containers are running, open a new terminal session and run:
docker ps
You should see multiple containers running, including hello-world
, infernet-node
, and others. Here's an example output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ed7ec08617aa ritualnetwork/hello-world-infernet:latest "gunicorn app:create…" 3 minutes ago Up 3 minutes 0.0.0.0:3000->3000/tcp hello-world
22be7ee424f1 ritualnetwork/infernet-node:1.0.0 "/app/entrypoint.sh" 3 minutes ago Up 3 minutes 0.0.0.0:4000->4000/tcp infernet-node
Now that the containers are running, we can create an off-chain compute job using the Infernet Node's REST API. Here's how to submit a job to the hello-world
container with some input data:
curl -X POST "<http://127.0.0.1:4000/api/jobs>" \\
-H "Content-Type: application/json" \\
-d '{"containers": ["hello-world"], "data": {"some": "input"}}'
If successful, the Infernet Node will return a job ID:
{"id":"e45b5ebc-c71e-4ab8-b10f-d1202e7fb16e"}
To monitor the job’s progress and retrieve the result, use the following command:
curl -X GET "<http://127.0.0.1:4000/api/jobs?id=e45b5ebc-c71e-4ab8-b10f-d1202e7fb16e>"
The response will show the job’s result: