|
2 | 2 | sidebar_position: 1
|
3 | 3 | ---
|
4 | 4 | # Environment Set Up
|
| 5 | + |
| 6 | +## [sCrypt](https://scrypt.io/) |
| 7 | + |
| 8 | +MVC smart contract development uses the sCrypt development suite. The sCrypt language is divided into two major versions. |
| 9 | + |
| 10 | +### [scrypt classic](https://scrypt-ide.readthedocs.io/en/latest/getting_started.html) |
| 11 | +Smart contracts are written in scrypt classic with contract source files ending in .scrypt. They are compiled to [bvm bytecode](https://en.bitcoin.it/wiki/Script#Constants) using scryptc, and instantiated, tested, and deployed on-chain using scryptlib. The official recommendation is to not use it anymore. |
| 12 | + |
| 13 | + |
| 14 | +### [scrypt](https://docs.scrypt.io/) |
| 15 | +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. |
| 16 | + |
| 17 | +- Log bvm runtime variables |
| 18 | +- Write only in TypeScript, facilitating front-end and back-end integration |
| 19 | +- Package as npm packages, facilitating contract reuse and distribution |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +### mvc contracts |
| 24 | + |
| 25 | +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. |
| 26 | +| Contract | Development Type | |
| 27 | +|---|---| |
| 28 | +| [token-core](https://github.com/mvc-labs/token-core) | scrypt classic | |
| 29 | +| [nft-core](https://github.com/mvc-labs/nft-core) | scrypt classic | |
| 30 | +| [mvcdao-core](https://github.com/mvc-labs/mvcdao-core) | scrypt classic | |
| 31 | +| [token-core-ts](https://github.com/xiangpengm/token-core-ts) | scrypt classic + scrypt | |
| 32 | + |
| 33 | +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](https://github.com/ds300/patch-package), as detailed below. |
| 34 | + |
| 35 | +## The First MVC sCrypt Contract Project |
| 36 | + |
| 37 | +### [Create a Project Using scrypt-cli](https://docs.scrypt.io/installation) |
| 38 | + |
| 39 | +```bash |
| 40 | +npx scrypt-cli project demo |
| 41 | +cd demo && npm i |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | +### Add Patch Command |
| 46 | + |
| 47 | +Add the patch command to package.json |
| 48 | + |
| 49 | +``` |
| 50 | +"patch": "sh -c \"$(curl -fsSL https://github.com/xiangpengm/token-core-ts/main/patches/patch_1.3.31.sh)\"" |
| 51 | +``` |
| 52 | + |
| 53 | + |
| 54 | +### Apply Patch |
| 55 | + |
| 56 | +```bash |
| 57 | +npm run patch |
| 58 | +``` |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +### Run scrypt-ts Local Tests |
| 63 | + |
| 64 | +```bash |
| 65 | +npm run test |
| 66 | +``` |
| 67 | + |
0 commit comments