Coder Social home page Coder Social logo

reloadaxe / blockchain-jo2024 Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 484 KB

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.

JavaScript 69.32% Solidity 30.68%

blockchain-jo2024's Introduction

Blockchain JO 2024

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.

Prerequisites

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)

Blockchain packages installation

Ganache (development)

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 --global

Truffle

Truffle is needed to build your contracts and deploy them on any blockchain.

Install it :

npm install truffle --global

Usage

Private blockchain deployment

First, you need to launch a private blockchain locally.

ganache-cli

something like this is displayed :

ganache-cli display

⚠️ don't stop the command or close this terminal. Open a new one for other commands.

Contracts build and deployment

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 development

the 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 :

truffle deploy display

⚠️ you can see the contract address, keep it somewhere.

Web application deployment

First, you need to get the built contract informations:

cp build/contracts/TicketFactory.json app/utils/TicketFactory.json

Modify 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 install

Start the application

expo start
# OR yarn start
# OR npm start

You can now go to your application at the url given by expo

blockchain-jo2024's People

Contributors

reloadaxe avatar

Stargazers

 avatar Flavien Berwick avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.