DEV Community 👩‍💻👨‍💻

Cover image for Two Types of SmartContracts
Tobias Nickel
Tobias Nickel

Posted on

Two Types of SmartContracts

For blockchain technologie and web3 it is today needed to use smartcontracts. today I want to discuss two greatly differences between smartcontracts.

  1. single process contract
  2. business rule contract

single pricess contracts:

On public blockchains such as eth one deployed smartcontract is meaned to represent one business process. they can be used to lock in some money(eth or a currency on that blockchain) and releqse it after some condition is met.

Single process contracts can also be used to reflect ownership of some property. To do so they store a reference to the propery(art, house, car, certificate...) and a reference to the owner. depending on the usecase, the ownership can be transfered or not or only under defined conditions.

business rule contracts

In private or consortium blockchains business rule contracts are used. Often these blockchain systems make a distinction of two data systems. First the blockchain itself, that is holding transactions in sequential order, that order can not be changed. And second a state database.

In hyperledger fabric, the state db is defined as a key value store, and in most cases implemented using couchdb. In sawtooth the data store is a custom merkle tree that is also used like a key value store.

The smartcontract in a business rule blockchain define the rules how a business is run. technically defining methods that will update the state database and apply rules for authentication and other validations.

implications

When learning about etherium smartcontracts, I often asked: how do I store all my data. and the answer is: you don't. One smartcontract only reflects one business process and hopefully that process is finite(has an end, even if it is far in the future). You might give the eth contract and its methods a meaningful name, but the true meaning comes from the application that is interacting witg that contract.

Business rule contracts can represent business processes and rules much better and more clear. however instead of defining the rules for once incident of a process, they describe the rules for the long run. This is making it much more important to reach consensus of the business rules/smartcontract. This is making it particular hard to stablish this kind of contract, not technically but organisatorial.

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.