Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dannyjiustian/system-server-rfid-blockchain

This repository is for a contactless payment server system with blockchain technology, the project is connected with hardware and mobile application systems.
https://github.com/dannyjiustian/system-server-rfid-blockchain

blockchain ethereum expressjs javascript mqtt mqtt-broker postgresql prisma rest-api server smart-contracts

Last synced: about 2 months ago
JSON representation

This repository is for a contactless payment server system with blockchain technology, the project is connected with hardware and mobile application systems.

Awesome Lists containing this project

README

        

# System Server for Contactless Payment with Blockchain System

This repository is built with Javascript programming language as the basic language. The main function in this repository is to create a server for contactless payments with blockchain technology. The server that is run can run locally or publicly. it is hoped that this repository can see the server running, especially on blockchain technology. blockchain uses the Sepolia Test Network for the development of this project.

## Preparation

Download or Clone this repository. After that you open it with Visual Studio Code, and type this command to install all the requirements in this repository.

```bash
npm install
```

If the installation requirements have been successful, you can use this command from prism to create a database using migration. The database used is PostgreSQL to store all the data in this project. Don't forget to change the PostgreSQL username [YOUR_USERNAME], password [YOUR_PASSWORD], and database name [YOUR_DATABASE_NAME] in the **.env** file.

```env
DATABASE_URL="postgresql://YOUR_USERNAME:YOUR_PASSWORD@localhost:5432/YOUR_DATABASES_NAME"
```

```bash
npx prisma migrate dev --name init
```

And then you have to run this project first if you need to create a smart contract, a smart contract that is used with your wallet address. This project needs the private key of the wallet address, the url of the api key test network, and finally needs the type of the etherium network. You can fill in the values in the **.env** file. if you need URL_ETH_API_KEY, you can visit the link https://www.alchemy.com/ and create an account. This smart contract runs on Sepolia Network, if you are using another network, you need to change the configuration in the code.

```env
NETWORK_ETH=USE_SEPOLIA OR USE_ANOTHER_NETWORK_BUT_RUNNING_AT_ETHEREUM_BASE
URL_ETH_API_KEY=https://eth-[NETWORK_ETH_NAME].g.alchemy.com/v2/YOUR_API_KEY
ACCOUNTS_PRIVATE_KEY=YOUR_PRIVATE_KEY_WALLET_ADDTRESS
```

You can use this command to run this smart contract for the first time

```bash
npx hardhat run smart_contract/deploy/deploy.js --network sepolia
```

You need to add the mqtt host, mqtt port, mqtt username, and mqtt password in the **.env** file. You can create an account at https://hivemq.com

```env
HOST_MQTT = xxxxxxxx.hivemq.cloud
PORT_MQTT = xxxx
USERNAME_MQTT = xxxxxxxx
PASSWORD_MQTT = xxxxxxxx
```
## Running the code

If you want to run this code, you have 2 conditions, the first condition is that you need to create a smart contract for the blockchain, you can use this command on the terminal project.

```bash
npm run dev-smart-contract
```

and you need to debug the code, you can use this command in the project terminal.

```bash
npm run dev-without-smart-contract
```

## Optional Configuration at the enviroment

If you need other configurations in this environment, you can edit this environment, especially the secret key and server port.

```
APP_LOCAL=[dev or production]
CORS_SERVER_PRODUCTION=[dev or production]
BASE_URL_API_VERSION=[v1 or another version API]
SECRET_ACCESS_KEY_JWT=s[secret]
SECRET_REFRESH_KEY_JWT=[secret]
SECRET_SALT_BYCRPT=[10 or another value]
PORT_SERVER=[port running this server]
SECRET_KEY_ETHERS=[secret]
```

## Tech Stack

**System:** JavaScript, NodeJS, Prisma, ORM