{"id":19903207,"url":"https://github.com/nethereum/nethereumazurequorumsample","last_synced_at":"2025-07-22T09:32:33.540Z","repository":{"id":89828970,"uuid":"185193184","full_name":"Nethereum/NethereumAzureQuorumSample","owner":"Nethereum","description":"A sample of integrating with the Azure Blockchain Service Quorum ","archived":false,"fork":false,"pushed_at":"2019-05-06T17:15:19.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-28T08:48:48.502Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nethereum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-06T12:34:01.000Z","updated_at":"2019-05-06T17:15:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"c8eb0c0c-bf35-4b2a-b95b-714837174c84","html_url":"https://github.com/Nethereum/NethereumAzureQuorumSample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Nethereum/NethereumAzureQuorumSample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nethereum%2FNethereumAzureQuorumSample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nethereum%2FNethereumAzureQuorumSample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nethereum%2FNethereumAzureQuorumSample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nethereum%2FNethereumAzureQuorumSample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nethereum","download_url":"https://codeload.github.com/Nethereum/NethereumAzureQuorumSample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nethereum%2FNethereumAzureQuorumSample/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266465210,"owners_count":23933086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T20:22:30.735Z","updated_at":"2025-07-22T09:32:33.492Z","avatar_url":"https://github.com/Nethereum.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nethereum Azure Quorum Sample\n\nA sample demonstrating how to integrate with the Azure Blockchain Service and Quorum.\n\nFor the sake of simplicity, this sample uses the Standard Token Library Service, you can generate the same service using one of Nethereum Code generators using VsCode, Console, web ui etc.\nFor more info: https://nethereum.readthedocs.io/en/latest/nethereum-code-generation/\n\n## Interacting with Quorum \nIt is assumed you have already set up validator nodes and transaction nodes.\n\n### Web3 setup and authentication\n\n### Url basic authentication\n\nBasic user/password authentication can be used by including the user name and password in the Url:\n\n```https://\u003cusername\u003e:\u003cpassword\u003e@juanmemberq1.blockchain.azure.com:3200```\n\nTo create a read only instance of Web3 you will need to do just the following:\n\n```csharp\nvar web3 = new Web3(\"https://juanmemberq1:p455word@juanmemberq1.blockchain.azure.com:3200\");\nvar blockNumber = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync();\n```\n### Token based authentication\nAccess token authentication will use the following format:\n```https://juanmemberq1.blockchain.azure.com:3200/\u003ctoken\u003e```\n\nCreating a read only instance of Web3 will be as follows:\n\n```csharp\nvar web32 = new Nethereum.Web3.Web3(\"https://juanmemberq1.blockchain.azure.com:3200/QNSQSAAE_WoMyS06TPH8KVa2\");\nblockNumber = await web32.Eth.Blocks.GetBlockNumber.SendRequestAsync();\n```\n\n# Managed account and Contract interaction\n\nTo interact with the the Transaction node (sending transactions) you can create a Managed Account with transaction nodes address and password.\nYou can read more about Accounts here: https://nethereum.readthedocs.io/en/latest/accounts/\n\nIn this sample we create an instance of Web3 using a ManagedAccount address and password. \n\nLater on, we couple transactions that are executed using the ERC2O standard token service, one to deploy the smart contract, the other to transfer some tokens.\n\n\n```csharp\n  var managedAccount = new ManagedAccount(\"0xca1e76c9876e5ba1e7c307696a7ea48eb25eec8c\", \"p455word\");\n  var web3Managed = new Web3(managedAccount, \"https://juanmemberq1.blockchain.azure.com:3200/QNSQSAAE_WoMyS06TPH8KVa2\");\n  var balance = await web3Managed.Eth.GetBalance.SendRequestAsync(\"0xca1e76c9876e5ba1e7c307696a7ea48eb25eec8c\");\n\n  var service = await StandardTokenService.DeployContractAndGetServiceAsync(web3Managed, new EIP20Deployment()\n  {\n      InitialAmount = BigInteger.Parse(\"1000000000000000000000000\"),\n      DecimalUnits = 18,\n      TokenName = \"TEST\",\n      TokenSymbol = \"TST\"\n  });\n\n  var receipt = await service.TransferRequestAndWaitForReceiptAsync(\"0x12890d2cce102216644c59daE5baed380d84830c\", 10000000);\n```\nIn one single line we have deployed the service, using the EIP20Deployment message providing the constructor parameters for the Initial Amount, Decimal Units, TokeName and Symbol.\nThe constructor parameters are the same as the Solidity Smart Contract constructor parameters.\n```csharp\n  var service = await StandardTokenService.DeployContractAndGetServiceAsync(web3Managed, new EIP20Deployment()\n  {\n      InitialAmount = BigInteger.Parse(\"1000000000000000000000000\"),\n      DecimalUnits = 18,\n      TokenName = \"TEST\",\n      TokenSymbol = \"TST\"\n  });\n```\n\nThen we can make a Transfer transaction as follows:\n\n```csharp\nvar receipt = await service.TransferRequestAndWaitForReceiptAsync(\"0x12890d2cce102216644c59daE5baed380d84830c\", 10000000);\n```\nFor more information on how to interact with smart contracts check the document here: https://nethereum.readthedocs.io/en/latest/nethereum-smartcontrats-gettingstarted/\n\n## Account interaction\nTo interact using the Account Private key, we will use an Account instead of a Managed Account.\n\n```csharp\nvar web3MyAccount = new Web3(new Account(\"0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7\"), \"https://juanmemberq1.blockchain.azure.com:3200/QNSQSAAE_WoMyS06TPH8KVa2\");\nvar service2 = new StandardTokenService(web3MyAccount, service.ContractHandler.ContractAddress);\nvar receipt2 = await service2.TransferRequestAndWaitForReceiptAsync(\"0x12890d2cce102216644c59daE5baed380d84830d\", 10000);\nvar balanceMyAccount = await service2.BalanceOfQueryAsync(\"0x12890d2cce102216644c59daE5baed380d84830c\");\n```\n\nThe rest of the interactions are the same.\n\n### Full Sample\n```csharp\npublic class QuorumNormalTest\n    {\n        public async Task Run()\n        {\n            //Basic Authentication\n            var web3 = new Web3(\"https://juanmemberq1:p455word@juanmemberq1.blockchain.azure.com:3200\");\n            var blockNumber = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync();\n\n\n            //access keys\n            var web32 = new Nethereum.Web3.Web3(\"https://juanmemberq1.blockchain.azure.com:3200/QNSQSAAE_WoMyS06TPH8KVa2\");\n            blockNumber = await web32.Eth.Blocks.GetBlockNumber.SendRequestAsync();\n\n\n            //access keys websocket\n            var websocketClient =\n                new WebSocketClient((\"wss://juanmemberq1.blockchain.azure.com:3300/QNSQSAAE_WoMyS06TPH8KVa2\"));\n\n            var web3WebSocket = new Web3(websocketClient);\n            blockNumber = await web3WebSocket.Eth.Blocks.GetBlockNumber.SendRequestAsync();\n\n\n            //retrieving all accounts of the node\n            var accounts = await web3.Eth.Accounts.SendRequestAsync();\n\n            var managedAccount = new ManagedAccount(\"0xca1e76c9876e5ba1e7c307696a7ea48eb25eec8c\", \"p455word\");\n            var web3Managed = new Web3(managedAccount, \"https://juanmemberq1.blockchain.azure.com:3200/QNSQSAAE_WoMyS06TPH8KVa2\");\n            var balance = await web3Managed.Eth.GetBalance.SendRequestAsync(\"0xca1e76c9876e5ba1e7c307696a7ea48eb25eec8c\");\n          \n\n            var service = await StandardTokenService.DeployContractAndGetServiceAsync(web3Managed, new EIP20Deployment()\n            {\n                InitialAmount = BigInteger.Parse(\"1000000000000000000000000\"),\n                DecimalUnits = 18,\n                TokenName = \"TEST\",\n                TokenSymbol = \"TST\"\n            });\n\n            var receipt = await service.TransferRequestAndWaitForReceiptAsync(\"0x12890d2cce102216644c59daE5baed380d84830c\", 10000000);\n\n\n            var web3MyAccount = new Web3(new Account(\"0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7\"), \"https://juanmemberq1.blockchain.azure.com:3200/QNSQSAAE_WoMyS06TPH8KVa2\");\n            var service2 = new StandardTokenService(web3MyAccount, service.ContractHandler.ContractAddress);\n            var receipt2 = await service2.TransferRequestAndWaitForReceiptAsync(\"0x12890d2cce102216644c59daE5baed380d84830d\", 10000);\n            var balanceMyAccount = await service2.BalanceOfQueryAsync(\"0x12890d2cce102216644c59daE5baed380d84830c\");\n\n\n            var websocketClient2 =\n               new WebSocketClient(\"wss://juanmemberq1.blockchain.azure.com:3300/QNSQSAAE_WoMyS06TPH8KVa2\");\n\n            var web3WebSocket2 = new Web3(new Account(\"0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7\"), websocketClient);\n\n            var service3 = await StandardTokenService.DeployContractAndGetServiceAsync(web3WebSocket2, new EIP20Deployment()\n            {\n                InitialAmount = BigInteger.Parse(\"1000000000000000000000000\"),\n                DecimalUnits = 18,\n                TokenName = \"TEST\",\n                TokenSymbol = \"TST\"\n            });\n            var receipt3 = await service3.TransferRequestAndWaitForReceiptAsync(\"0x12890d2cce102216644c59daE5baed380d84830d\", 10000);\n            var balanceMyAccount2 = await service2.BalanceOfQueryAsync(\"0x12890d2cce102216644c59daE5baed380d84830c\");\n\n        }\n    }\n\n```\n\n## Interacting with Quorum in Private mode\nInteracting with Quorum in private mode requires the specialised Web3Quorum object. This can be found in the Nuget Nethereum.Quorum.\n\n### The Quorum account.\nThe QuorumAccount is a new type of Account which simplifies the interaction with smart contracts in Quorum private mode. In a similar way to the ManagedAccount or Account, it wil be created as follows:\n```csharp\nvar coinbaseNode1 = \"0x83e0ebe69d8758f9450425fa39ef08692e55340d\";\nvar uriWithAccessTokenNode1 = \"https://juanquorum1.blockchain.azure.com:3200/nNkcS8DyDSCLIC9oAoCw1orS\";\n\n//Initialising Web3Quorum with a custom QuorumAccount\nvar web3Private = new Web3Quorum(new QuorumAccount(coinbaseNode1), uriWithAccessTokenNode1);\n```\n\nThe Quorum Account does not accept a password as it requires to be Unlocked before sending a transaction.\n```csharp\n //Unlock account to enable access\n  var unlocked = await web3Private.Personal.UnlockAccount.SendRequestAsync(coinbaseNode1, \"P455word1?1234\", 30);\n```\n\n### The Private transaction and Private nodes\nTo make a private transaction we will setup the private nodes for our Quorum Web3 instance, these private nodes will be used for all the transactions made for Web3 until changed or removed.\n\n```csharp\n//Set the nodes to work in private mode for this web3 instance\n  web3Private.SetPrivateRequestParameters(new[] { \"LHTjKEqQPy6gbo4r9ouj8ztfbB+F7kWd9vosSmeQcEw=\", \"sXVr5ENaJeqAA8eTKm74f6epYTMcbsl8Ovp+Y8Q3dzA=\" });\n```\n## Interacting with a smart contract\nInteracting with the smart contract will now be the same as with any other smart contract, but now all the transactions, and smart contract interactions will only be visible to only those members in the list.\n\n```csharp\n//Deploying new ERC20 smart contract using the Standard token library service\n  var erc20service = await StandardTokenService.DeployContractAndGetServiceAsync(web3Private, new EIP20Deployment()\n  {\n      InitialAmount = BigInteger.Parse(\"1000000000000000000000000\"),\n      DecimalUnits = 18,\n      TokenName = \"TEST\",\n      TokenSymbol = \"TST\",\n  });\n\n  //After deploying the smart contract the owner \"coinbaseNode1\" will have a balance of 1000000000000000000000000\n  var balanceOwnerAccount = await erc20service.BalanceOfQueryAsync(coinbaseNode1);\n\n  //Transfering 10000\n  var transferReceipt = await erc20service.TransferRequestAndWaitForReceiptAsync(\"0xc45ed03295fdb5667206c4c18f88b41b4f035358\", 10000);\n\n```\n\n### Full Sample\n```csharp\n//The quorum account\n  var coinbaseNode1 = \"0x83e0ebe69d8758f9450425fa39ef08692e55340d\";\n  var uriWithAccessTokenNode1 = \"https://juanquorum1.blockchain.azure.com:3200/nNkcS8DyDSCLIC9oAoCw1orS\";\n\n  //Initialising Web3Quorum with a custom QuorumAccount\n  var web3Private = new Web3Quorum(new QuorumAccount(coinbaseNode1), uriWithAccessTokenNode1);\n\n  //Set the nodes to work in private mode for this web3 instance\n  web3Private.SetPrivateRequestParameters(new[] { \"LHTjKEqQPy6gbo4r9ouj8ztfbB+F7kWd9vosSmeQcEw=\", \"sXVr5ENaJeqAA8eTKm74f6epYTMcbsl8Ovp+Y8Q3dzA=\" });\n\n  //Unlock account to enable access\n  var unlocked = await web3Private.Personal.UnlockAccount.SendRequestAsync(coinbaseNode1, \"P455word1?1234\", 30);\n\n  //Deploying new ERC20 smart contract using the Standard token library service\n  var erc20service = await StandardTokenService.DeployContractAndGetServiceAsync(web3Private, new EIP20Deployment()\n  {\n      InitialAmount = BigInteger.Parse(\"1000000000000000000000000\"),\n      DecimalUnits = 18,\n      TokenName = \"TEST\",\n      TokenSymbol = \"TST\",\n  });\n\n  //After deploying the smart contract the owner \"coinbaseNode1\" will have a balance of 1000000000000000000000000\n  var balanceOwnerAccount = await erc20service.BalanceOfQueryAsync(coinbaseNode1);\n\n  //Transfering 10000\n  var transferReceipt = await erc20service.TransferRequestAndWaitForReceiptAsync(\"0xc45ed03295fdb5667206c4c18f88b41b4f035358\", 10000);\n\n  //Validate that we get the new balance\n  var balanceOwnerAfterTransfer = await erc20service.BalanceOfQueryAsync(coinbaseNode1);\n  var balanceReceiverAccount = await erc20service.BalanceOfQueryAsync(\"0xc45ed03295fdb5667206c4c18f88b41b4f035358\");\n\n  //Create a web3 instance in a different node not included in the Private list\n  var web3NoAccess = new Web3(\"https://juanquorum3-juanquorum1.blockchain.azure.com:3200/ekgKWCEhxcq6d_HH3N10g9W0\");\n\n  //initialising a new StardandTokenService with the same contract address\n  var erc20noAccess = new StandardTokenService(web3NoAccess, erc20service.ContractHandler.ContractAddress);\n  //validate we don't receive any amount\n  var balanceOwnerAccountNoAccess = await erc20noAccess.BalanceOfQueryAsync(coinbaseNode1);\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnethereum%2Fnethereumazurequorumsample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnethereum%2Fnethereumazurequorumsample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnethereum%2Fnethereumazurequorumsample/lists"}