Event Driven Blockchain Applications on Salesforce

There were a few months where we really struggled to design our applications for the Hyperledger Fabric protocol. We found difficulty scripting transactional state changes though we managed to create the infrastructure layer using a Linux VM and docker containers for the different network nodes. We thought now we have this network running; we can begin to build out different vertical applications. However, we didn’t realize we were to low level into the protocol layer when designing the UX for Salesforce users. There needed to be an abstraction level, we needed to understand and stand up the infrastructure; but ultimately the application development layer was we wanted to build upon.

Hyperledger Fabric is a distributed consensus transactional state machine. It is robust, modular blockchain infrastructure. It is a peer-to-peer permissioned transactional database; it takes an ordered series of messages that are deemed valid and invalid and distributes state changes to the nodes on the network. The Hyperledger Infrastructure runs in a Virtual Machine that is operated by Dapps.ai. We have the latest fabric v1.0 docker images running in a private virtual machine with 16GB of Memory. We use a C3 Large on AWS equivalent on Azure or IBM. Hyperledger Business Networks can be thought of as two layers; the application layer and the infrastructure layer. The application layer tool set we leveraged:

Hyperledger Composer

How can we build a product that completely integrates the Hyperledger Fabric blockchain data and the Salesforce data using a multitenant node server and ordering service in a VM? It will be an entire new ecosystem based on event driven applications and the infrastructure will be run by users of the many different technology stacks.

Hyperledger Fabric and Composer enables enterprise to build applications that are permissioned and scalable. Dapps.ai enables companies that run their business on the Salesforce platform to leverage this blockchain infrastructure, abstraction layer; and combine it with their existing customer data, event driven workflows, and other third party applications.

Again, the goal is to build an object model to persist the data and an interface that enables Salesforce Customers to quickly build and deploy Business Networks that are tightly integrated with their existing customer data, third party applications and other proprietary business processes. When deploying state changes to the network these changes are updated across every peers state. The data is also persisted in Salesforce as well in the Dapps.ai objects.

Salesforce Event Driven Architecture

The discovery we made was that by building the application layer on the Salesforce platform, we could leverage the event driven architecture that Salesforce and Hyperledger Fabric blockchain share.

Hyperledger Fabric Composer Network Events and the Salesforce Enterprise Messaging Platform Event is a powerful combination for creating distributed applications networks.

We can now connect the Fabric distributed ledger to various business processes in the Salesforce platform. Ideally we can build a type of Asset transformation in that we take the asset as it stands today, a record in a database, simply allowing a system to see which as assets are owned by which accounts; and we can now unlock/transfer/control/distribute/return/upgrade/provision the asset.  By enabling an asset to be digitized and used on a Business Network the state changes that happen for the asset on the ledger are propagated to other participants on the network and to the Salesforce platform using the event system.




We are simply building out Enterprise Transaction Networks to digitally transfer value assets.

We have a fault tolerant consensus driven transaction ledger that multiple parties can operate on. We want companies to be able to use their existing customer and machine data when leveraging these networks. We want it to create a business graph. Similar to google but specifically between parties that are all operating against the same data. We want to create a permissioned business transactional system that enables companies to model and integrated business applications. The state updates that are made on the network need to be reflected in Salesforce as well, this is where users are. The users don’t need to know about the infrastructure level. They care about assets, they care about the participants in the network that are now in a market.

Blockchains turn networks into markets

There is a distributed consensus to all of this.  A distributed state machine ledger that can be used in conjunction with existing customer data in addition to other third party applications. How do we connect and update state from salesforce to a Hyperledger network? How do we ensure that all of the parties that are using the network have the same data? How can we ensure that the assets being exchanged the global state of the assets have been agreed upon?

We need an asynchronous event system.

We need to create Platform Events that are subscribed to state changes at the emit event transactional level of the Fabric Composer REST service.

The Hyperledger Blockchain Application Management Suite addresses these questions: We are developing an application suite that enables a developer to model and create assets, participants and script logic leveraging Fabric Composer. The application development process is built into the Salesforce Lightning Experience. Testing and deploying these types of assets on the ledger (therefore emitting events) are also then created in corresponding objects in the Dapps.ai managed package. Any state changes (CRUD) that happen are registered as Business Network Events and these events can be used in other business processes and applications.

Event Processing and Distributed Event Systems.

