Smart Contract Development Practices in the FAME Federated Data Markets

February 28, 2025

Smart Contracts in Federated Markets

In the FAME project, Trailblu (TRB) is working on development and upgrading of Ethereum smart contracts for the FAME federated data markets. Smart contracts are mission critical software since they store and manage:

  • Agreements that coordinate crowds of people and businesses.
  • Value in the form of crypto coins and tokens that represent owned valuable goods and services.

Failure or disruption of service of a mission critical software may mean heavy financial losses in the area of data markets. Hence, systematic development and testing practices need to be employed for building correctly functioning, secure, scalable, maintainable and sustainable smart contracts.

Trading history statistics

Development Practices in FAME

The FAME project employs several key development practices. The Popular Hardhat Ethereum development environment is used to facilitate automation of compilation, deployment, debugging and testing via scripts. Where possible standardized contracts and their implementations from OpenZeppelin are integrated through inheritance mechanisms.

Hardhat has a built-in testing environment and several contract tests are written using the Chai assertion library.  Ethereum blockchain is a pay to play system, that is, a fee expressed in gas units is charged for running the transactions on the Ethereum Virtual Machine.  To maintain scalability, gas costs should be small and increase gradually as the number of users and the sizes of internal contract data structures grow. Hence, utmost importance is paid to the use of data structures and operations with constant or slow growing gas costs.

Another key challenge in blockchain development is upgradability. Blockchain data stored and contracts deployed are immutable, meaning that once a contract is deployed, it cannot be changed. Therefore, if the contract needs to be upgraded to a new version, an upgrading problem is encountered. To resolve this, contracts in FAME are implemented using the EIP-2535 Upgradable contract standard.

Additional Testing Using Web Interfaces

In addition to testing contracts using Hardhat and Chai assertion library, contracts are further tested by using web user interfaces. An AI chatbot, like ChatGPT, generates a web page that inputs function parameters, makes queries to the blockchain, returns results as a JSON object. This allows testing contracts at a higher web user interface level.

The figure above shows testing of a recently developed API for retrieval of historical trades using ChatGPT generated web user interface. A user is able to choose a block or time interval and retrieve the array of asset trade transactions that are executed in the FAME market.

 

Author(s): Alper Sen and Can Ozturan

 

Subscribe to our newsletter for the latest updates, and follow FAME on LinkedIn and X to be part of the journey.

More info:
TRB