Blog Article

Smart Contracts - Building the Blockchain

Frank Beil | Other | | Return|
Monday 13 February 2023

In a previous blog article, Blockchain was defined and the reasons why it is so useful in accounting systems was explored. Read it here if you missed it.

In this article we look at smart contracts, which are the software code for accounting and business transactions on the blockchain, that make the blockchain possible. The easiest way to think about smart contracts is they represent the accounting and business logic of any accounting transaction or event.

Smart Contracts - Building the Blockchain

A working definition of a Smart Contract is as follows: A smart contract is an electronic transaction protocol that executes the terms of a contract. The general objectives are to satisfy contractual conditions, generally between the buyer and seller, that minimizes or eliminates exceptions and the need for trusted intermediaries. Note that the concept is an unwavering execution of the rules of accounting and therefore can be trusted to record what was agreed upon by the parties to the contract without the need to arbitrate the outcomes of the contract.

The recording and reporting of accounting transactions into company ledgers by entity’s are governed by authoritative guidance from the relevant standard setting bodies. In the United States the standard setter is the Financial Accounting Standards Board (FASB) and for most of the rest of the world authoritative accounting guidance is promulgated by the International Financial Reporting Standards (IFRS). While there are some minor differences the standards for both the authoritative standard setters converge on most of the significant accounting standards.

Standards implementation into a company’s accounting ledgers implies a codification of the accounting rules (FASB & IFRS) of recording and reporting accounting transactions and events into the company’s accounting ledgers to produce a cohesive set of financial statements. Adherence to these "rules" assures the public that a set of financial statements as reported are both "true and fair". True in the sense that they have followed prescribed guidance for accurate reporting of financial transactions and fair is the sense that what is measured in representationally faithful to the nature of the accounting transaction. For example, since cash is denominated in a country’s currency and is recognized as a store of value, we can use a transactional cash equivalency to record the transaction amount, which is representationally faithful to the value received/paid by the parties in the accounts of record.

The presence of accounting rules, or prescribed ways of doing things, allows for the codification of these rules into software code that assures consistency of application of the rule and ensures compliance with the accounting standards as determined by the FASB and IFRS. The automation of accounting and financial tasks and activities in financial reporting is an accepted part of almost all companies or organizations and the use of smart contracts is merely an extension of the unending search for economic efficiencies through technologies.

Another perspective of a smart contract is that it represents a secure and unstoppable computer program via the software code representing an agreement that is automatically executable and enforceable. The smart contracts that reside on the blockchain are the result of accounting transactions between willing buyer and sellers that have agreed to the terms of the agreement. The agreement than takes the form of a contract which is then converted via software code to a smart contract by applying relevant accounting principles and practices that adhere to accounting standards. This process assures us that each transaction input results in the same outputs that is a reliable and most importantly accurate with the requirements (GAAP/IFRS) programmed in the software code.

To demonstrate the smart contract process we will use Ricardian Contracts[1] (appropriately named after the esteemed British Economist David Ricardo) which are used for payment systems. The strength of a Ricardian contract is that it is accepted by courts of law and computer software. Note as a technical clarification, some refer to a smart contract as the executable code and not the contract itself, for our purposes the difference is purely semantics. The contractual terms in the contract address the following:

  • Resides in a database
  • It is digitally signed
  • Is embedded with cryptographic keys
  • It carries unique identifiers

In the illustration below, the World of Law (Ricardo is renowned for his study of a country’s comparative advantage) includes the contractual terms between buyer and seller in machine readable form (software code). The World of Cryptography then contains a unique hash that identifies the contract and guarantees security on the Blockchain. The contract acceptor then, who is already a participant on the blockchain, then accepts the contract and attaches their own unique identifier with their cryptographic hash. The contract is then sequenced to the World of Accountancy and is entered as a block on the blockchain. The original contract serves as the genesis block and is appended by each subsequent transaction between the contractual parties.

The Oracle Problem

A limitation to the use of smart contracts is that they are unable to access external data because the Blockchain is a closed system and does not have the ability to access "real" world data. For example, a company needs to access security prices from recognized stock and bond exchanges in determining the fair value of the investments held in their portfolios. In this case, the smart contract that would automatically calculate that value and enter it on the blockchain for financial reporting purposes for the period under measurement, needs to access the external or real-world data in order to execute the contract.

In that case, the smart contract needs to access external data so that it can execute the accounting transaction. The solution is to use Oracles. An oracle is an interface that delivers data from an external source to the smart contracts. The oracle is a safe conduit of off-chain data into the smart contract and then on the blockchain.

To illustrate the process, refer to the diagram below.[2]

The use of Oracles then assures the company that the use of smart contracts can capture all relevant accounting data, both internal and external for the design and implementation of the Blockchain. Note that there are really no limits to the types of data that firms can request from oracles. Examples include market data for financial assets, weather information for any potential adverse developments, and telemetry. Telemetry is the Internet of Things (IoT).

The Oracle data flows and for any requested external data used in recording accounting transactions or events is illustrated below.[3]

The data integrity of smart contracts and the Blockchain is captured by the smart contract initiating the request to the Oracle, which then requests the data from the external source, with the added feature of the Oracle request attestation or authenticity of the external data source. The sequence then loops back to the Oracle and the smart contract to ensure the authenticity of the data.

The utilization of smart contracts as the essential building of blocks that are entered on the Blockchain provides a tamper resistant and immutable ledger or record of all transactions that are housed on the blockchain. The combination of codified authoritative accounting guidance for recording and reporting financial transaction and the design and implementation of the blockchain for firm’s provides an accurate, reliable and secure accounting system that exponentially improves economic decision-making for any company designing and building their accounting information systems using The Blockchain.

Author of this article, Frank Beil, expands on these concepts in our new course, Designing and Implementing Blockchain in Accounting Systems, available both virtually and face-to-face. Follow the respective links for more details.

[1] Mastering Blockchain Images, Packt , 2022[1]

[2] Mastering Blockchain, 4th Edition, Bashir, Imran, Packt Publishing, 2022

[3] Mastering Blockchain Images, Packt , 2022

About the Author

Related Articles

One Truth - How Blockchain Will Revolutionize Accounting and Finance

Organizations, both business and non-profits, are driven by data. The purpose of financial and busin...

Read More >

Stay Updated with IASeminars

Join 20,000+ other professionals on our global mailing list.