{"id":20821393,"url":"https://github.com/softblocksco/simple_coin","last_synced_at":"2025-05-07T16:23:11.971Z","repository":{"id":29031512,"uuid":"119672010","full_name":"SoftblocksCo/Simple_coin","owner":"SoftblocksCo","description":"It's probably the most easy-to-understand cryptocurrency implementation. Using state model, all the states are stored in Redis. Anyone can deploy this node, create wallet, send / receive transactions and even store some data in the blockchain. Python 3 + Tendermint = \u003c3","archived":false,"fork":false,"pushed_at":"2022-12-08T01:13:38.000Z","size":24,"stargazers_count":9,"open_issues_count":6,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-17T07:13:06.880Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SoftblocksCo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-31T10:24:45.000Z","updated_at":"2023-03-10T11:59:55.000Z","dependencies_parsed_at":"2022-08-07T14:01:07.465Z","dependency_job_id":null,"html_url":"https://github.com/SoftblocksCo/Simple_coin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftblocksCo%2FSimple_coin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftblocksCo%2FSimple_coin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftblocksCo%2FSimple_coin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftblocksCo%2FSimple_coin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SoftblocksCo","download_url":"https://codeload.github.com/SoftblocksCo/Simple_coin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225096692,"owners_count":17420293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T22:12:05.959Z","updated_at":"2024-11-17T22:12:06.418Z","avatar_url":"https://github.com/SoftblocksCo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Installation\nTo use Simple Coin you should install Tendermint core, Redis and some Python libraries. All the instructions were tested on the Ubuntu 16.04, not sure about other OS.\n\n## Tendermint \u0026 abci-cli (optional, need for testing)\n```bash\n$ mkdir tendermint\n$ cd tendermint\n$ sudo docker run --rm -v /your/tendermint/folder:/tendermint tendermint/tendermint:0.24.0 init\n[10-18|17:05:28.863] Generated private validator   module=main path=/tendermint/config/priv_validator.json\n[10-18|17:05:28.863] Generated node key            module=main path=/tendermint/config/node_key.json\n[10-18|17:05:28.863] Generated genesis file        module=main path=/tendermint/config/genesis.json\n```\n\n## Redis\n```bash\n$ sudo apt update\n$ sudo apt install redis-server\n$ sudo service redis-server restart\n$ redis-cli  # Check is everything ok\n127.0.0.1:6379\u003e ping\nPONG  # Press CTRL+C\n```\n\n## Repo\n```bash\n$ sudo apt-get install python3-dev virtualenv git\n$ git clone https://github.com/SoftblocksCo/Simple_coin\n$ cd Simple_coin\n$ virtualenv --python python3.6 --no-site-packages venv\n$ source venv/bin/activate  # Activate your virtual environment every time you use Simple Coin\n$ pip install -r requirements.txt\n```\n\n# Run Simple Coin\n```bash\n$ cd Simple_coin\n$ source venv/bin/activate\n$ python application.py\n$ # In another terminal\n$ cd tendermint # directory we created earlier\n$ sudo docker run --rm --network \"host\" -v /your/tendermint/folder:/tendermint tendermint/tendermint:0.24.0 node\n```\n\n# Wallet\nIn order to achive the great UI/UX, I've developed the new generation wallet. So anyone can work with Simple Coin without any troubles and don't touch code at all. Ed25519 cryptography was used - [here's](https://ed25519.cr.yp.to/) the docs.\n```bash\n$ python wallet.py --help\nusage: Simple wallet for SimpleCoin [-h] [-n] [-w WALLET] [-t] [-b BROADCAST]\n                                    [-g GET_BALANCE] [-s] [-c CHECK_SIGN]\n                                    [-m MESSAGE] [-p PUB_KEY] [-a AMOUNT]\n                                    [-r RECEIVER] [-d DATA]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -n, --new             Create new keypair\n  -w WALLET, --wallet WALLET\n                        Path to the .sc wallet\n  -t, --transaction     Create \u0026 sign a txn\n  -b BROADCAST, --broadcast BROADCAST\n                        Broadcast txn to the network\n  -g GET_BALANCE, --get_balance GET_BALANCE\n                        Get balance for some address\n  -s, --sign            Sign a message\n  -c CHECK_SIGN, --check_sign CHECK_SIGN\n                        Specify the signature\n  -m MESSAGE, --message MESSAGE\n                        Message to sign or to check\n  -p PUB_KEY, --pub_key PUB_KEY\n                        Public key, corresponding to the signature\n  -a AMOUNT, --amount AMOUNT\n                        Amount of coins to send in txn\n  -r RECEIVER, --receiver RECEIVER\n                        Transaction receiver\n  -d DATA, --data DATA  Small piece of data to store in txn\n```\n\n## Generate new wallet\nThis method creates new wallet file and saves it in the `--wallet` path. Inside this file there will be two rows: first one is a private key, second one is a public key. And this is all you need to use Simple Coin blockchain!\n\n```bash\n$ python wallet.py --new --wallet Alice.sc\nNew keypair saved into the Alice.sc\n$ cat Alice.sc\nOaEbR7z0UhqOeL0StWUZpe45H97H2NkwFhvZ0Ghrk3Y\njqRN5C3kS4t7kr7vFtdjouz1pw7eKhn+YoK1LvBcvEU\n```\n\n## Generate transaction\nThis method generates new transaction and signs it. Each transaction is a simple JSON, here's an example:\n```json\n{\n  \"sender\" : \"jqRN5C3kS4t7kr7vFtdjouz1pw7eKhn+YoK1LvBcvEU\",\n  \"receiver\" : \"WTLAL/dJWptYX2zE9XvFVcbGQvLRE7zsKYoI5bbnDcg\",\n  \"amount\" : 123,\n  \"data\" : \"big espresso\",\n  \"timestamp\" : 1517395993,\n  \"signature\" : \"\u003cSIGNATURE\u003e\"\n}\n```\nTransaction should be signed with a private key, according to the `sender` public key, otherwise it won't be valid (pretty obvious, isn't it?).\n```bash\npython wallet.py --transaction --wallet wallets/Bob.sc --receiver 'jqRN5C3kS4t7kr7vFtdjouz1pw7eKhn+YoK1LvBcvEU' --data 'hi, Alice!' --amount 10\nYour txn is printed bellow. Copy as it is and send with the ABCI query or using `--broadcast` flag\n\n0x7b2273656e646572223a202235393332633032666637343935613962353835663663633466353762633535356336633634326632643131336263656332393861303865356236653730646338222c20227265636569766572223a20226a71524e3543336b533474376b7237764674646a6f757a31707737654b686e2b596f4b314c764263764555222c202274696d657374616d70223a20313531373339363635372c202264617461223a202268692c20416c69636521222c20227369676e6174757265223a2022334b5750435434496d4b542f593535762b634866754270766f6c4e58747058516f306474516f7467624141564d5870424d48633734716850664f5376393569686d7369536e346f6f5039677557747158486b79334341222c2022616d6f756e74223a2031307d\n```\n\n\n## Send transaction\nThis methods broadcasts signed transaction to the Tendermint nodes. Also, you can do it manually: after launching `tendermint node` and Application, open the [http://localhost:46657/](http://localhost:46657/). It's something like a build-in Tendermint API, which includes method `broadcast_tx_async` for txn broadcasting (just copy-paste your txn into the `tx` GET argument).\n```bash\n$ python wallet.py --broadcast '0x7b2273656e646572223a202235393332633032666637343935613962353835663663633466353762633535356336633634326632643131336263656332393861303865356236653730646338222c20227265636569766572223a20226a71524e3543336b533474376b7237764674646a6f757a31707737654b686e2b596f4b314c764263764555222c202274696d657374616d70223a20313531373339363635372c202264617461223a202268692c20416c69636521222c20227369676e6174757265223a2022334b5750435434496d4b542f593535762b634866754270766f6c4e58747058516f306474516f7467624141564d5870424d48633734716850664f5376393569686d7369536e346f6f5039677557747158486b79334341222c2022616d6f756e74223a2031307d'\nYour txn have been broadcasted to the network!\n```\n\n## Get balance\nThis method returns your current balance. As well as `Send transaction` method, it uses Tendermint API to make a query to the Application. You should specify public key after `--get_balance` flag.\n```bash\n$ python wallet.py --get_balance fRsyOcYoFJOg9nXk6iugOMApvRXEghAbSpFIHxRWdNA\nThere are 1000 SimpleCoins on the fRsyOcYoFJOg9nXk6iugOMApvRXEghAbSpFIHxRWdNA\n```\n\n## Sign message\nThis method allows you to sign any message with your private key.\n```bash\n$ cat Alice.sc\n0GqohWtjnIjmsm46Cq+o53+iqoHu/OIOmKV8C44Lz9I\nfRsyOcYoFJOg9nXk6iugOMApvRXEghAbSpFIHxRWdNA\n$ python wallet.py --sign --message 'I need to be sure' --wallet Alice.sc\nThe signature is:\t Ulh1in480frZoVzW+wEcbMYxu1w0YKXyipUPP1fSPyIUbYnHWe3OvHqJ5lyiIAKf/ltyQ3WB+KBpaPAAFMJcCQ\n```\n\n## Check message signature\nThis method allows you to check, that the signature satisfies the public key and a message.\n```bash\n$ cat Alice.sc\n0GqohWtjnIjmsm46Cq+o53+iqoHu/OIOmKV8C44Lz9I\nfRsyOcYoFJOg9nXk6iugOMApvRXEghAbSpFIHxRWdNA\n$ python wallet.py --check 'Ulh1in480frZoVzW+wEcbMYxu1w0YKXyipUPP1fSPyIUbYnHWe3OvHqJ5lyiIAKf/ltyQ3WB+KBpaPAAFMJcCQ' --pub_key 'fRsyOcYoFJOg9nXk6iugOMApvRXEghAbSpFIHxRWdNA' --message 'I need to be sure' -w Alice.sc\nValid signature!\n$ python wallet.py --check 'Ulh1in480frZoVzW+wEcbMYxu1w0YKXyipUPP1fSPyIUbYnHWe3OvHqJ5lyiIAKf/ltyQ3WB+KBpaPAAFMJcCQ' --pub_key 'fRsyOcYoFJOg9nXk6iugOMApvRXEghAbSpFIHxRWdNA' --message 'I dont need to be sure' -w Alice.sc\nInvalid signature!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftblocksco%2Fsimple_coin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftblocksco%2Fsimple_coin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftblocksco%2Fsimple_coin/lists"}