Get real-time cryptocurrency prices with zero-knowledge proofs on the Mina blockchain.
Doot provides verified price data for 10 major cryptocurrencies using zero-knowledge proofs. Your app gets fast, reliable prices with automatic fallback across multiple sources.
npm install @dootfoundation/client
import { Client } from '@dootfoundation/client';
const client = new Client('your-api-key');
const price = await client.getData('bitcoin');
console.log(`Bitcoin: $${price.price_data.price}`);
When using in zkApp-CLI projects, you may need to add @ts-ignore
for TypeScript compilation:
import dotenv from 'dotenv';
dotenv.config();
// @ts-ignore
import { Client } from '@dootfoundation/client';
const client = new Client(process.env.DOOT_API_KEY);
const price = await client.getData('bitcoin');
This is only a TypeScript compilation issue - the package works perfectly at runtime in zkApp-CLI environments.
bitcoin
- Bitcoin (BTC)ethereum
- Ethereum (ETH)mina
- Mina Protocol (MINA)solana
- Solana (SOL)chainlink
- Chainlink (LINK)ripple
- XRP (XRP)dogecoin
- Dogecoin (DOGE)polygon
- Polygon (MATIC)avalanche
- Avalanche (AVAX)cardano
- Cardano (ADA)
Doot uses a 3-layer fallback system:
- API (fastest, ~100ms) - Direct from Doot servers
- L2 (fast, ~10-30s) - Zeko Layer 2 blockchain
- L1 (secure, ~30-60s) - Mina mainnet blockchain
If one source fails, it automatically tries the next one.
Smart fallback through all sources (recommended)
const price = await client.getData('ethereum');
Get price directly from API (requires valid key)
const price = await client.getFromAPI('bitcoin');
Get price from Zeko L2 blockchain
const price = await client.getFromL2('solana');
Get price from Mina L1 blockchain
const price = await client.getFromL1('mina');
Check if your API key works
const valid = await client.isKeyValid();
List of supported tokens
import { validtokens } from '@dootfoundation/client';
console.log(validtokens); // ['bitcoin', 'ethereum', ...]
All methods return the same format:
{
source: 'API', // Which source provided the data
fromAPI: true, // Boolean flags for source
fromL2: false,
fromL1: false,
price_data: {
token: 'bitcoin',
price: '65432.12', // Price as string
decimals: '10', // Decimal places
aggregationTimestamp: '1640995200000',
signature: 'ABC123...', // ZK proof signature
oracle: 'B62q...' // Oracle public key
},
proof_data: '{...}' // Zero-knowledge proof data
}
- Visit doot.foundation/dashboard
- Sign up for a free account
- Generate your API key
- Start building!
import { Client } from '@dootfoundation/client';
const client = new Client('your-api-key');
// Get Bitcoin price with fallback
const btc = await client.getData('bitcoin');
console.log(`BTC: $${btc.price_data.price}`);
// Get multiple prices
const tokens = ['bitcoin', 'ethereum', 'solana'];
for (const token of tokens) {
const price = await client.getData(token);
console.log(`${token}: $${price.price_data.price}`);
}
import { Client } from '@dootfoundation/client';
const client = new Client(process.env.DOOT_API_KEY);
async function checkPrices() {
try {
const eth = await client.getData('ethereum');
const btc = await client.getData('bitcoin');
const ethPrice = parseFloat(eth.price_data.price);
const btcPrice = parseFloat(btc.price_data.price);
console.log(`ETH/BTC ratio: ${(ethPrice / btcPrice).toFixed(4)}`);
} catch (error) {
console.error('Price fetch failed:', error.message);
}
}
setInterval(checkPrices, 60000); // Check every minute
# .env file
DOOT_API_KEY=your-api-key-here
import dotenv from 'dotenv';
dotenv.config();
const client = new Client(process.env.DOOT_API_KEY);
try {
const price = await client.getData('bitcoin');
console.log('Success:', price);
} catch (error) {
if (error.message.includes('Invalid token')) {
console.log('Token not supported');
} else if (error.message.includes('401')) {
console.log('Invalid API key');
} else {
console.log('Network or service error');
}
}
- Node.js 18+
- Internet connection
- API key for fastest access (free at doot.foundation)
This package works in any Node.js environment. No special blockchain setup needed - just install and use!
- Documentation: docs.doot.foundation
- Issues: GitHub Issues
- Website: doot.foundation
ISC License - see LICENSE.md file for details.