I am trying to create my own blockchain with my own transactions but there is not much information on how this works in detail. Basically I want to create a transaction with my own structure using blockchain. It is possible?
1 Answer
The reason why you are not finding many detailed resources about blockchain is because it is a new innovation and not widely understood. Most resources are scattered across blogs and code repositories. A few developer and programming guides are listed lower down.
The most valuable and primary resource is the Bitcoin Core client implementation - also called the Satoshi reference client.
It is possible to design and build a blockchain client from first principles. The design will require several components, and here are the basics:
- P2P networking - manage connections & send/receive messages and data
- a Messaging protocol - message and data format
- Database - store & retrieve block headers, blocks, transactions and previous spends (UTXOs)
- client Behavior logic - handle messages, protocol rules, coinbase rules, etc
- Consensus logic - gather, process and apply peer consensus about the validity of transactions, blocks and the unfolding chain
- Coin generation code - mining and proof-of-work (if any)
- general household code - logging, error handling, state maintenance, etc
That may seem daunting at first glance, but it is a worthwhile and achievable project.
Notice, that cryptography is not listed. This is because a private blockchain does not require secrets or obfuscation. However, if it is of interest, one can implement Bitcoin's Eliptic Curve library and address schema.
Before creating a blockchain client and protocol from first principles, it will be necessary to do some research about how the Bitcoin protocol works. Mastering Bitcoin by Andreas Antonopoulos provides good insight. Other resources of interest:
- https://bitcoin.org/en/developer-documentation
- This question has useful discussion and several pointers to learning resources.
Study how the reference client behaves, and read the reference client code, especially the file main.cpp - (linked to Core v0.13, since that file's code has been rationalized into separate files from v0.14 onwards)
Also, there are several open source libraries that allow you to run barebones blockchain nodes and exchange protocol messages. Some libraries are better than others:
- pychain - basic blockchain prototype
- PyCoin - a Python Bitcoin clone
- Zen System - encrypt everything blockchain featuring communications, transactions and a DAO.
-
Thank you so much for your answer! Actually the question would be: How can I create a private blockchain with my own transactions? Jun 25, 2017 at 17:36
-
Is there any way to create the private blockchain in Java language? Nov 23, 2017 at 7:41
-