denaro
所属分类:区块链开发
开发工具:Python
文件大小:48KB
下载次数:0
上传日期:2023-04-26 13:39:32
上 传 者:
sh-1993
说明: denaro,一种用Python编写的去中心化加密货币
(denaro,A decentralized cryptocurrency written in Python)
文件列表:
CHANGELOG.md (51, 2023-04-26)
Dockerfile (270, 2023-04-26)
LICENSE (34522, 2023-04-26)
Makefile (165, 2023-04-26)
create_unspent_outputs.py (1594, 2023-04-26)
denaro (0, 2023-04-26)
denaro\__init__.py (99, 2023-04-26)
denaro\constants.py (193, 2023-04-26)
denaro\database.py (32006, 2023-04-26)
denaro\exceptions.py (47, 2023-04-26)
denaro\helpers.py (5284, 2023-04-26)
denaro\manager.py (14939, 2023-04-26)
denaro\node (0, 2023-04-26)
denaro\node\__init__.py (0, 2023-04-26)
denaro\node\main.py (18055, 2023-04-26)
denaro\node\nodes_manager.py (5086, 2023-04-26)
denaro\node\run.py (110, 2023-04-26)
denaro\node\utils.py (698, 2023-04-26)
denaro\transactions (0, 2023-04-26)
denaro\transactions\__init__.py (189, 2023-04-26)
denaro\transactions\coinbase_transaction.py (1504, 2023-04-26)
denaro\transactions\transaction.py (9940, 2023-04-26)
denaro\transactions\transaction_input.py (3927, 2023-04-26)
denaro\transactions\transaction_output.py (1123, 2023-04-26)
denaro\wallet (0, 2023-04-26)
denaro\wallet\nodeless_wallet.py (5962, 2023-04-26)
denaro\wallet\utils.py (1997, 2023-04-26)
denaro\wallet\wallet.py (3838, 2023-04-26)
docker-compose.yml (1012, 2023-04-26)
docs (0, 2023-04-26)
docs\block.md (695, 2023-04-26)
docs\transaction.md (1754, 2023-04-26)
miner.py (4049, 2023-04-26)
... ...
denaro
======
**denaro**, _'money' in italian_, is a cryptocurrency written in Python.
Maximum supply is 30.062.005.
Maximum decimal digits count is 6.
Blocks are generated every ~3 minutes, with a size limit of 2MB per block.
Assuming an average transaction to be composed by 5 inputs and 2 outputs, that are 250 bytes, a block can contain ~8300 transactions, which means ~40 transactions per second.
## Setup with Docker
+ Build the base image with `make build`
+ `$ docker-compose up -d`
## Installation
Before installing denaro, you need to create the postgresql database.
You can find the schema in [schema.sql](https://github.com/denaro-coin/denaro/blob/master/schema.sql).
You have to set environmental variables for database access:
- `DENARO_DATABASE_USER`, default to `denaro`.
- `DENARO_DATABASE_PASSWORD`, default to an empty string.
- `DENARO_DATABASE_NAME`, default to `denaro`.
- `DENARO_DATABASE_HOST`, default to `127.0.0.1`.
```bash
# install postgresql
createdb denaro
```
Then install denaro.
```bash
git clone https://github.com/denaro-coin/denaro
cd denaro
psql -d denaro -f schema.sql
pip3 install -r requirements.txt
uvicorn denaro.node.main:app --port 3006
```
Node should now sync the blockchain and start working
## Mining
denaro uses a PoW system.
Block hash algorithm is sha256.
The block sha256 hash must start with the last `difficulty` hex characters of the previously mined block.
`difficulty` can also have decimal digits, that will restrict the `difficulty + 1`th character of the derived sha to have a limited set of values.
```python
from math import ceil
difficulty = 6.3
decimal = difficulty % 1
charset = '0123456789abcdef'
count = ceil(16 * (1 - decimal))
allowed_characters = charset[:count]
```
Address must be present in the string in order to ensure block property.
Blocks have a block reward that will half itself til it reaches 0.
There will be `150000` blocks with reward `100`, and so on til `0.390625`, which will last `458732` blocks.
The last block with a reward will be the `458733`th, with a reward of `0.3125`.
Subsequent blocks won't have a block reward.
Reward will be added the fees of the transactions included in the block.
A transaction may also have no fees at all.
近期下载者:
相关文件:
收藏者: