There is currently a lot of excitement around cryptocurrencies, with many making it rich and many more hoping to get rich quick. While speculating on cryptocurrencies is fun and (currently) profitable, cryptocurrencies are only part of the story of what makes this next technological innovation so ground-breaking.
At the heart of cryptocurrencies lies the concept of a blockchain, which, as the name implies, chains a number of blocks together, one after the other, with each block holding information whether transactions, smart contracts, data structures or anything else which needs to record something in an immutable way.
While revolutionary, the concept of the blockchain is quite simple; it is really just a linked list data structure. And it’s very easy to develop your own blockchain in pretty much any programming language you can think of.
Currently the implementation is very basic but it highlights the principles of a block chain; blocks can hold arbitrary data, are linked together via a blockchain and cannot be changed without corrupting the entire chain. I have also added basic mining to demonstrate the concept of proof-of-work.
Future developments on the PHP Blockchain roadmap might include:
- Distributed architecture
This is an open source project aimed at PHP programmers who wish to build a PHP-specific blockchain, so feel free to fork the code, make your own changes and contribute them back.
Some additional material for working with blockchains:
Python-focussed blockchain development with transaction and consensus coding examples.
Information about merkle trees which form the basis of transaction management.
The bitcoin code. While is C++ it is quite easy to follow the overall structure of a blockchain-based crypotcurrency.
CommentA great php project!
I will follow him.
Thanks for your interest. Yes, blockchain technology is an interesting topic and I am learning all the time.
Next steps will be to introduce transactions into each block.
Cool … I would like to learn more about blockchain php based …
Thank you for this kick start.
No problem. Hope it helps with your investigation into this interesting branch of computer science.
very user friendly code….thank you
This is fantastic. Thanks for the code. I have a question. I am still very new to blockchain. But where/how does P2P sharing of the blockchain happen? My understanding is what makes blockchain unique is there is no centralized location the chain is store and instead exact copies are shared P2P.
Correct? How does this work?
Thanks. A good question. I’m still working my way through the mechanisms of the blockchain. I have recently been working on UTXOs (unspent transaction outputs) which is a feature utilized in Bitcoin. I’m hoping I have a blog post explaining this concept in PHP soon. And, yes, you are correct; the distribution of nodes is one of the blockchain’s core strengths. Again, I’ll look at covering this in a future post, although I don’t have a lot of experience with developing P2P in PHP, so I’ll need some time to study up on the best way to approach this.
Thanks for your support.
Thanks for this awesome codes are you going to implement transactons in php ?
Yes absolutely! That is something I’m working on at the moment. I’m looking to implement a UTXO as well. Thanks for the positive feedback.
Hi, I would like to learn and work on blockchain PHP.
I hope this provides you with a primer on expanding your knowledge.
hi guys, i have created a new repo regarding build bitcoin with php mysql in https://github.com/atlaschiew/build-bitcoin-php-mysql