Salesforce provides the platform event that we can link to the blockchain network. We call these Business Network Events and the object is Business_Network_Event__e. We use this type of object as a asynchronous messaging system from the blockchain network to Salesforce clients. This becomes a message broker and it comes with many advantages when distributing state or network status update. One message from the network can be sent to several recipients because it logically decouples the sender from the recipient (the send just published messages and doesn’t care who consumes them). This message broker can automatically delivered messages to a process that has crashed as well and thus prevent messages from being lost is a recipient is unavailable or overloaded.


This essentially means that the various participants in the business network can listen to the same event and carry out actions knowing that endorse and verifies by the peers in the network. This is different then Ethereum which takes a distributed actor framework approach.

The advantage to having a Business Network event driven architecture is that multiple participants that are on the network can subscribe from various clients and receive asynchronous messages with regards to the current state of the permissioned and trusted transaction network. 

How could I better serve my customers if there was a tangible layer of cryptographic trust we operated on? What types of value added services can I bring to my customers with this technology? What if this cryptographic trust transaction layer existed across all of my lines of business?

We can then subscribe to these notifications inside of Salesforce and use the Platform Events Framework as an asynchronous processing system that can leverage distributed verifiable committed transactions and state changes from the shared ledger. Salesforce is the platform and Dapps.ai is the application provider of trusted, distributed application specific networks.

The model the we will create is working with companies to define a minimum viable network. Node.js applications can subscribe to events from a business network by using the composer client. BusinessNetworkConnection.on API call. Events are defined in the business network model file and are emitted by specified transactions in the transaction processor function file.

Before an application can subscribe to events, you must have defined some events and the transactions which will emit them. Salesforce is the subscriber. Fabric-Composer is Publisher; to the Event Bus where Salesforce gets pinged. The application will now receive all of the events emitted by the business network, and it’s up to the application to choose to what extent those events are integrated.

We can then write after insert triggers or business processes on the Salesforce Platform that listen for events that are being published by Hyperledger. By connecting these two event systems we can enable companies to quickly develop applications that are powered by the Salesforce platform and directly integrated with a distributed blockchain network.

Enterprise Blockchain Application Management

The Dapps.ai Blockchain Application Management enables organizations to build, deploy and manage blockchain technology applications on the Salesforce platform.

One may ask, why would a company build a blockchain application on the Salesforce platform? What are some of the use cases?

Isn’t this a peer-to-peer decentralized currency, requiring cryptoeconomic incentivized investment in application specific integrated chips to perpetuate a distributed ledger that creates a global transactional/state consensus protocol? What types of advantages are there to using a global singleton computational machine where data is public and state transitions are expensive and relatively slow? What types of use cases could you even build upon using permissioned networks that have fault tolerant consensus algorithms versus just using a distributed key value database like Cassandra or Raft?

The question I ask myself is:

How will this technology change the way that Salesforce’s customers interact with their customers?

It is critical to identify your Key Performance Indicators (KPIs), create a Business Case, define your companies quarterly outcomes, establish key stakeholders across your lines of business. But again I ask myself,

How will this technology change the way that Salesforce interacts with their customers?

This is and always will be the centric focus. The customer. The relationship.

There is without question the value of being able to have secure multi-tenant infrastructure, an unmatched enterprise application exchange, cloud based b2b e-commerce integrated solutions.

But again, the question remains:

How will this technology change the way that you interact with your customers?

Here is how:

In the enterprise software space business happens at the speed of trust.

Instead of thinking about specific killer app use cases you have read about for the past few years, I ask you to think about situations that require an augmented layer of trust. What type of processes are in place in my current platform; authentication mechanisms, digital signatures, escrow mechanisms, digital arbiters; all of these things can and will be replaced by applied cryptography, cryptoeconomics and public tokenized application networks.

With Blockchains, trust is a mathematical and verifiable certainty.

Bitcoin doesn’t care about anything but the applied cryptographic protocol rules and proof of work. One can trust that the cryptographic checks and balances in place are so secure and are radically disinterested, that any one participant can trust the protocol.

How could I better serve my customers if there was a tangible layer of cryptographic trust we operated on? What types of value added services can I bring to my customers with this technology? What if this cryptographic trust transaction layer existed across all of my lines of business?

How can we then manage all of these types of cryptographically trusted transactions, the members of these trusted transactions, the subsequent digital assets that are being created and traded across all of our customers? The Dapps.ai Blockchain Application Management suite has built tools to enable companies to build these types of trusted transactions networks and manage them on a single platform with all of your existing customer data.

