Example of creating a financial blockchain Using Embedded Python on IRIS Data Platform
Blockchain is a chain of blocks, where each block contains information from the previous block, this concept can be applied in many ways.
Block will be composed of: a datetime, index, content, hash and the hash of the previous block.
In this project the blocks are constructed by:
- index:
- block identification index in the chain
- timestamp:
- block creation datetime
- transactions:
- Financial transactions that are part of this block, represents the content of the block, you can change the structure by changing the dc.Blockchain.Blockchain classmethod newTransaction
- hash:
- the entire contents of the encrypted block
- nonce:
- value that the system finds by the mining process, changing the hash value when the block is generated.
- previousHash:
- hash of the previous block
Make sure you have git and Docker desktop installed.
Clone/git pull the repo into any local directory
$ git clone https://github.com/Davi-Massaru/blockchain_Iris_python.git
Open the terminal in this directory and run:
$ docker-compose build && docker-compose up -d
Run the endpoint curl http://localhost:52773/api/blockchain/ping to verify the connection to the server
After installing the application, you can access the end-points to better understand how it works
Returns the current state of blockchain
Add a new transaction to be computed in a block, and return which block the transaction will be added
Request Content:
{
"sender": "user 1",
"amount": 1.42,
"recipient": "user 2"
}
Start mining a new block that will be added to the chain, returns added block information
Returns block information, in the given index
You can better understand and track global content and transactions through the portal.
Access http://localhost:52773/csp/sys/exp/UtilExpGlobalView.csp?$ID2=GBlockchain&$NAMESPACE=USER&$NAMESPACE=USER to see all blockchain content.
Access http://localhost:52773/csp/sys/exp/UtilExpGlobalView.csp?$ID2=GTransactions&$NAMESPACE=USER&$NAMESPACE=USER to see all transactions made and in which blocks were mined






