Based on Kin Blockchain
Make sure you have python 3.7+ and pip installed.
git clone https://github.com/OnshaBogdan/Kin-Server.git
cd Kin-Server/
virtualenv -p python3 .venv
source .venv/Scripts/activate
pip3 install --upgrade -r requirements.txt
Replace config.py with your firebase data
config = {
"apiKey": "",
"authDomain": "",
"databaseURL": "",
"projectId": "",
"storageBucket": "",
"messagingSenderId": ""
}
- Change your firebase rules as in the example below:
{
"rules": {
"users" : {
".indexOn": ["email", "uid"]
},
"transactions" : {
".indexOn": ["uid"]
},
".read": true,
".write": true
}
}
- Set up
app.secret_key
inapplication.py
.
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
sudo apt install python3-pip
sudo apt install python3.7-dev
python3.7 -m pip install virtualenv
mkdir /var/Kin
cd /var/Kin
git clone https://github.com/OnshaBogdan/Kin-Server.git
cd Kin-Server/
virtualenv -p python3.7 .venv
source .venv/bin/activate
python3.7 -m pip install -r requirements.txt
gunicorn -k uvicorn.workers.UvicornWorker --bind="0.0.0.0:5000" wsgi:app --daemon --access-logfile access-log.txt --error-logfile error-log.txt
.
├── .venv # virtual environment
├── static # Folder with staticfiles (.css, .js)
├── templates # Folder with .html templates
├── application.py # Main Script, runs the app
├── configuration.py # Configuration of firebase db
├── errors.py # Custom Exceptions
├── firebase_service.py # Firebase driver
├── kin-service.py # Kin-sdk driver
├── limits.py # Script that refreshes user limits periodically
├── create-admin.py # Creates user with admin panel access
├── wsgi.py # Gunicorn/Uvicorn entry point
└── requirements.txt # Project dependencies
body{
"email":"YourMail@gmail.com",
"password": "yourpassword228"
}
{
"balance": 0,
"email": "YourMail@gmail.com",
"is_admin": false,
"limits": {
"day": "1000",
"month": "15000",
"week": "5000"
},
"public_address": "GDYXLK2MLGNTWMDTBTCJ2C7X6GQVYGV4234EZDOLNGPATUS64EUJ5M3W",
"seed": "SB2COATQYWFZ6TE5NRZBWDYC3ZKVA3KXGSLKD3DLYNMKJRX3C242LHII",
"token": "a6e2347889404034a4f442d27269ca29",
"uid": "U7y8MR1c6eTa4qb62JICaxn4jBr2"
}
body{
"email":"YourMail@gmail.com",
"password": "yourpassword228"
}
{
"is_admin": false,
"token": "9188dace30f34f31b0bf172d570e55fb"
}
headers{
"uid" : "ml3UADqweOXYznUaQPGLPmDklOz1"
}
body{
"token":"eyJhbGciOiJSUzI1NiIsImtpZCII7RQx2UrCZ9RuKvRJraFVg...",
"amount":100,
"description" : "example-descr"
}
{
"amount": 10,
"balance": 79.998,
"id": "b4a520698fd5b114fe3c2c1c4fa6f174a587064629eacad4668897d28a53ec04",
"memo": "1-NM8e-api",
"recipient_address": "GC3DZ7PIJL4NADTAPWIJXAOANQ37KJB3BQWQADXAEDIWM3TOIRTSDXAF",
"sender_address": "GCW25THTQ6YP32QV6JVMRKX2SYWLBM345WKN2PBTCTTDZET2HMSPMIAY",
"uid": "ml3UADqweOXYznUaQPGLPmDklOz1"
}
headers{
"uid" : "ml3UADqweOXYznUaQPGLPmDklOz1"
}
body{
"token":"eyJhbGciOiJSUzI1NiIsImtpZCII7RQx2UrCZ9RuKvRJraFVg...",
"amount":100,
"description" : "example-descr"
}
{
"amount": 10,
"balance": 69.997,
"id": "f7a761b97be8c4fa10ddd9329c214bd97c13663bb36504cf9b501d696cd029cb",
"memo": "1-NM8e-api",
"recipient_address": "GCW25THTQ6YP32QV6JVMRKX2SYWLBM345WKN2PBTCTTDZET2HMSPMIAY",
"sender_address": "GC3DZ7PIJL4NADTAPWIJXAOANQ37KJB3BQWQADXAEDIWM3TOIRTSDXAF",
"uid": "ml3UADqweOXYznUaQPGLPmDklOz1"
}
headers{
"uid" : "ml3UADqweOXYznUaQPGLPmDklOz1"
}
body{
"token":"703392294f934aa0b9ce823a70a2e800"
}
{
"balance":69.997
}
headers{
"uid" : "ml3UADqweOXYznUaQPGLPmDklOz1"
}
body{
"token":"703392294f934aa0b9ce823a70a2e800"
}
{
"public_address":"GCW25THTQ6YP32QV6JVMRKX2SYWLBM345WKN2PBTCTTDZET2HMSPMIAY"
}
headers{
"uid" : "ml3UADqweOXYznUaQPGLPmDklOz1"
}
{
"token":"703392294f934aa0b9ce823a70a2e800"
}
{
"transactions": [
{
"amount": 100,
"id": "85206471492e4b02cf0c3bbccc93a439d42a155256029a083bea6faf1b273567",
"memo": "1-NM8e-example-descr",
"recipient_address": "GBW4NQFQH6IOOPKY5ZXKS2U4D5FDW6PIXCFJQIXM2GXP2OR4COBQGHIR",
"sender_address": "GCW25THTQ6YP32QV6JVMRKX2SYWLBM345WKN2PBTCTTDZET2HMSPMIAY",
"uid": "Oy46pOMn6lfJrMJnBMForPaDDyT2"
},
{
...
}
]
}
headers{
"uid" : "ml3UADqweOXYznUaQPGLPmDklOz1"
}
Status Code: 200
In project root folder:
python create_admin.py YourMail@gmail.com YourPassword228