https://github.com/crossbell-box/operator-sign
Crossbell Operator Sign Backend Service
https://github.com/crossbell-box/operator-sign
Last synced: 19 days ago
JSON representation
Crossbell Operator Sign Backend Service
- Host: GitHub
- URL: https://github.com/crossbell-box/operator-sign
- Owner: Crossbell-Box
- License: mit
- Created: 2023-10-25T00:28:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-18T18:17:52.000Z (about 2 years ago)
- Last Synced: 2025-03-03T07:28:10.066Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://op-sign.crossbell.io/docs
- Size: 491 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Crossbell Operator Sign Backend Service
**Operator Sign (Op Sign)** designed to enhance the user experience on the Crossbell network. Its primary goal is to streamline the interaction process by minimizing the number of manual approvals required for each transaction.
## Features
- **Efficient Interactions**: No need to manually approve every transaction, ensuring a smoother user experience.
- **Secure Authentication**: Leverage the SIWE protocol to authenticate users based on their encrypted signature.
- **Delegated Operations**: The Operator contract methods can carry out operations on the user's behalf, ensuring both convenience and security.
## Getting Started
#### Install deps:
```bash
npm install
```
#### Prepare environment variables:
```bash
copy .env.example .env
```
#### Setup wallet:
You will need to create a wallet and obtain the private key and address, then fill in the environment variables: `OP_SIGN_OPERATOR_WALLET_ADDRESS` and `OP_SIGN_OPERATOR_WALLET_PRIVATE_KEY`.
#### Start Database instance:
```bash
npm run docker:db
```
#### Migrate database and generate types in development environment:
```bash
npm run prisma:migrate:dev
```
#### Start server:
```bash
npm run start:dev
```
#### Access the Swagger API docs:
Once the server starts, the Swagger API docs will be available at the `/docs` path. For example, if you are running the server locally at port `3988`, you can access the docs at [http://localhost:3988/docs](http://localhost:3988/docs).
## Deployment
Docker:
```bash
# building new NestJS docker image
docker-compose build
# or
npm run docker:build
# start docker-compose
docker-compose up -d
# or
npm run docker
```
In Node.js Environment:
```
npm install
npm run build
NODE_ENV=production node dist/main
```
### Migrate database
In development:
```bash
npm run prisma:migrate:dev
```
In production:
```bash
npm run prisma:migrate:deploy
```
## Customizing Endpoints in [Crossbell React Kits](https://crossbell-dev.vercel.app)
Check out the customizing guide [here](https://crossbell-dev.vercel.app/docs/customizing-endpoints).
## Modules
### [Siwe](src/module/siwe/)
The `Siwe` module is designed to facilitate the implementation of the Sign-In with Ethereum (SIWE) protocol. It encompasses a suite of functions essential for integrating SIWE's authentication mechanisms.
### [SiweTransaction](src/module/transaction/)
The `SiweTransaction` module is responsible for managing a range of transactions, including posting, commenting, liking, and tipping activities.
### [EventListeners](src/module/event-listeners/)
The `EventListeners` module is crafted to monitor and process events generated by the Operator contract. It ensures the system responds appropriately to permissions updates and other significant contract interactions.
### [CsbManager](src/module/csb-manager/)
The `CsbManager` module provides utility functions that are instrumental for managing interactions with the `$CSB`.
### [Contract](src/module/contract/)
The `Contract` module used to initialize the contract instance.
## Feedback & Contributions
We welcome feedback and contributions from the community. Feel free to raise issues, submit pull requests, or share your insights to enhance the Operator Sign feature.
> 🫡 This project was initially developed by [@SongKeys](https://github.com/Songkeys). Original commit logs were deleted to protect sensitive information before open-sourcing.