blockchain

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

Github stars Tracking Chart

通过构建一个学习区块链

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

安装

  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版本相同的命令进行控制。

    贡献

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

Overview

Name With Ownerbitcoinj/bitcoinj
Primary LanguageJava
Program languagePython (Language Count: 3)
PlatformDocker, Linux, Mac, Windows
License:Apache License 2.0
Release Count49
Last Release Namev0.17-alpha3 (Posted on 2023-12-20 17:51:52)
First Release Namev0.8 (Posted on 2013-04-09 23:24:38)
Created At2013-11-19 04:33:23
Pushed At2024-04-28 01:24:12
Last Commit At2024-04-27 15:28:28
Stargazers Count4.9k
Watchers Count306
Fork Count2.4k
Commits Count5k
Has Issues Enabled
Issues Count1203
Issue Open Count323
Pull Requests Count344
Pull Requests Open Count131
Pull Requests Close Count1660
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

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.

To the top