Member-only story
Pull Crypto Data from Ethereum with Web3.js: No APIs, Just Metamask
Cryptocurrency markets move fast, and having direct access to real-time price data from blockchain networks can unlock a world of possibilities for developers. I showed before some ways to retrieve historical crypto data using APIs, for example here:
However, APIs change and might become inaccessible, among other problems. Then, imagine you could retrieve crypto prices straight from a source deep inside a blockchain network, with no intermediaries, no servers, no API calls, just pure client-side code accessing directly data from a network from a web browser.
This article explores how to achieve exactly that by using Web3.js and MetaMask, tapping into Ethereum’s Mainnet via Chainlink’s decentralized oracles. We’ll cover:
- Why client-side Ethereum apps make sense
- Setting up Web3.js and MetaMask
- Finding Chainlink price feed contracts
- Fetching price data directly from Ethereum
- Adding notifications for price alerts