Published in


ChainRunner Technical Report

What is ChainRunners?

What is ChainRunner?

1. ChainRunner Engine: A Hub for Users and Services

2. The Lightweight Architecture Built With F#

ChainRunner Software Stack
  • Blockchain Executor — communicates with blockchains to retrieve data (e.g. your Ethereum and Avalanche balance from your crypto-wallet)
  • Wallet Connector — requests your permission and signature to connect to your wallet(s)
  • Offchain Interactor — retrieves data anywhere but blockchains (e.g. Twitter feed, Instagram feed, weather information, etc.)

3. Taster: Language for Blockchain Services

  1. Determine the quantity of ETH to be used for liquidity supply
  2. Buy a BiFi token from SushiSwap
  3. Supply liquidity to the BiFi-WETH Pool in SushiSwap
  4. Deposit LP (SLP) token into BiFi Pooling. (LP tokens are given to the user to prove ownership of providing liquidity)
  1. You must import an account linked to a crypto wallet in order to make transactions. ChainRunner takes care of this Line 1. account variable now has a crypto wallet account linked to a user.
  2. Next you must know the smart contract of the token before purchase. Line 2 retrieves smart contract of “BiFi” token from the blockchain network.
  3. Swap function family provided by the SushiSwap contract require a token smart contract list to swap in Path array. We combine smart contracts of WETH and BiFi into an array in order to swap the two tokens.
  4. Slippage value is crucial for blockchain-based DeFi swaps. Slippage refers to cases where there is a change in market price between the time of the swap request and when the actual swap is processed. This could lead to losses for the traders because the transactions might be processed at undesired prices. This line sets a slippage limit to set the amount of BiFi that could be traded for WETH (amountIn).
  5. Import the decimals value of BiFi tokens from the blockchain network in order to calculate the transaction limit to prevent slippage.
  6. Obtain the base slippage rate in the same way. (0.5% for SushiSwap.)
  7. Based on the values obtained from steps 4~6, multiply the amount of WETH that could be traded with BiFi by the base slippage rate to set the transaction limit (amountOutMin). This reverts the transaction if the amount of BiFi that the user receives is less than the amountOutMin value.
  8. This value sets a deadline to self-terminate a transaction if it is put on hold for too long without being mined. Most DeFi protocols set this value with sufficient room to process most transactions for better service usability.
  9. Retrieve the wallet balance before the transaction to show the amount of BiFi received after the swap.
  10. Call SushiSwap’s swapExactETHForTokens() function (expressed as a function because it is a smart contract.) to swap WETH and BiFi.
  11. Retrieve the final balance after the transaction to check the amount of BiFi received.
  12. Return (current balance — balance before transaction).

ChainRunner Q

ChainRunner Q

Future of ChainRunners


Stay Connected



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