blockchain - [ IRIS python ]

Downloads15
Subscribe
0
Bookmark
0
This application is not supported by InterSystems Corporation. Please be notified that you use it at your own responsibility.
Details
Releases
Reviews
Issues

What's new in this version

Initial Release

blockchain IRIS - ( Embedded Python )

Example of creating a financial blockchain Using Embedded Python on IRIS Data Platform

What is a blockchain

Blockchain is a chain of blocks, where each block contains information from the previous block, this concept can be applied in many ways.

What is a blocks?

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:

  1. index:
    • block identification index in the chain
  2. timestamp:
    • block creation datetime
  3. 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
  4. hash:
    • the entire contents of the encrypted block
  5. nonce:
    • value that the system finds by the mining process, changing the hash value when the block is generated.
  6. previousHash:
    • hash of the previous block

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

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

Get Started

After installing the application, you can access the end-points to better understand how it works

  1. http://localhost:52773/api/blockchain/chain [ GET ]

Returns the current state of blockchain

Response sample:

  1. http://localhost:52773/api/blockchain/transactions/new [ POST ]

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"
}

Response sample:

  1. http://localhost:52773/api/blockchain/mine [ GET ]

Start mining a new block that will be added to the chain, returns added block information

Response sample:

  1. http://localhost:52773/api/blockchain/block/{index} [ GET ]

Returns block information, in the given index

Response sample:

Exploring the blockchain

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

References:

Rating
4.5 (1)
Category
Technology Example
Works with
InterSystems IRISInterSystems IRIS BI
Tags
Info
Version
1.0.0
Last updated
2022-02-21
Repository
Open
Documentation
Open
License
Link