This school project is the blockchain part of a ticket manager for JO 2024. There is a bonus web application to show how to call your blockchain contract.
It's a good minimalist example of what can be done with solidity and web3js.
First you need to have some packages installed:
-
npm (needed for solidity dependencies)
-
yarn (optional if you want to use yarn instead of npm to install packages of app)
-
expo (needed to launch the app)
Ganache is needed to create a private blockchain. It allows you to deploy your contracts in a local environment.
Install it :
npm install ganache ganache-cli ganache-core --globalTruffle is needed to build your contracts and deploy them on any blockchain.
Install it :
npm install truffle --globalFirst, you need to launch a private blockchain locally.
ganache-clisomething like this is displayed :
Then, you can modify the file truffle-config.js with your own configurations.
Deploy your contract : (You don't need to build your contracts, this command do it for you)
truffle deploy --network [network_name]
# truffle deploy --network developmentthe network_name parameter is the name of your network in the truffle-config.js, in the networks section. (for example development)
You will get something like that :
contract address, keep it somewhere.
First, you need to get the built contract informations:
cp build/contracts/TicketFactory.json app/utils/TicketFactory.jsonModify the TicketFactoryAddress variable in the file app/App.js. (this value is the contract address given by the truffle command)
Go to app folder and install dependencies
cd app
expo install
# OR yarn install
# OR npm installStart the application
expo start
# OR yarn start
# OR npm startYou can now go to your application at the url given by expo

