2017 © Pedro Peláez
 

library php-blockchain

Minimal working blockchain implemented in PHP

image

akondas/php-blockchain

Minimal working blockchain implemented in PHP

  • Thursday, March 15, 2018
  • by itcraftsmanpl
  • Repository
  • 3 Watchers
  • 18 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

Blockchain implementation in PHP

Minimum PHP Version Build License, (*1)

Clean code approach to blockchain technology. Learn blockchain by reading source code., (*2)

Roadmap

  • [x] Block structure and hashing
  • [x] Genesis block
  • [x] Storing and validate Blockchain
  • [x] Proof of Work with difficulty (missing consensus on the difficulty)
  • [X] Communicating with other nodes & controlling the node (based on ReactPHP)
  • [ ] Simple persistence layer
  • [ ] Going serverless with AWS Lambda (experiment)
  • [ ] Start working on KondasCoin akondas/coin :rocket: (Transactions, Wallet, Transaction relaying, Maybe some UI)

Node

To start the node:, (*3)

bin/node

Default web server port is 8080 but you can change it with --http-port param:, (*4)

bin/node --http-port=9090

Default p2p server port is 3030 but you can change it with --p2p-port param:, (*5)

bin/node --p2p-port=2020

API

To control node you can use simple (pseudo) REST API:, (*6)

[GET] /blocks Response (list of all blocks):, (*7)

[{"index":0,"hash":"8b31c9ec8c2df21968aca3edd2bda8fc77ed45b0b3bc8bc39fa27d5c795bc829","previousHash":"","createdAt":"2018-02-23 23:59:59","data":"PHP is awesome!","difficulty":0,"nonce":0}]

[POST] /mine Request (raw):, (*8)

Data to mine (any string).

Response (mined block):, (*9)

{"index":1,"hash":"a6eba6325a677802536337dc83268e524ffae5dc7db0950c98ff970846118f80","previousHash":"8b31c9ec8c2df21968aca3edd2bda8fc77ed45b0b3bc8bc39fa27d5c795bc829","createdAt":"2018-03-13 22:37:07","data":"Something goof","difficulty":0,"nonce":0}

[GET] /peers Response (list of all connected peers):, (*10)

[{"host":"127.0.0.1","port":3131}]

[POST] /peers/add Request (json with peer):, (*11)

{"host":"127.0.0.1", "port":"3131"}

Response: 204 (empty), (*12)

Tests

To run test suite:, (*13)

composer tests

Coding standards

Checkers and fixers are in coding-standard.neon. To run:, (*14)

composer fix-cs

License

php-blockchain is released under the MIT Licence. See the bundled LICENSE file for details., (*15)

Author

Arkadiusz Kondas (@ArkadiuszKondas), (*16)

The Versions

15/03 2018

dev-master

9999999-dev

Minimal working blockchain implemented in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arkadiusz Kondas

15/03 2018

0.1.0

0.1.0.0

Minimal working blockchain implemented in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arkadiusz Kondas