An Oracle Network for sourcing and verifying data from restricted APIs on Move oriented blockchains.
The first Oracle supported is an Oracle for X (Twitter) data.
- Rooch Network
- Aptos
- Sui
See Rooch Network Doc for more information on local development, and testing instructions.
Contracts:
- Testnet:
0x9ce8eaf2166e9a6d4e8f1d27626297a0cf5ba1eaeb31137e08cc8f7773fb83f8
- Pre-mainnet:
0x9ce8eaf2166e9a6d4e8f1d27626297a0cf5ba1eaeb31137e08cc8f7773fb83f8
Oracles:
- X (Twitter):
0x694cbe655b126e9e6a997e86aaab39e538abf30a8c78669ce23a98740b47b65d
See Aptos Doc for more information on local development, and testing instructions.
Contracts:
- Testnet:
0xa2b7160c0dc70548e8105121b075df9ea3b98c0c82294207ca38cb1165b94f59
Oracles:
- X (Twitter):
0x6b516ae2eb4aac47ffadd502cf19ce842020f515f1abea3e154cfc053ab3ab9a
Before running the script, ensure you have the following prerequisites installed:
- Node.js: Alongside npm, yarn, or pnpm package managers.
npm install
# or
yarn install
# or
pnpm install
If you're not already running PostgreSQL locally, you can use Docker to set it up quickly. Follow these steps:
Ensure your .env
file contains the following PostgreSQL credentials:
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_DB=your_database
Replace your_username
, your_password
, and your_database
with your desired PostgreSQL username, password, and database name.
Use Docker Compose to start a PostgreSQL container. Create a docker-compose.yml
file with the following content:
version: '3.1'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
Run the following command to start the PostgreSQL container in detached mode:
docker-compose up -d
This will start a PostgreSQL instance accessible on port 5432 of your localhost, using the credentials specified in your .env
file.
This will update your database schema according to your models.
pnpm prisma:generate
pnpm prisma:deploy
Copy the example environment file to create your own .env
file:
cp .env.example .env
To support Rooch Network, export the Rooch Private Key:
rooch account export --address <Rooch Address>
To connect to the local Rooch node, set ROOCH_CHAIN_ID
to "localnet"
.
Otherwise, connect to testNet by setting ROOCH_CHAIN_ID
to "testnet"
, or to TestNet by setting ROOCH_CHAIN_ID
to "testnet"
.
Ensure that ROOCH_ORACLE_ADDRESS
is set to the address of the deployed module, e.g., "0x85859e45551846d9ab8651bb0b6f6e1740c9d758cfda05cfc39d49e2a604d783"
.
To support Aptos Network, set APTOS_PRIVATE_KEY
to your Aptos Wallet Private Key.
Start the development server for your application. This step might vary depending on your project setup; the command below assumes a typical setup.
npm run dev
# or
yarn dev
# or
pnpm dev
- User Endpoint:
https://api.x.com/2/users/
andhttps://api.x.com/2/tweets/
# Example: Get user followers count rooch move run --function 0x0d6144b074dd19a9ff581abd5bf7815a39222c8b3ac68ce5938c9d9723544e08::example_caller::request_data \ --sender-account default \ --args 'string:https://api.x.com/2/users/by/username/elonmusk?user.fields=public_metrics' \ --args 'string:GET' \ --args 'string:{}' \ --args 'string:{}' \ --args 'string:.data.public_metrics.followers_count' \ --args 'address:<orchestrator_address>' \ --args 'u256:50000000'
- Chat Completions:
https://api.openai.com/v1/chat/completions
# Example: Simple GPT request rooch move run --function 0x0d6144b074dd19a9ff581abd5bf7815a39222c8b3ac68ce5938c9d9723544e08::example_caller::request_data \ --sender-account default \ --args 'string:https://api.openai.com/v1/chat/completions' \ --args 'string:POST' \ --args 'string:{}' \ --args 'string:{ "model": "gpt-4", "messages": [{"role": "user", "content": "Say this is a test!"}], "temperature": 0.7 }' \ --args 'string:.choices[].message.content' \ --args 'address:<orchestrator_address>' \ --args 'u256:50000000'
Note: Replace <oracle_address>
and <orchestrator_address>
with your actual deployed addresses.