https://github.com/lorransutter/stock-oracle
Web app that retrieves stock data and write in a smart contract
https://github.com/lorransutter/stock-oracle
blockchain oracle reactjs smart-contracts solidity stocks truffle web3js
Last synced: 6 months ago
JSON representation
Web app that retrieves stock data and write in a smart contract
- Host: GitHub
- URL: https://github.com/lorransutter/stock-oracle
- Owner: LorranSutter
- Created: 2020-06-10T22:21:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-03T05:07:26.000Z (over 2 years ago)
- Last Synced: 2025-01-01T05:30:00.918Z (over 1 year ago)
- Topics: blockchain, oracle, reactjs, smart-contracts, solidity, stocks, truffle, web3js
- Language: JavaScript
- Homepage:
- Size: 4.17 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stock Oracle
Oracle implementation using Solidity, Truffle and API of stock market info presented as lab assingment for BCDV1011 - Design Patterns for Blockchain from Blockchain Development program from George Brown College.
## :runner: How to run
Open your terminal in the folder you want to clone the project
```sh
# Clone this repo
git clone https://github.com/LorranSutter/Stock-Oracle.git
# Go to the project folder
cd Stock-Oracle
# Install dependencies
yarn
```
Now you will need two opened terminals to run the project. One for truffle to simulate the EVM and another one for the frontend.
Truffle will run on http://127.0.0.1:9545/
Frontend will run on http://localhost:3000/
```sh
## In the first terminal ##
# Go to smart contract folder
cd src/StockSmartContract
# Init truffle
truffle develop
# Run migrations
migrate
```
The last command above will generate a new ABI and write contract address in a JSON file. You do not have to worry about importing these info in the frontend though. Also you may change the smart contract and run migrations again to see your changes.
```sh
## In the another terminal ##
# Go to frontend application
cd ..
# Run the project
yarn start
```
## :book: References
- [Alpha Vantage](https://www.alphavantage.co/) - stock API
- [Web3 calls](https://bitsofco.de/calling-smart-contract-functions-using-web3-js-call-vs-send/) - understanding web3.js calls
## :computer: Technologies
- [Solidity](https://solidity.readthedocs.io/) - smart contract programming language
- [Truffle](https://www.trufflesuite.com/) - dApp environment
- [React](https://reactjs.org/) - frontend library
- [Polaris](https://polaris.shopify.com/) - design system
- [Axios](https://www.npmjs.com/package/axios) - HTTP requests
- [Web3.js](https://web3js.readthedocs.io/) - interact with smart contracts