The Decentralized Oracle Network (DON) is designed to provide secure, reliable, and tamper-proof data feeds for smart contracts on Ethereum and other blockchains. By leveraging EigenLayer's restaking capabilities and Movement Labs' SDK, DON enhances security and facilitates seamless integration across different blockchain ecosystems.
DON ensures data accuracy through distributed validation, aggregates data using consensus mechanisms, and secures the network through restaking mechanisms and slashing conditions for validators. This multi-layered approach guarantees the integrity and reliability of the oracle network.
- Validators verify data from multiple sources to ensure accuracy.
- Consensus mechanisms finalize validated data for use in smart contracts.
- Validators restake tokens to participate in the network, enhancing overall security.
- Slashing conditions deter malicious or faulty validators, maintaining network integrity.
- Utilizes Movement Labs' SDK for seamless integration with Ethereum and Layer 2 solutions.
- Provides diverse data feeds including price feeds, weather data, sports scores, and more.
- Secure APIs for developers to access data feeds for smart contract applications.
- Manages data submission, validation, aggregation, and distribution.
- Implements restaking contracts for managing validator stakes and slashing conditions.
- Collects data from multiple sources.
- Validates data through the oracle network.
- Submits verified data to smart contracts.
- Coordinates validators and implements consensus mechanisms.
- User-friendly interface for accessing data feeds.
- Validator tools for managing stakes and participation in data validation.
- Developer tools for integration with the oracle network.
Follow these steps to set up and run the Decentralized Oracle Network (DON) project locally:
- Node.js (v14 or later)
- npm (v6 or later)
- Git
- Ethereum wallet (e.g., MetaMask)
- Access to an Ethereum node (e.g., Infura endpoint)
-
Clone the repository:
git clone https://github.com/your-username/decentralized-oracle-network.git cd decentralized-oracle-network
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:ETHEREUM_RPC_URL=your_ethereum_node_url PRIVATE_KEY=your_ethereum_wallet_private_key
-
Compile smart contracts:
npm run compile
-
Deploy smart contracts:
npm run deploy
-
Start the backend service:
npm run start:backend
-
In a new terminal, start the frontend application:
npm run start:frontend
The application should now be running on http://localhost:3000
.
Here are some examples of how to use the Decentralized Oracle Network in various scenarios:
To fetch data from the DON in your smart contract:
pragma solidity ^0.8.0;
import "@don/contracts/interfaces/IDONConsumer.sol";
contract MyContract is IDONConsumer {
address private donAddress;
constructor(address _donAddress) {
donAddress = _donAddress;
}
function requestData(string memory dataType) external {
IDON(donAddress).requestData(dataType);
}
function fulfillData(uint256 requestId, bytes memory result) external override {
// Handle the received data
// This function will be called by the DON when data is ready
}
}
To participate as a validator:
-
Stake tokens:
const don = await DON.at(donAddress); await don.stake(web3.utils.toWei('1000', 'ether'));
-
Run the validator node:
npm run validator -- --key your_validator_key
In your frontend application:
import { DONProvider, useDONData } from '@don/react-sdk';
function PriceFeed() {
const { data, loading, error } = useDONData('ETH/USD');
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return <p>ETH Price: ${data.price}</p>;
}
function App() {
return (
<DONProvider network="mainnet">
<PriceFeed />
</DONProvider>
);
}
To submit a new data source for consideration:
const don = await DON.at(donAddress);
await don.proposeDataSource('New Weather API', 'https://api.weather.com', 'hourly');
Visit the developer portal at http://localhost:3000/dev
to:
- Generate API keys
- View documentation
- Test API endpoints
- Monitor network statistics
Remember to always use the latest version of the DON SDK and refer to the official documentation for the most up-to-date usage instructions and best practices.
We welcome contributions to the Decentralized Oracle Network project. Please read our contributing guidelines before submitting pull requests.
For questions and support, please contact (provide contact information or links to community channels).
This project is part of the ongoing efforts to improve blockchain interoperability and data reliability in the Web3 ecosystem.