micw/README.md
2024-11-13 22:10:13 +01:00

77 lines
2.4 KiB
Markdown

# MICW v1
> [!WARNING]
> In early stage development
This version of MICW **(Mental Illness Coin Wallet)** is rather small centralized block-chain-like cryptocurrency system. It's performance focused because we have shitty hardware on our server.
## Server
### Configuring
```yaml
addr: "0.0.0.0"
tls:
enable: true
cert: ""
key: ""
http_port: 8000
grpc_port: -1 # -1 to disable
https_port: 443
db:
host: "postgres"
port: 5432
user: "micw"
name: "micw"
password_file: "/run/secrets/db_password"
rewarders_public_keys:
- "<trusted_pk>"
```
### Running
```bash
# Edit config
nvim server/config.yml
# Put DB passowrd here
nvim .secrets/db_password.txt
# Build
docker compose build
# Run
docker compose up
```
### Main terminology and ideas
This wallet has two main entities that are stored inside a database `block` and `transaction`.
Blocks are just groups of transactions made in optimization purposes, kinda like buffering
Blocks are created, updated and uploaded into the DB by `server/core/BlocksPipeline`
## Client
`util` is kinda a POC client for our wallet, with which you can generate and manage wallets, make transactions, etc, from your command line
Here are some useful commands u may need
```sh
# Write the keys (will ask u for password)
./util key gen ./keys
# Get public key
./util key pub ./keys
# Get whole key (password required if was set)
./util key get ./keys
# create a new transaction with sending 1.0MIC to a receiver pk
./util api send -a <proto://w.mic.pp.ua:443> -k <your_keys_file_path> -m <"message"> <receiver_public_key> 1.0
# checks transaction status
./util api get-tx -a <proto://w.mic.pp.ua:443> <tx_hash>
# Returns your current
./util api balance -a <proto://w.mic.pp.ua:443> <public_key>
# Saves incoming transactions table
./utils api incoming -a <proto://w.mic.pp.ua:443> -o ./incoming_trx_out.csv <public_key>
# Saves outcoming transactions table
./utils api outcoming -a <proto://w.mic.pp.ua:443> -o ./outcoming_txs_out.csv <public_key>
```
### Getting started: generating keys
You are proving that u can commit a transaction by providing signatures with a transactions. And to make a signature -- u need a private key. Everybody can check your signature with your public key though, so your public key is basically your wallet address. We may make aliases later, but still it would be way more secure to use key as an address. As algorithms for signatures we are using `ed25519`.
## Plans
- Mobile app
- MIC Bot integration