Team Members : Killian Vervelle
This project merges blockchain technology, specifically Hyperledger Fabric and Fabric Token SDK, with Spring Boot, React, and MySQL. The application offers users the opportunity to seamlessly exchange their local currency for gold-backed tokens and conduct international settlements. By leveraging the transparency and security of blockchain, users can trust in the integrity of their transactions while benefiting from the stability of gold-backed assets. With a modular architecture encompassing frontend, backend, blockchain, and database layers, the application ensures a user-friendly experience while providing a reliable platform for currency trading and settlements.
The Dashboard component displays user-related statistics and visualizations based on transaction data, account balances, gold prices, and exchange rates.
The RequestHandler component facilitates interactions with the blockchain. Depending on the user's role, they can perform various actions, including submitting issuance requests, transferring and redeeming tokens, or issuing tokens to customers.
Prerequisites:
- Node.js: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- npm: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
cd frontend
# Install the necessary dependencies for the project
npm install
# Run the frontend
npm start
Prerequisites:
- MySQL: https://dev.mysql.com/downloads/installer/
- MySQL workbench: https://dev.mysql.com/downloads/workbench/
- docker v26.1.1: https://docs.docker.com/get-docker/
cd my-sql
# Build the docker image
docker build -t my-mysql .
# Run the docker container
docker run --name my-mysql-container -p 3307:3306 -e MYSQL_ROOT_PASSWORD=rootpassword -e MYSQL_DATABASE=users -d my-mysql
Open MySQL workbench and create a new connection:
- Go to the
Database menu
->Manage Connections
->New
. - Enter connection details by providing a random name for your connection. Set the
username
toroot
, theport number
to3307
. Test your connection
. Setpassword
torootpassword
. If successfull,connect
.
The database is now fully operational and ready to handle CRUD operations from the backend.
Prerequisites:
- Maven: https://maven.apache.org/download.cgi
- Java Development Kit 17 (JDK 17): https://www.oracle.com/fr/java/technologies/downloads/
Ensure you have both their paths added to your PATH variables.
cd backend
# Build the JAR file if not available
mvn package
# Run the JAR file
java -jar target/demo-0.0.1-SNAPSHOT.jar
The backend is now operational and ready to receive requests from the frontend.
Prerequisites:
- Ubuntu 22.04.3 LTS
- golang 1.20+
- git
- docker v26.1.1
- docker-compose v2.27.0
Start by cloning the project repository: https://github.com/hyperledger/fabric-samples.git and installing the dependencies:
# From the fabric-samples directory
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh
./install-fabric.sh docker binary
# Make sure that the new binaries are in your PATH. If not, change the following line (replace <your/path/to/> with the actual path) and add it to your ~/.bashrc or ~/.zshrc file. Restart your terminal or source the edited file.
export PATH=</your/path/to/>fabric-samples/bin:$PATH
# Validate that the CA is at v1.5.7 by executing:
fabric-ca-client version
export TEST_NETWORK_HOME=</your/path/to>/fabric-samples/test-network
# Install go and tokengen. Tokengen is a tool to create the configuration file for the token chaincode.
sudo apt install golang
sudo apt-get install jq
go version
go install github.com/hyperledger-labs/fabric-token-sdk/cmd/tokengen@v0.3.0
Start the network. This generates the cryptogtaphic material, configures and starts the network, deploys the chaincode, and runs the token nodes.
./scripts/up.sh
By default, Alice and Bob are already enrolled. However, if you wish to enroll and register a new user, run:
fabric-ca-client register -u http://localhost:27054 --id.name newUser --id.secret password --id.type client --enrollment.type idemix --idemix.curve gurvy.Bn254
fabric-ca-client enroll -u http://newUser:password@localhost:27054 -M "$(pwd)/keys/owner1/wallet/newUser/msp" --enrollment.type idemix --idemix.curve gurvy.Bn254
To stop the network and delete everything, run:
./scripts/down.sh
The network and token SDKs are now operational and can handle requests from the frontend.
cd keycloak
# Build the docker image
docker build -t my-keycloak .
# Run the docker container
docker run -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -p 8099:8080 my-keycloak
- Navigate to http://localhost:8099/admin and set the
username
andpassword
toadmin
. You are now inside the service provider's admin console. - Go to
Realm Settings
->User profile
->Create attribute
. SetAttribute Name
toType
anddisplay name
to${type}
. SelectRequired field
and provide Permission to all. Create. - Go to
Clients
->Create Client
. Set theclient ID
toReact-auth
. Go toNext
and setRoot Url
tohttp://localhost:3000/
. - Go to
Client scopes
->Create client scope
. Selectprofil
in the list Name ->Mappers
->Add mapper by Configuration
->User Attribute
. SetName
toType
. SelectType
in the User Attribute list, settoken claim Name
totype
and finish by selectingAdd to lightweight access token
. Save. - Go to
Users
->Create New User
. SelectEmail verified
and setUsername
toalice
,Type
tocustomer
,Credentials
toalice
and untickTemporary
. - Go to
Users
->Create New User
. SelectEmail verified
and setUsername
tobob
,Type
tocustomer
,Credentials
tobob
and untickTemporary
. - Go to
Users
->Create New User
. SelectEmail verified
and setUsername
toissuer
,Type
tosupplier
,Credentials
toissuer
and untickTemporary
. - Go to
Realm Settings
->Themes
and setLogin Theme
tothemeLast2
. This theme was customized specifically for our application. If you wish to tailor it to your own needs, please use the Keycloakifier framework.