blockchain

用Python实现的简单区块链。(A simple Blockchain in Python.)

Github星跟踪图

通过构建一个学习区块链

这是我在构建区块链上的帖子的源代码。

安装

  1. 确保安装了 Python 3.6+
  2. 安装 pipenv
$ pip install pipenv
  1. 安装要求
$ pipenv install
  1. 运行服务器:
    • $ pipenv run python blockchain.py
    • $ pipenv run python blockchain.py -p 5001
    • $ pipenv run python blockchain.py --port 5002

Docker

运行这个区块链程序的另一个选择是使用Docker。按照以下说明创建本地Docker容器:

  1. 克隆此存储库
  2. 建立docker container
$ docker build -t blockchain。
    1. 运行容器
    $ docker run --rm -p 80:5000 blockchain
    
    1. 要添加更多实例,请在冒号前改变公共端口号:
    $ docker run --rm -p 81:5000 blockchain
    $ docker run --rm -p 82:5000 blockchain
    $ docker run --rm -p 83:5000 blockchain
    

    安装(C#实现)

    1. 安装Visual Studio IDE(社区版)的免费副本: https://www.visualstudio.com/vs/
    2. 安装后,使用文件>打开解决方案文件(BlockChain.sln)。打开> Visual Studio中的项目/解决方案菜单选项。
    3. 在“解决方案资源管理器”中,右键单击BlockChain.Console项目并选择“设为启动项目”选项。
    4. 点击“开始”按钮,或点击F5运行。该程序在控制台窗口中执行,并通过HTTP使用与Python版本相同的命令进行控制。

    贡献

    贡献是值得欢迎的!请随时提交合并请求。

概览

名称与所有者bitcoinj/bitcoinj
主编程语言Java
编程语言Python (语言数: 3)
平台Docker, Linux, Mac, Windows
许可证Apache License 2.0
发布数50
最新版本名称v0.17-alpha4 (发布于 2024-04-29 20:16:18)
第一版名称v0.8 (发布于 2013-04-09 23:24:38)
创建于2013-11-19 04:33:23
推送于2024-05-08 20:46:48
最后一次提交2024-05-08 12:52:19
星数4.9k
关注者数304
派生数2.4k
提交数5k
已启用问题?
问题数1207
打开的问题数325
拉请求数346
打开的拉请求数131
关闭的拉请求数1667
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

Learn Blockchains by Building One

Build Status

This is the source code for my post on Building a Blockchain.

Installation

  1. Make sure Python 3.6+ is installed.
  2. Install pipenv.
$ pip install pipenv 
  1. Install requirements
$ pipenv install 
  1. Run the server:
    • $ pipenv run python blockchain.py
    • $ pipenv run python blockchain.py -p 5001
    • $ pipenv run python blockchain.py --port 5002

Docker

Another option for running this blockchain program is to use Docker. Follow the instructions below to create a local Docker container:

  1. Clone this repository
  2. Build the docker container
$ docker build -t blockchain .
  1. Run the container
$ docker run --rm -p 80:5000 blockchain
  1. To add more instances, vary the public port number before the colon:
$ docker run --rm -p 81:5000 blockchain
$ docker run --rm -p 82:5000 blockchain
$ docker run --rm -p 83:5000 blockchain

Installation (C# Implementation)

  1. Install a free copy of Visual Studio IDE (Community Edition):
    https://www.visualstudio.com/vs/

  2. Once installed, open the solution file (BlockChain.sln) using the File > Open > Project/Solution menu options within Visual Studio.

  3. From within the "Solution Explorer", right click the BlockChain.Console project and select the "Set As Startup Project" option.

  4. Click the "Start" button, or hit F5 to run. The program executes in a console window, and is controlled via HTTP with the same commands as the Python version.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

去到顶部