Home Applications blockchain - [ IRIS python ]

blockchain - [ IRIS python ]

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
1 reviews
IPM installs
Pull requests
Save your logs in a blockchain structure

What's new in this version

Save your logs in a blockchain structure

You can create a class that Extends dc.Persistent Long Abstract

After any change in the registry, it will be saved in ^GBlockchainLog(, )

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


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

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


Made with
1.0.104 Feb, 2023
Technology Example
Works with
InterSystems IRISInterSystems IRIS BI
First published
21 Feb, 2022
Last checked by moderator
27 Jun, 2023Works