|
1 |
| -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). |
| 1 | +# Syscoin Bridge |
2 | 2 |
|
3 |
| -## Getting Started |
| 3 | +This project is a bridge between Syscoin UTXO and Syscoin NEVM. It allows Syscoin assets to be moved to Syscoin NEVM and back. |
4 | 4 |
|
5 |
| -First, run the development server: |
| 5 | +https://bridge.syscoin.org/ |
| 6 | + |
| 7 | +> Trustless transfer of SYS back and forth between the Syscoin UTXO and Syscoin NEVM blockchains without middlemen ! |
| 8 | +
|
| 9 | +## Screenshots |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +## How it works |
| 16 | + |
| 17 | +### UTXO to NEVM |
| 18 | + |
| 19 | +1. User burns SYS to create SYS on the Syscoin UTXO chain by via `syscoinBurnToAssetAllocation` RPC call. |
| 20 | +2. User burns SYSX to create SYS on the Syscoin NEVM chain by via `assetAllocationBurn` RPC call and specifying the NEVM address which receives the SYS on NEVM chain. |
| 21 | +3. Once both transactions are mined, the user can now use the transaction data to build a SPV proof `fetchBackendSPVProof` . This proof is then send to a Smart Contract on Syscoin NEVM chain. |
| 22 | +4. The Smart Contract verifies the SPV proof and if valid, mints SYS on the Syscoin NEVM chain to the address indicated on the SPV proof. |
| 23 | + |
| 24 | +### NEVM to UTXO |
| 25 | + |
| 26 | +1. User freezes and Burn their SYS by calling on the `SyscoinERC20Manager` contract `freezeBurnERC20` function. |
| 27 | +2. Once the transaction is mined, the user can now use the transaction data to mint SYSX asset on UTXO chain by calling `assetAllocationMint` RPC call. |
| 28 | +3. Once SYSX is minted, this again can be burned using `assetAllocationBurn` to get native SYS on UTXO. |
| 29 | + |
| 30 | +### Bridge UI |
| 31 | + |
| 32 | +The bridge UI is a ReactJS application that allows users to interact with the bridge. It is a NextJS application that uses Firebase for authentication and storage. This allows users to interact with the bridge without having to install any software. |
| 33 | + |
| 34 | +Each step taken on the Bridge is stored in Firebase Firestore. This allows the user to resume the process at any time. |
| 35 | + |
| 36 | +## How to run |
| 37 | + |
| 38 | +### Prerequisites |
| 39 | + |
| 40 | +- NodeJS 16+ (recommneded to use `nvm` to install NodeJS) |
| 41 | +- Firebase Emulator (recommended to use `npm install -g firebase-tools` to install Firebase Emulator) |
| 42 | +- Yarn (recommended to use `npm install -g yarn` to install Yarn) |
| 43 | + |
| 44 | +### Install dependencies |
| 45 | + |
| 46 | +```bash |
| 47 | +yarn install |
| 48 | +``` |
| 49 | + |
| 50 | +### Run Firebase Emulator |
| 51 | + |
| 52 | +Runs Firebase Emulator on port `4000` |
| 53 | + |
| 54 | +```bash |
| 55 | +yarn firebase:dev |
| 56 | +``` |
| 57 | + |
| 58 | +### Run Dev Server |
| 59 | + |
| 60 | +Runs NextJS Dev Server on port `3000` |
6 | 61 |
|
7 | 62 | ```bash
|
8 |
| -npm run dev |
9 |
| -# or |
10 | 63 | yarn dev
|
11 | 64 | ```
|
12 | 65 |
|
13 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 66 | +## Production Deployment |
14 | 67 |
|
15 |
| -You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. |
| 68 | +### Production Build |
16 | 69 |
|
17 |
| -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. |
| 70 | +```bash |
| 71 | +yarn build |
| 72 | +``` |
18 | 73 |
|
19 |
| -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. |
| 74 | +### Production Docker |
| 75 | + |
| 76 | +```bash |
| 77 | +docker build -t syscoin/bridge . |
| 78 | +``` |
20 | 79 |
|
21 |
| -## Learn More |
| 80 | +### Environment Variables (for Production Docker) |
22 | 81 |
|
23 |
| -To learn more about Next.js, take a look at the following resources: |
| 82 | +| Name | Description | Default | |
| 83 | +| ------------------------------ | ---------------------------- | ------- | |
| 84 | +| `FIREBASE_API_KEY` | Firebase API Key | `""` | |
| 85 | +| `FIREBASE_AUTH_DOMAIN` | Firebase Auth Domain | `""` | |
| 86 | +| `FIREBASE_PROJECT_ID` | Firebase Project ID | `""` | |
| 87 | +| `FIREBASE_STORAGE_BUCKET` | Firebase Storage Bucket | `""` | |
| 88 | +| `FIREBASE_MESSAGING_SENDER_ID` | Firebase Messaging Sender ID | `""` | |
| 89 | +| `FIREBASE_APP_ID` | Firebase App ID | `""` | |
| 90 | +| `FIREBASE_MEASUREMENT_ID` | Firebase Measurement ID | `""` | |
| 91 | +| `FIREBASE_AUTH_EMAIL` | Firebase Auth Email | `""` | |
| 92 | +| `FIREBASE_AUTH_PASSWORD` | Firebase Auth Password | `""` | |
| 93 | +| `FIREBASE_AUTH_UID` | Firebase Auth UID | `""` | |
24 | 94 |
|
25 |
| -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
26 |
| -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 95 | +## Contact |
27 | 96 |
|
28 |
| -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! |
| 97 | +### Developers |
29 | 98 |
|
30 |
| -## Deploy on Vercel |
| 99 | +- [Ted](https://github.com/osiastedian) |
31 | 100 |
|
32 |
| -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
| 101 | +### Channels |
33 | 102 |
|
34 |
| -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
| 103 | +- [Discord](https://discord.gg/RkK2AXD) |
| 104 | +- [Telegram](https://t.me/Syscoin_Official) |
| 105 | +- [Twitter](https://twitter.com/syscoin) |
| 106 | +- [Facebook](https://www.facebook.com/Syscoin/) |
| 107 | +- [Reddit](https://www.reddit.com/r/SysCoin/) |
| 108 | +- [LinkedIn](https://www.linkedin.com/company/syscoin/) |
0 commit comments