Smart contracts are programs which have utility. In and of themselves, they are value-free and inherently neutral. From this perspective, the Shariah value assigned is of permissibility. The Islamic legal maxim states:
“Permissibility is the state of all things by default.” [al-ashbah Wal-Naza’ir]
Of course, there are certain exceptions to this rule in areas such as marriage, consumption and worship. However, in terms of transactions and transactional processes, the default is that all transactions are permissible by default unless there is evidence to suggest otherwise.
The specific contract considerations and sequences will vary from product to product, transaction to transaction, but it is assumed that the core contractual requirements for Shariah compliance such as offer (ijab) and acceptance (qabul) are either done prior to the entries on the blockchain or are executed via conduct through the inputs onto the blockchain. Both forms of execution are acceptable in Shariah. From this perspective, the blockchain and smart contract plays more of a clearing, settlement and delivery service. The smart contracts are somewhat of an escrow and a digital intermediary ensuring that the inputs are correct. These programs play the role of solicitors to an extent in ensuring all the inputs are accurately met; which then triggers the next output in a smart contract. This permits the settlement and ownership transfer of the underlying asset tokenised into the blockchain.
If the smart contract is a digital facilitator for the clearing, settlement and delivery of the tokenised asset, then prior to the smart contract execution, a buyer cannot trade the tokenised asset as that violates the principle of Shariah. Transacting in something prior to taking receipt physically, constructively or digitally is not valid as the risks associated with the asset are not all vested in you. Of course, the trading before settlement is not possible on the blockchain as a person will not have the asset registered with them. However, no such trade should occur in reality beyond the digital infrastructure of the blockchain.
The participation of a Muslim node as a miner to execute any non-Shariah compliant transaction is a contentious area. This can be argued to be falling within the facilitation of Shariah illegal and sinful activity. Simply updating a ledger and validating seems to be less of a Shariah risk as this is ex-post.
More detail: https://www.linkedin.com/pulse/how-smart-contracts-from-shariah-compliance-perspective-adam/