Hyperledger Fabric as a data source in GeneXus

Unofficial Content
This documentation is valid for:

GeneXus adds the support of Hyperledger Fabric to facilitate cross-industry projects that require integration with an enterprise-grade blockchain.

That GeneXus adds Hyperledger to its supported Data Stores gives the developer the chance to create solutions that integrate to a blockchain as easily as to any other relational DBMS, Odata services and other data sources.

GeneXus generates the application with its services that connect to the middleware, and, to enforce business rules, also generates the smart contracts using chaincode.


Warning: The hyperledger for testing is down, so you will struggle beta testing this feature at this moment. We are working on creating new instances on AWS. Stay tuned..

First steps

1) Add HyperLedger as a Data Store

Go to Preferences > My Knowledge Base > My Version > My Environment > Data Stores > New Data Store > Service

Set properties

  • ServerName: <Server uri>
  • UserID: <Username>
  • User Password <Password>
  • Datastore Provider: HyperLedger
  • Chaincode Prefix: <Unique identifier of the entities of this KB / Environment in the Hyperledger installation>
  • Chaincode Postfix: <To help identify easily the entities of this KB / Environment in the Hyperledger installation>
  • Chaincode Case Sensitive: True|False

2)  Create a Transaction

   error("Customer Name must not be empty") if CustomerName.IsEmpty();


3) Define a DataView

You can defined it 'by hand' or make GeneXus define it. 
Right-click on the 'Customer' Transaction > Link to Service Data View. This will create the following dataview:

   Service with Properties {Name= BlockChainTest_customer, Use Externalname = Yes}

Properties of Customer_DV:
Associated Table = Customer
Datastore = HyperLedger (Service)
Note: GeneXus provides an Hyperledger instance for concept proofing. Refer to section 'POC settings' for more information.

4) Add Build Options


Go to GeneXus Menu > Build > Build Events

Set in the Post-build event command line:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe "{GenexusPath}\gxnet\gxbuildcc.msbuild" /property:GX_TARGET_PATH="{TargetFullPath}";GX_PROGRAM_DIR={GenexusPath}

or add msbuild.exe path (p.e.C:\Windows\Microsoft.NET\Framework\v4.0.30319) to PATH Environment Variable and set Post-build event command line to:

MSBuild.exe "{GenexusPath}\gxnet\gxbuildcc.msbuild" /property:GX_TARGET_PATH="{TargetFullPath}";GX_PROGRAM_DIR={GenexusPath}

POC settings

You may use these settings only for proof of concept purposes. Do not use it for any other purpose.
This instance is provided by http://powerledgers.com.

Server = "https://melisandre.ddns.net/api"
UserName= gxuser
UserPassword= domingo.menchaca.4096.fuxia
Chaincode prefix = <Autogenerated ID to uniquely identify your tests. If empty, put here a string that represents your company name  + your name so that you can be contacted>
Chaincode postfix = <Autogenerated ID to uniquely identify your tests. If empty, put here a string to not mix different test cases>
Chaincode Case Sensitive = True


Take into account that Blockchain is a key/value storage

  • It does not allow operations with Order clause
  • It allows filters and conditions on its primary key only

Temporary Limitations

  • Only .NET Generator supports this feature