Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gurbaaz27/iitk-coin
IITK Coin: SnT Project, Summer 2021. Golang backend .
https://github.com/gurbaaz27/iitk-coin
acid backend go golang pseudo sqlite-database wallet
Last synced: about 1 month ago
JSON representation
IITK Coin: SnT Project, Summer 2021. Golang backend .
- Host: GitHub
- URL: https://github.com/gurbaaz27/iitk-coin
- Owner: gurbaaz27
- License: mit
- Created: 2021-05-29T02:24:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-29T05:25:01.000Z (over 3 years ago)
- Last Synced: 2024-11-14T12:10:18.206Z (3 months ago)
- Topics: acid, backend, go, golang, pseudo, sqlite-database, wallet
- Language: Go
- Homepage:
- Size: 5.96 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IITK Coin
## SnT Project 2021, Programming ClubThis repository contains the code for the IITKCoin, a vision of a pseudo-currency for use in the IITK Campus.
### Relevant Links
- [Final Submission Drive](https://drive.google.com/drive/folders/1N93J_1ouR1AXctIZZkek0YMD5_LY0LVM?usp=sharing)
- [Midterm Evaluation presentation](https://docs.google.com/presentation/d/1kriN-7A3v1RlXUDL5NETX3roJKRMJInptkWofIxY8dg/edit?usp=sharing)
- [Midterm Documentation](https://docs.google.com/document/d/1bvOWH4k0U-l2pQ1jLWIDzOkJ2wbHNW4jJw7tMWkUV6o/edit?usp=sharing)## Table Of Content
- [Development Environment](#development-environment)
- [Directory Structure](#directory-structure)
- [Usage](#usage)
- [Endpoints](#endpoints)
- [Models](#models)## Development Environment
```bash
- go version: go1.16.4 linux/amd64 # https://golang.org/dl/
- system: 5.4.72-microsoft-standard-WSL2 x86_64 # https://docs.microsoft.com/en-us/windows/wsl/install-win10
- text editor: VSCode # https://code.visualstudio.com/download
- terminal: Zsh # https://ohmyz.sh/
```## Directory Structure
```
.
├── Dockerfile
├── LICENSE
├── README.md
├── controllers
│ └── routes.go
├── database
│ └── database.go
├── go.mod
├── go.sum
├── iitk-coin
├── main.go
├── models
│ └── models.go
├── redeem-database-190349.db
├── transaction-database-190349.db
├── user-database-190349.db
└── wallet-database-190349.db3 directories, 14 files
```## Usage
```bash
cd $GOPATH/src/github.com/
git clone https://github.com/gurbaaz27/iitk-coin.git
cd repo
go run main.go
#, or build the program and run the executable
go build
./iitk-coin
# , or build docker image and run docker container
docker build -t iitk-coin .
docker run --rm -it -p 8080:8080 iitk-coin
```Output should look like
```
2021/06/20 23:59:40 User Database opened and table created (if not existed) successfully!
2021/06/20 23:59:40 Transaction Database opened and table created (if not existed) successfully!
2021/06/20 23:59:40 Wallet Database opened and table created (if not existed) successfully!
2021/06/20 23:59:40 Serving at 8080
```## Endpoints
POST requests take place via `JSON` requests. A typical usage would look like```bash
curl -d '' -H 'Content-Type: application/json' http://localhost:8080/
```- `/login` : `POST`
```json
{"name":"", "rollno":"", "password":""}
```- `/signup` : `POST`
```json
{"rollno":"", "password":""}
```- `/reward` : `POST`
```json
{"rollno":"", "coins":""}
```- `/transfer` : `POST`
```json
{"sender":"", "receiver":"", "coins":""}
```GET requests:
- `/secretpage` : `GET`
```bash
curl http://localhost:8080/secretpage
```- `/balance` : `GET`
```bash
curl http://localhost:8080/balance?rollno=
```## Models
- User
```go
Name string `json:"name"`
Rollno string `json:"rollno"`
Password string `json:"password"`
```- RewardPayload
```go
Rollno string `json:"rollno"`
Coins int64 `json:"coins,string"`
```- TransferPayload
```go
SenderRollno string `json:"sender"`
ReceiverRollno string `json:"receiver"`
Coins int64 `json:"coins,string"`
```