A blockchain indexer that works with the Augustium programming language. Built this to make it easier to index smart contracts and run machine learning models on-chain.
Basically, if you want to:
- Index blockchain data from multiple chains (Ethereum, Solana, etc.)
- Write smart contracts in Augustium (a language I've been working on)
- Run ML models directly in your contracts
- Query blockchain data easily
Then this might be useful for you.
Augustium Language Support
- Full compiler implementation (lexer, parser, AST)
- Compiles to WebAssembly for execution
- Built-in ML primitives (tensors, neural networks)
- Rust-like syntax with memory safety
Multi-Chain Indexing
- Works with Ethereum and Solana
- Real-time event streaming
- Structured data storage in PostgreSQL
- GraphQL and REST APIs for queries
Machine Learning
- Run neural networks in smart contracts
- On-chain training and inference
- Tensor operations and linear algebra
- Privacy-preserving ML with zero-knowledge proofs
- Node.js 18 or higher
- PostgreSQL 14+
- Rust 1.70+ (for WebAssembly compilation)
git clone https://github.com/AugustMoreau/AugustIndexer
cd AugustIndexer
npm installCopy the example environment file and edit it:
cp .env.example .env
# Edit .env with your database and RPC URLsStart the indexer:
npm startHere's what an Augustium contract looks like:
// hello_ml.aug
use stdlib::ml::{NeuralNetwork, MLDataset};
contract HelloML {
let mut model: NeuralNetwork;
let mut training_data: MLDataset;
let mut message: String;
fn constructor(initial_message: String) {
self.message = initial_message;
self.model = NeuralNetwork::new(vec![10, 5, 1]);
self.training_data = MLDataset::new();
}
pub fn get_message() -> String {
self.message.clone()
}
pub fn add_training_data(features: Vec<f64>, label: f64) {
self.training_data.add_sample(features, label);
}
pub fn train_model() {
self.model.train(&self.training_data, 100, 0.01);
}
pub fn predict(features: Vec<f64>) -> f64 {
self.model.predict(&features)
}
}Deploy it by sending the code to the /deploy endpoint:
curl -X POST http://localhost:3000/deploy \
-H "Content-Type: application/json" \
-d '{"code": "contract HelloML { ... }"}'You can also use Augustium to define indexers. For example, to index Uniswap pools:
struct Pool {
id: Address,
token0: Address,
token1: Address,
liquidity: U256,
}
index PoolIndex {
source: Ethereum(Mainnet),
contract: "UniswapV3Pool",
map: (event) => Pool {
id: event.poolAddress,
token0: event.token0,
token1: event.token1,
liquidity: event.liquidity
}
}
query TopPools(limit: 10) {
from: PoolIndex
order_by: liquidity desc
}GET /health- Check if the indexer is runningPOST /deploy- Deploy Augustium codePOST /query/:queryName- Execute a named queryPOST /graphql- GraphQL endpoint (coming soon)
The system has a few main parts:
- Chain Listeners - Connect to blockchain RPC endpoints and stream events
- Augustium Compiler - Compiles Augustium code to WebAssembly
- WASM Runtime - Executes compiled contracts safely
- Storage Layer - PostgreSQL for structured data
- Query Engine - GraphQL and REST APIs
Run tests:
npm testBuild:
npm run buildI wanted a language that:
- Has first-class ML support
- Compiles to WebAssembly for safety
- Works across different blockchains
- Is easy to write indexers in
Solidity is great for Ethereum, but it doesn't have ML primitives and can't run on other chains easily. Augustium tries to solve these problems.
This is still experimental. The language spec is evolving and there might be breaking changes. But the basic functionality works.
MIT - see LICENSE file