Skip to content

Commit 468c349

Browse files
committed
add english version and fix img path
1 parent 67831cd commit 468c349

File tree

2 files changed

+69
-6
lines changed

2 files changed

+69
-6
lines changed

docs/contract/getting-started/environment-set-up.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,66 @@
22
sidebar_position: 1
33
---
44
# 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+
![Alt text](/img/scrypt-to-op.png)
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+
![Alt text](/img/scrypt-ts-to-op.png)
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+
![Alt text](/img/scrypt-init.png)
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+
![Alt text](/img/scrypt-add-patch.png)
53+
54+
### Apply Patch
55+
56+
```bash
57+
npm run patch
58+
```
59+
60+
![Alt text](/img/scrypt-run-patch.png)
61+
62+
### Run scrypt-ts Local Tests
63+
64+
```bash
65+
npm run test
66+
```
67+
![Alt text](/img/scrypt-run-test.png)

i18n/zh-CN/docusaurus-plugin-content-docs/current/contract/getting-started/environment-set-up.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MVC 智能合约开发使用 sCrypt 开发套件,sCrypt 开发语言分成两
1010

1111
### [scrypt classic](https://scrypt-ide.readthedocs.io/en/latest/getting_started.html)
1212
使用scrypt classic编写智能合约,合约源文件以.scrypt结尾,使用 scryptc 编译为 [bvm 字节码](https://en.bitcoin.it/wiki/Script#Constants),scryptlib实例化合约、构造交易、测试合约、部署上链。目前官方已不建议使用。
13-
![Alt text](../../../../../../static/img/scrypt-to-op.png)
13+
![Alt text](/img/scrypt-to-op.png)
1414

1515
### [scrypt](https://docs.scrypt.io/)
1616
使用 TypeScript 来编写智能合约,合约源文件以.ts结尾,具体流程为scrypt-ts-transpiler 转义 .ts 为.scrypt, scryptc 编译为 bvm 字节码,最后用scrypt-ts 实例化合约、构造交易、测试合约、部署上链。
@@ -19,7 +19,7 @@ MVC 智能合约开发使用 sCrypt 开发套件,sCrypt 开发语言分成两
1919
- 只需编写TypeScript,方便前后端集成
2020
- 打包为npm package,方便复用合约,分发合约
2121

22-
![Alt text](../../../../../../static/img/scrypt-ts-to-op.png)
22+
![Alt text](/img/scrypt-ts-to-op.png)
2323

2424
### mvc合约
2525

@@ -42,7 +42,7 @@ token-core-ts是对mvc原token、nft合约翻译为scrypt,但是测试用例
4242
npx scrypt-cli project demo
4343
cd demo && npm i
4444
```
45-
![Alt text](../../../../../../static/img/scrypt-init.png)
45+
![Alt text](/img/scrypt-init.png)
4646

4747
### 添加patch指令
4848

@@ -51,19 +51,19 @@ cd demo && npm i
5151
```
5252
"patch": "sh -c \"$(curl -fsSL https://github.com/xiangpengm/token-core-ts/main/patches/patch_1.3.31.sh)\""
5353
```
54-
![Alt text](../../../../../../static/img/scrypt-add-patch.png)
54+
![Alt text](/img/scrypt-add-patch.png)
5555

5656
### 执行patch
5757

5858
```bash
5959
npm run patch
6060
```
6161

62-
![Alt text](../../../../../../static/img/scrypt-run-patch.png)
62+
![Alt text](/img/scrypt-run-patch.png)
6363

6464
### 执行scrypt-ts本地测试
6565

6666
```
6767
npm run test
6868
```
69-
![Alt text](../../../../../../static/img/scrypt-run-test.png)
69+
![Alt text](/img/scrypt-run-test.png)

0 commit comments

Comments
 (0)