This project allows users to fetch and display the latest cryptocurrency prices (ETH, BTC, etc.) using Chainlink price oracles and a Solidity smart contract. It provides a simple web interface to display real-time prices of various crypto assets. While there are other simpler and more straightforward approaches to fetching cryptocurrency prices—such as using centralized APIs. The main reason for this decision was to explore and test Chainlink’s decentralized oracle network. By using Chainlink, we could ensure the accuracy, security, and decentralization of price data, which is crucial for building trust in smart contracts. Additionally, this provided an opportunity to integrate and experiment with Chainlink’s technology, even though simpler alternatives might have sufficed for the specific use case of fetching crypto asset prices.
This project consists of:
- Solidity smart contract: Fetches real-time prices for different cryptocurrencies using Chainlink oracles.
- Frontend: Displays the prices using HTML and JavaScript, connected to the smart contract via Web3.js.
- Solidity: Used for smart contract development.
- Chainlink Oracles: Fetches real-time price data (ETH/USD, BTC/USD, etc.).
- HTML/CSS: For the frontend interface.
- JavaScript (Web3.js): To interact with the Ethereum blockchain and the deployed smart contract.
- Fetch the latest prices of ETH, BTC, and LINK from Chainlink oracles.
- The Solidity contract ensures prices are fetched securely from decentralized price feeds.
- Web frontend displays live prices to users.
- Compile and deploy the contract using Foundry.
- Use the script
DeployCryptoPriceOracle.sol
for deploying the contract to a testnet like Sepolia.
- Replace the
contractAddress
andabi
inindex.html
with your contract's address and ABI. - Open the HTML file in a browser that supports Web3 (e.g., with MetaMask).
- Add More Assets: Add more tokens like Dogecoin, Litecoin, etc., using additional Chainlink price feeds.
- Styling: Improve the frontend design using frameworks like Bootstrap or TailwindCSS.
This project demonstrates how to create a basic decentralized crypto price tracker using Chainlink oracles and Solidity. It also highlights how to fetch real-time price data and display it on a web interface using Web3.js.