StraitsX Academy

StraitsX Academy #4: What are smart contracts & how do they work?

August 12, 2022

Key takeaways

  • Smart contracts are self-executing codes when predetermined conditions are met
  • Smart contracts have real-world use-cases like in Decentralised Apps (dApps), supply chain, healthcare, financial services, and many others
  • Smart contracts on different blockchains use different programming languages - StraitsX stablecoins XSGD & XIDR use Scilla (ZRC) & Solidity (ETH) programming languages for their smart contracts
  • XSGD & XIDR smart contracts are open source

Smart contracts are the backbone of many blockchain networks. Here, we explore the what, how, and why of smart contracts. 

What is a smart contract & how do they work?

A smart contract is a self-executing programme with its terms and conditions written in code. The code automatically executes the terms of the agreement. The code is sent to an address on a blockchain as a transaction, where it is verified by that blockchain’s consensus mechanism. When the transaction has been recorded onto a block, the smart contract is deployed and cannot be modified.

What are the benefits of smart contracts?

Smart contracts carry many benefits:

  1. Speed and accuracy: Automation removes human error and processing times.
  2. Reduced costs: Middlemen are not required to handle the transactions, reducing costs.
  3. Transparency: Transactions on the blockchain cannot be altered and are publicly visible. 
  4. Trustless: Smart contracts removes the need to trust intermediaries, reducing risk.

How do smart contracts bring value to the user compared to traditional contracts?

Traditional contracts rely on trusting intermediaries, where users have to conduct due diligence. They also take a long time to process and potentially come with a lot of hidden costs and other risks, such as arbitration, enforcement, and fraud. These processes are carried out by humans, who may be inevitably prone to error and add a lot of variability. Smart contracts remove these variabilities and process the code in a deterministic manner.

What are some use-cases of smart contracts?

Decentralised Apps (dApps)

Multiple smart contracts that interact with each other make up the backbone of decentralised apps, or dApps. Some examples of dApps that leverage smart contracts are DeFi apps that let you swap between digital assets or stake and provide liquidity to current stablecoin pools, NFT marketplaces where users can mint, buy, or sell NFTs without a third-party clearing agent, or blockchain games where players own their items, in-game payment rails are settled with stablecoins, gamers can play-to-earn by completing in-game activities.

Supply chain

Smart contracts can make supply chain management more efficient by automating processes like collecting payments, enforcing contract terms, managing inventory, logistical planning, as well as issuing and verifying purchase orders. 


Using smart contracts in healthcare can ensure data privacy, cross-institutional visibility, and auditability.

Financial Services

Within insurance, smart contracts can remove inconsistencies and fraud when assessing claims, filing paperwork, and processing payments. In financial markets, traders can enjoy faster transaction times, lower processing fees, and potentially better FX rates via stablecoins. Smart contracts can potentially increase cash flow in payments by making the payment experience more consistent whilst keeping offline payments capabilities.  

Stablecoin smart contracts

There are lots of use-cases for the XSGD and XIDR smart contracts, such as regional settlements and seamless transactions. Read more in this article within the Insights content series.

What are the different smart contract languages?

Scilla (Zilliqa, ZRC-2) 

StraitsX’s XIDR and XSGD smart contracts on the Zilliqa (ZRC) blockchain are written in the Scilla programming language. It provides enhanced security, scalability and tractability. Transactions on the Zilliqa platform take around 40 seconds.

Solidity (Ethereum, ERC-20)

StraitsX has ERC-20 versions of the XIDR and XSGD smart contracts to increase the tokens’ interoperability and scaling. Transactions on the Ethereum platform take about 6 minutes.

Are StraitsX XSGD & XIDR smart contracts open source?

Yes. XSGD and XIDR smart contracts may be viewed and adapted via the Developer docs on StraitsX or on third-party blockchain ledgers like Etherscan or Viewblock:

Etherscan (ERC-20) (ZRC-2)

How do I get XSGD & XIDR stablecoins?

StraitsX is committed to communicating the benefits of stablecoins. Get, mint, swap, and redeem with XSGD and XIDR with other stablecoins within the StraitsX Ecosystem and our DeFi partners.

  1. Sign up for a StraitsX Personal Account or StraitsX Business Account.
  2. Upload the required documents to verify your identity.
  3. Make a Transfer In from your bank account to get XSGD or XIDR.
  4. Create your own non-custodial wallet with our partners to Transfer Out your XSGD or XIDR
  5. Transfer Out your XSGD or XIDR to one of our DeFi partners: DFX, Uniswap, and Zilswap to put your XSGD or XIDR to use.
  6. Swap your XSGD or XIDR on DFX, Uniswap, and Zilswap to redeem various other stablecoins such as USDC, EURS, and more.
  7. Alternatively, pool your XSGD or XIDR to reap attractive yields with low slippages.

Note: If you are a high net worth individual, or institution, you can take advantage of StraitsX’s OTC Desk feature that offers deep liquidity and OTC block trades.

StraitsX and our DeFi partners are specially catered to our Indonesian and Singaporean users with our native support of XSGD and XIDR. This allows our regional investors to trade in their home currency to minimise transaction fees and slippages, instead of, traditionally, with the US Dollar (USD) that carries conversion fees.

Ready to get started?

Get, mint, and redeem StraitsX stablecoins, manage payments, view transactions, and more.