Modeling a mudaraba smart contract

2020 Update

Enter Flint

Basics of Mudaraba

  • If the investment loses money, the loss is split proportionally to the initial investment. It’s easy to remember by thinking what would happen in a 100% loss.
  • If the investment is profitable, those profits are split according to an agreed ratio. Lenders will incentivize the business owner, and compete with each other, by offering a greater share of profits. For example, a 80–20 partnership may agree to split profits 70–30. In any case, the success of the investment depends on reliable accounting, which typically involves more overhead and complexity (potentially another crypto solution?).
  • Unlike other types of musharaka, a mudaraba lender is typically a “silent partner” and not deeply involved in business decisions.
  • There are additional rules about adjusting the profit ratio and mutual decisions to end the contract, but I don’t want to code everything at once. For this example, we have a fixed profit ratio and either side can end the contract at any time.

Initial structure

What anyone can do

  • if the owner does not invest satisfactory funds or takes time to invest for some reason, the bank can delay calling start() of the contract, or cancel().
  • if the bank does not set the promised profit ratio, or invest satisfactory funds, the owner can cancel() or not move funds into the contract

What business owners can do

What banks can do

The contract closing function

Compiling the contract




Web->ML developer and mapmaker.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Community Voting for Squid NFT World V2.0 | Optimisation of the Biswap GameFi Economy

Liquidity Pools, Staking & Spot Prices

How FTX is making investing in crypto derivatives institutional-grade

NFT Market Update — Week Ending February 4th, 2022

Introducing Zappy

Earn a maximum on your EURS: Get triple-digit APY on crypto euro!

EverRise AMA Recap with CertiK


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nick Doiron

Nick Doiron

Web->ML developer and mapmaker.

More from Medium

GNNs to Detect Smart Contract Vulnerabilities

Blockchain Account Models: Accounting vs UTXO Models

Modeling blockchains as a Deterministic Finite Automata

Using Chainlink to interface with Neo4j from within an Ethereum Smart Contract