Environment Set Up

MVC smart contract development uses the sCrypt development suite. The sCrypt language is divided into two major versions.

Smart contracts are written in scrypt classic with contract source files ending in .scrypt. They are compiled to bvm bytecode using scryptc, and instantiated, tested, and deployed on-chain using scryptlib. The official recommendation is to not use it anymore.

Smart contracts are written in TypeScript with contract source files ending in .ts. The process involves scrypt-ts-transpiler transpiling .ts to .scrypt, scryptc compiling to bvm bytecode, and scrypt-ts instantiating, constructing transactions, testing contracts, and deploying them on-chain.

  • Log bvm runtime variables

  • Write only in TypeScript, facilitating front-end and back-end integration

  • Package as npm packages, facilitating contract reuse and distribution

mvc contracts

The mvc contracts were developed using scrypt classic as scrypt was not yet fully developed. Below are the development types and project addresses for several contracts.

ContractDevelopment Type

scrypt classic

scrypt classic

scrypt classic

scrypt classic + scrypt

The token-core-ts project translates MVC's original token and NFT contracts into scrypt, but the test cases still use scrypt classic, so the development type is a mix of both. Since the scrypt-ts library is primarily for BSV and cannot be directly used on the MVC chain, it is adapted for MVC using patch-package, as detailed below.

The First MVC sCrypt Contract Project

npx scrypt-cli project demo
cd demo && npm i

Add Patch Command

Add the patch command to package.json

"patch": "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/xiangpengm/token-core-ts/main/patches/patch_1.3.31.sh)\""

Apply Patch

npm run patch

Run scrypt-ts Local Tests

npm run test

Last updated