This repository demonstrates using Chromia to store AI Agent short-term and long-term memories on chain. It also demonstrates a simple neural interface for interacting with the AI Agent.
- Install Docker
- Enable host networking on docker desktop
- Fetch Groq API key
- Generate key pair and lease a container
- Deploy the dapp & obtain the dapp brid
Note: Update the following docker images according to your system's architecture in the docker-compose.yml
:
# Bun service
bun:
image: kalpita888/bun:0.0.1 # For arm64 system use kalpita888/bun_arm64:0.0.1 and for amd64 system use kalpita888/bun:0.0.1
-
Update the variables in the
.env
file. -
Install dependencies and setup
docker-compose up --build
-
Navigate to http://localhost:6060 and start chatting!
-
Update the variables in the
.env
file. -
Uncomment the
# Production
section and comment out the# Local testing
section in thedocker-compose.yml
file. -
Build an enclave image
# for amd64 oyster-cvm build --platform amd64 --docker-compose ./docker-compose.yml --commit-ref 5826f66fa1a2dc60d1180465f440c4564f2291fe # for arm64 oyster-cvm build --platform arm64 --docker-compose ./docker-compose.yml --commit-ref 5826f66fa1a2dc60d1180465f440c4564f2291fe
You should now have a result folder with the enclave image in image.eif and the PCRs in pcr.json. The PCRs represent a "fingerprint" of the enclave image and will help you verify what is running in a given enclave.
-
Obtain an API key and secret from Pinata
-
Upload your enclave image to Pinata
# Note the image URL after it finishes PINATA_API_KEY=<API key> PINATA_API_SECRET=<API secret> oyster-cvm upload --file result/image.eif
Make a note of the image URL from the output.
-
Set up a wallet where you can export the private key. Deposit 0.001 ETH and 1 USDC to the wallet on the Arbitrum One network.
-
Build the init-params-manager. This encoder is expected to be used by users to encode their initialization parameters before deployment.
cd init-params-manager cargo build --release
-
Encode the
.env
file using the init-params-manager
cd ..
./init-params-manager/target/release/init-params-encoder --kms-endpoint http://v1.kms.box:1101 --pcr0 <pcr0> --pcr1 <pcr1> --pcr2 <pcr2> --init-params 'bun/.env:1:1:file:./.env'
Make a note of the base64 encoded data from the outpupt.
- Deploy the enclave image
# for amd64
# replace <key> with private key of the wallet
# replace <url> with url from the upload step
oyster-cvm deploy --wallet-private-key <key> --image-url <url> --instance-type c6a.2xlarge --region ap-south-1 --operator 0xe10Fa12f580e660Ecd593Ea4119ceBC90509D642 --duration-in-minutes 15 --init-params <base64 encoded init params>
# for arm64
# replace <key> with private key of the wallet
# replace <url> with url from the upload step
oyster-cvm deploy --wallet-private-key <key> --image-url <url> --instance-type c6g.2xlarge --region ap-south-1 --operator 0xe10Fa12f580e660Ecd593Ea4119ceBC90509D642 --duration-in-minutes 15 --init-params <base64 encoded init params>
Make a note of the IP from the output and navigate to http://IP:6060 and start chatting!
- Verify a remote attestation (recommended)
# Replace <ip> with the IP you obtained above
# Replace <pcrs> with values from pcr.json
oyster-cvm verify --enclave-ip <ip> -0 <pcr0> -1 <pcr1> -2 <pcr2>
You should see Verification successful
along with some attestation fields printed out.
- Head over to Oyster Confidential VM tutorials for more details.