I made a project called "tick3ts" where you can save events and buy tickets. It involves:
- Solidity smart contract
- Backend
- React Frontend
The code is placed here contract. I created the project using hardhat and there're some command available:
npx hardhat node
: it starts a local nodenpx hardhat compile
: it compiles the contract contract/contracts/Events.solnpx hardhat test
: it runs the tests contract/test/Events.jsnpx hardhat run scripts/bootstrap.js --network localhost
: it deploys the contract in the local node (you have to start it first) and the create some events. The script is contract/scripts/bootstrap.js
Saving data to the blockchain is very expensive so I'm using a backend service to store metadata such as images, description, tags, etc. This backend is mocked using json-server
json-server --watch db.json --port 3001
The front-end is placed in tick3ts was made using React, chakra-ui and wagmi (hooks based on ethers.js)
To run the project set the environment variables CONTRACT_ADDRESS
and CHAIN_ID
and then run npm run start
Use a wallet with the localhost network (it requires the chainId 31337)
Run the command docker-compouse up
. Then open the url "http://localhost:300" in your browser.
- Open contract and run
npx hardhat node
- In a new terminal run
npx hardhat compile
andnpx hardhat run scripts/bootstrap.js --network localhost
- Open backend and run
json-server --watch db.json --port 3001
- Open frontend and run
npm run start