How to Turn Blockchain Smart Contract States into SQL Data With Azure Logic Apps

Post Date: 05/29/2019
feature image

Looking for ways to automate actions in Office 365? Register for our webinar “Go With the Flow! Easy Automation for Office 365 and SharePoint” today!


This past month has been filled with announcements from the Microsoft Blockchain team. For example, it’s recently been announced that blockchain data can now be easily posted into PostgreSQL and other database stores through Ethereum Logic apps.

Users who have wanted to take ledger information from smart contracts using events can now use Azure Logic Apps to handle events and transmit this data into a SQL database like PostgreSQL or MySQL. Thankfully, now this only requires one of the Ethereum Logic apps supplied by Microsoft in the Logic App Marketplace.

The Ethereum Logic App is connected to the user’s ledger, where the program monitors the user’s information for smart contract events. Once these smart contract events are scanned after a quick query of the contract state, the simple use an Azure function can pass this data into an SQL statement. This can then be pushed into a PostgreSQL database.

MySQL is processed with roughly the same flow, with slightly different trigger patterns that mildly affect the information that is presented. Instead of looking at contracts and contract emit events, users can look at critical data such as service buses or an event grid.

This severely simplifies the processes that users utilize when reviewing ledgers and other relevant contract information for increased speed, efficiency, and transparency. This opens the door to greater micromanagement abilities and more accessible information for relevant parties.

It’s common for users to use back-end systems that push data from messages into a service bus and expect other applications to take action on this. Though it’s optional, users can parse a bus message to classify whether the message is a priority or relevant (similar to PostgreSQL) where a simple query deploys a contract to the current state. This information is subsequently pushed as an SQL statement before being slid into a user’s MySQL database.

Looking for coverage of the recent Azure-related Blockchain announcements? Check out this post: Click To Tweet

One great program that’s recommended for these new tools is the Azure Blockchain Workbench due to its simple and user-friendly UI that makes it ideal for dealing with contracts. That said, any Ethereum-based RPC endpoint can be used to connect and monitor.

A great example of some of these useful new tools is the fact that a user now has the ability to transfer the responsibility of an asset. Once a user selects “Take Action” and then “Submit,” the responsibility will be applied almost immediately. After an action is submitted to a blockchain, it’s then mined and added to a user’s respective block. This information is then illustrated in the user’s interface.

This new tool allows for ease-of-access that drives organizational collaboration and transparency to a whole new level. Relevant contract information, assets, and ledgers can be easily viewable to each of the relevant parties through the blockchain. Additionally, responsibilities can then be much more easily delegated, allowing for another degree of efficient collaboration and transformation of information.

PostgreSQL vs. MySQL

With PostgreSQL, users can add rows based on relevant data like contact information or participating parties. Responsibility can be re-delegated to a new party through a few simple clicks, and many more useful tools are left to be discovered.

MySQL provides much of the same features and processes, albeit with a different database. MySQL offers various counter-parties and information, much like PostgreSQL does. MySQL also provides a continuous history of states, with a running record of what’s happening in real time. This provides an easy framework for heightened security, transparency of the flow of information, and the ability to micromanage to a degree that suits the user.

While the user is only required to mash a few simple buttons, in the background the Logic app flows are triggered where the user is notified for every event that occurs. This means that all the information is pushed to either PostgreSQL or MySQL. The coding and set-up are all laid out for those users interested in the more in-depth, technical perspective through the Blockchain Developer Kit on the GITHUB page below:


Want more Microsoft 365-related updates? Be sure to subscribe to our blog!

Share this blog

Subscribe to our blog

Fields with * are required