项目作者: mattsches

项目描述 :
A PHP blockchain implementation for educational purposes.
高级语言: PHP
项目地址: git://github.com/mattsches/phplockchain.git
创建时间: 2018-02-19T16:12:21Z
项目社区:https://github.com/mattsches/phplockchain

开源协议:

下载


phplockchain - A Blockchain in PHP

I implemented this blockchain to better understand the blockchain technology. This program is intended for educational and learning purposes, not for use in production environments!

The intention was to keep the structure of the project simple in order to facilitate learning and understanding what is happening in a blockchain.

Installation

Check out this repository and install the dependencies using composer:

  1. $ git clone https://github.com/mattsches/phplockchain.git .
  2. $ cd phplockchain
  3. $ composer install

Usage

To start a (master) node, open a terminal and run

  1. $ php src/node.php -p 5001 -d 4 -m

where -p is the port number, -d the difficulty (4 is default, be careful not to set it too high), and -m means it’s the master node. Ommitting -m means running as a regular node without a copy of the blockchain currently.

You can then send requests to the node through its API using Postman, CURL, or your favorite tool.

TODO: Add API docs.

Contributing

If you find an error in my blockchain implementation, please report an issue or open a pull request.

If you think any part of the program can be simplified or changed so it will be easier to comprehend, don’t hesitate to offer your thoughts.

Todos

There are central concepts of a blockchain that have not been implemented here, but probably should be added; some of these are:

  • Validation of (the signature of) transactions
  • Broadcasting transactions to peer nodes
  • Broadcasting freshly mined block to peer nodes and negotiating consensus
  • Adding a browser GUI for interaction with the nodes

Acknowledgments

Inspired by and based on the following resources: