帮助理解区块链中哈希函数的区块链链接器
justblockchain的Python项目详细描述
仅区块链
帮助理解区块链中哈希函数的区块链链接器
- 自由软件:麻省理工学院许可证
- 文档:https://justblockchain.readthedocs.io。
快速启动
安装
- pip安装justblockchain
创建简单的区块链
>>> from justblockchain import justblockchain
>>> blockchain = justblockchain.Blockchain()
>>> blockchain.add_block("some block content")
#display the blockchain
>>> blockchain.chain
[{'previous_hash': '0', 'hash':
'816534932c2b7154836da6afc367695e6337db8a921823784c14378abed4f7d7',
'timestamp': 1465154705, 'index': 0, 'data': 'my genesis block!!'},
{'previous_hash':
'816534932c2b7154836da6afc367695e6337db8a921823784c14378abed4f7d7', 'hash':
'a046e0b31d2374d171a6bf62f15261f8bb1f71e6351aab2ce7ce6d550506d9ee',
'timestamp': '1521013680', 'index': 1, 'data': 'some block content'}]
使用工作证明创建块
>>> from justblockchain import justblockchain >>> blockchain = justblockchain.Blockchain() >>> blockchain.difficulty_bits = 20 >>> blockchain.add_block("some block content") Computing nonce for the block... Success with nonce 2991544 Hash is 00000fc3d1420243cca17693bcc75334eb9f01b0943772f5d6456e17f3218abc
学分
- 版本1.0.0中工作证明算法的实现灵感来自Mastering Bitcoin-第一版的Andreas M. Antonopoulos LLC,该版本在Creative Commons Attribution-ShareAlike 4.0 International License 下获得许可。
- 这个包是用Cookiecutter和audreyr/cookiecutter-pypackage项目模板创建的。
历史记录
0.1.0(2018-03-13)
- pypi上的第一个版本。