Publish Logic Apps data to SQL Database in Azure Blockchain Service

In this blog “Publish Logic Apps data to SQL Database in Azure Blockchain Service” you will learn how to use Ethereum Blockchain connector with Azure Logic Apps to perform smart contract actions and respond to smart contract events and store data into sql database, you will create HelloBlockchain smart contract and deploy on Azure Blockchain as Service.

Step-1 -Create Azure Blockchain as Service

Step-2 Fill details of node and consortium name ,Password .For development you may choose basic plan with 1 validator and 1 transaction node. Data is managed through transaction node which can be added later.

Step-3 After filling all details ,Click on review+create button then create. Now go resource group and click on created group you will be able to see consortium member.

Step-4 When you click on member name below details will be shown . Member account name will be helpful while integrating Logic app (Member account and node password which we entered will be use) .

Step-5 Click on transaction node and click on member name . Choose connection string Access Key1 and Access Key 2 is ethereum blockhain end point . We need to enter RPC end point when we are connecting logic app to ethereum blockchain connection.

Step-6 Let’s start installing extension for smart contract development and connectivity with Azure Blockchain Service to deploy.

Step-10 -Use the Build Contracts command to compile all the smart contracts in your project.

In the VS Code explorer sidebar, expand the contracts folder in your project.

Right-click HelloBlockchain.sol and choose Build Contracts from the menu.

Azure Blockchain Development Kit uses Truffle to compile the smart contracts.After building smart contract build folder will be created you can see HelloBlockchain.json file (contract ABI) . It contains all information related to contract.

It will ask to choose your Blockchain consortium network in the command palette.Choose existing blockchain consortium which we created earlier in step-4 .

It will ask to generate mnemonic ,mnemonic is helpful to retrieve an Ethereum private key for your blockchain member. Choose Generate mnemonic. Choose a filename and save the mnemonic file in the project folder. For example, myblockchainmember.env.

Azure Blockchain Development Kit uses Truffle to execute the migration script to deploy the contracts to the blockchain. After deploying contract on blockchain you will get contract address and account name which we deployed contract as given below.

Step-20 First we will trigger sendrequest logic app by passing request string to execute contract and in return it will return block hash address as response. That hash address response we will insert into database.

Note to make sure response data is inserting into database , we need enable interaction from database firewall settings otherwise it will not be allowed.

Step-21 Now we will trigger sendrequest function logic app , It will return state generated by sendrequest function by executing smart contract and return response.That response message we will insert into database.

Summary

In this blog Publish Logic Apps data to SQL Database in Azure Blockchain Service you have learnt how to use Ethereum Blockchain connector with Azure Logic Apps to perform smart contract actions and respond to smart contract events and store data into sql databaseIn, If you have any question related to Azure Blockchain service feel free to contact us

Asif specializes in Microsoft development, Blockchain, Mobile App and Cloud technologies. He works as Solution Architect at ABN AMRO Bank .He has delivered many sessions on Data and Application development across globe in technical communities .He is Certified Architect in Blockchain Development.He has successfully implemented solutions for Trade finance on Corda and Quorum Block chain.