Our enterprise-level application suite is built leveraging the native functionality that has been built into Salesforce over the past 18 years. We host and manage your Blockchain infrastructure such as nodes (providers) and peer containers. We support public, private, and permissioned networks and have multiple implementation architectures to best fit our customer needs.

The advantages of implementing your Blockchain technology application in Salesforce cannot be overstated. From an implementation standpoint this is where all of your customer data is and your existing application configurations. As an admin or developer there will be times when you need to use a transaction hash to create a Custom Formula Field button to piece together the right URL hack, when you will need to call the latest state of a variable in a Smart Contract from your Service Console, when you need to run a report and dashboard on all of the Smart Contracts and subsequent assets your Sales team has deployed that quarter.

By building our application suite on the platform we are able to effectively secure our customers data using natively built security features like Shield Platform Encryption. We are leveraging new features like Platform Events to push notifications on state changes in Smart Contracts or to let you know if an address has received tokens. We are creating Business Network events to let you know when a new asset has been created or transferred on your Fabric instance. We will leverage the power of Einstein Discovery to analyze blockchain data and Einstein Sentiment and Einstein Intent for use within blockchain bots.

By leveraging the Lightning Framework and event driven architecture, we have built a set of tools so that if you are a Salesforce developer or administrator you can quickly build Blockchain applications and seamlessly integrate them with your other third party applications. You can manage all of that data is being created on these decentralized networks in a well thought out data model, in an interface you know best.

Enterprise Blockchain applications need to be built with existing enterprise software investments in mind. A solution that is siloed from existing customer data and third party applications will never make it out of a POC or Pilot. Our data model lets companies successfully design and implement solutions that meet business requirements, are maintainable and scalable. We enable companies to create value added services for their customers, differentiate themselves from their competitors, and grow their business.

This solution set is built using the same platform features as other native applications, enabling Salesforce developers to quickly create workflows that can leverage the power of the blockchain and the data is called back to the platform. Native integrations with platform HSMs enable companies to efficiently and effectively authenticate trusted transactions between multiple parties. These types of trusted transactions enabled by blockchain technology happening across your entire organization can be managed from a single platform and combined with Machine Learning and AI built into the platform to create prescriptive and predictive recommendations to your users.

It is still very early in the Blockchain era, developments at the protocol level to address scaling and transaction throughput are still actively being worked on. As the infrastructure continues to improve, so will the application layer, the interfaces and tools we build to enable you to deploy smart contracts, the analytics and monitoring algorithms used to detect efficiencies.  We continue to research different ways to abstract away the infrastructure and bring down features from language into the user experience.

Business happens at the speed of trust, by enabling your company to transact in a more trusted manner with your customers and continue to build on the best-in-class enterprise software platform, we will learn and grow with you, listen to you and define that what is necessary to advance our product.

It is a very exciting time to be in the Blockchain technology space; we are seeing the birth of a whole new range of network effects before our eyes. We are excited to be with you on this journey to provide the most in depth analysis, subject matter expertise and commitment when it comes to developing and deploying your enterprise blockchain application.

Hyperledger Fabric v1.0

At Mobile World Congress, I was convinced that Hyperledger was the next POC we would work on. I had the opportunity to see a demo from Ericsson built on Fabric, I spoke with a cyber security company working specifically with this protocol and had a few other conversations about the rapidly growing number of projects being built.

I never gave Hyperledger much of a look until then and the past month I have completely dived in to the platform architecture as we built out our second POC. I was surprised to see the mechanisms and technology under the hood that are put in place to drive state changes and I have become convinced this will be a huge open source project in the enterprise blockchain technology space. With over 100 members and growing, the fastest Linux Foundation project to date is undoubtedly going to be the platform of choice for a number of companies around the world.

Like I said, prior to the conference, I had never really had any interest in Hyperledger; I never looked at Chaincode, didn’t try and spin a quick app up; it just seemed bland, boring, clanky, status quo, and not really something that would catch on in the crypto space.

Well I will tell you, enterprise companies that are going to invest millions into replacing antiquated production level systems feel comfortable will bland, boring, and modularly built on the shoulders of giants (LevelDB, CouchDB, RocksDB) when it comes to reinventing their business, reducing risks, and creating new efficiencies.

