JavaScript smart contracts
Bloqly engine is responsible for validating and storing states of documents. Each document state change is represented by new value
property of a transaction.
It is possible that a bad client can create a transaction which doesn't respect the typical state diagram of a document.
For example, let's imagine there is a document, representing a child enrollment form in a school. It can be in statuses 'RECEIVED', 'IN_PROGRESS', 'CONFIRMED', 'REJECTED'.
Without blockchain validating these statuses, it is possible to create 'CONFIRMED' status right away.
In order to address this issue, Bloqly introduces state-free functional smart contracts which can be written in JavaScript and other scripting languages (Python, Ruby etc).
Smart contract code representing the provided example:
Method confirm
is called each time new transaction received. In the case it returns false
, no data will be stored in blockchain.
Last updated