With that said, Hyperledger was not as easy to get up and running. It is not quite the same experience you often find cloning and spinning up a quick node app. It incorporates other computer science disciplines such as containers and virtualization (Docker), versioned key-value stores and distributed databases, setting up and using GO, while still being able reason and design the transaction endorsement policy for a given business case.

It is built on these types of technologies in order to create a peer-to-peer permissioned transactional system that sets and propogates state.

Fabric v1.0

Hyperledger Fabric’s v1.0 architecture has been designed to address two vital enterprise-grade requirements – security and scalability. Businesses and organizations can leverage this new architecture to execute confidential transactions on networks with shared or common assets – e.g. supply chain, FOREX market, healthcare, etc.

Fabric creates a transaction lifecycle where peers authenticate, propose, endorse, order, validate and commit transactions to the blocks. The valid and invalid are included in a block that refers to the hash of the previous block giving a world state of the entities represented and shared by each peer.

There are three different types of Peers:

Committer Peers: commits transactions, maintains ledger and state

Endorsing Peers: receives a transaction proposal for endorsement, responds granting or denying endorsement

Ordering Peers: approves the inclusion of blocks into the ledger and communicates with peer and endorsing peer nodes

Hyperledger Fabric also has a number of different concepts around certificates and certificate authorities, different Channels and Participants (joined peers) of the various Channels with declarative permissions to read certain data, Orderers and Orderering Services that don’t necessarily read the details of a transaction but will order them chronologically by channel (and ensure other things like agreement, deduplication, liveness) and ultimately key value sets that peers have agreed upon are written to a database. This is done programatically via Chaincode (written in Go / Java) which is deployed, invoked, and queried by peers on the network.

It is also important to note the Hyperledger Fabric has HSM (Hardware Security Module) support which is vital for safeguarding and managing digital keys for strong authentication. Hyperledger Fabric provides modified and unmodified PKCS11 for key generation, which supports cases like identity management that need more protection.

The Fabric Node SDK has two primary libraries fabric-client and fabric-ca-client; both of which we are using to integrate with Salesforce. The SDK also has an event system that enables applications to subscribe to Peers of the network and listen for Block, Chaincode, and Transaction Events.

There are a number of other Hyperledger projects such as:

What is Blockchain Application Management?

Blockchain Application Management is a software suite built to efficiently and effectively build, deploy, and manage enterprise blockchain applications. Using a multi-blockchain, business outcomes based approach; Dapps.ai enables customers to unlock the transformative benefits of blockchain technology with services and solutions that seamlessly integrate into an organizations enterprise software, business processes and operational systems. Dapps.ai offers technology to build your blockchain applications on the Ethereum, Hyperledger, and Chain protocols and manage the various components of the network. These are elements such as: Accounts, Assets, Smart Contracts, Transactions, Oracles, Markets, Chains, Peers, Coins and Files.

Dapps.ai is helping your organization answer questions such as:

  • How can I have visibility into blockchain transactions that are happening across my organization?
  • How can my company manage the digital assets that are being created, swaped, issued, retired?
  • How can I manage who has read/write access to this data? Different role hierarchies? How can we add peers to the particular network?
  • How can my company manage the certificates needed to authenticate and enroll users in these systems?
  • How can I manage administrative task such as configuring ordering services and determining endorsement policies?
  • How can my company manage the smart contracts that are being written by developers and used by members of my organization? Where can we store these contracts? How can we standardized the process of deploying them? How can we renew a smart contract once on the blockchain? Terminate one?
  • How can we issue tokens to members of our organization? What types of permissions are in place to guarantee security and due diligence?
  • How can we integrate with Hardware Security Modules in production level systems?

But, we are also committed to your specific business questions:

  • What outcomes are we trying to achieve by using blockchain technology?
  • Which blockchain platform should we choose to build on? Complete general computation singleton, permissioned, private ledger, cloud BaaS?
  • How are we going to pay for the transactions on the network? How do we handle volatility?
  • How do we manage the lifecycle of the chain? Standup, Load, Training, Bootstrap, Recover, Archive, Rolloff, and Teardown
  • Where does this fall in our budget? What is the timeline to production?
  • What technical investments are we going to need to make? Which programming languages and skillsets are required?
  • How can I incorporate this into my current business processes, workflows, and platform investments? Which legacy and cloud systems will this augment or replace?
  • How can we report on the data being created on these networks?

Dapps.ai is built on Salesforce, the Customer Success Platform. Business happens at the speed of trust; our solutions enable companies to transact in a globally distributed, consensus driven and transparent way.