11# {{PROJECT_NAME}}
22
3- A CKB JavaScript VM project for developing smart contracts on the CKB blockchain.
3+ A JavaScript project for developing smart contracts on the CKB blockchain.
44
55## Overview
66
@@ -12,15 +12,17 @@ This project uses the CKB JavaScript VM (ckb-js-vm) to write smart contracts in
1212{{PROJECT_NAME}}/
1313├── contracts/ # Smart contract source code
1414│ └── hello-world/
15- │ ├── src/
16- │ │ └── index.{{LANGUAGE}} # Contract implementation
17- │ └── dist/ # Compiled output (generated)
15+ │ └── src/
16+ │ └── index.{{LANGUAGE}} # Contract implementation
1817├── tests/ # Contract tests
1918│ └── hello-world.test.{{LANGUAGE}}
2019├── scripts/ # Build and utility scripts
2120│ ├── build-all.js
2221│ ├── build-contract.js
2322│ └── add-contract.js
23+ ├── dist/ # Compiled output (generated)
24+ │ ├── hello-world.js # Bundled JavaScript
25+ │ └── hello-world.bc # Compiled bytecode
2426├── package.json
2527{{#if_typescript}}├── tsconfig.json # TypeScript configuration
2628├── tsconfig.base.json # Base TypeScript settings
@@ -88,9 +90,9 @@ This will:
8890
8991### Build Output
9092
91- Each contract generates two files in its `dist/` directory:
92- - `{contract-name}.js` - Bundled JavaScript code
93- - `{contract-name}.bc` - Compiled bytecode for CKB execution
93+ All contracts are built to the global `dist/` directory:
94+ - `dist/ {contract-name}.js` - Bundled JavaScript code
95+ - `dist/ {contract-name}.bc` - Compiled bytecode for CKB execution
9496
9597### Testing
9698
@@ -106,9 +108,53 @@ Tests use the `ckb-testtool` framework to simulate CKB blockchain execution. Eac
106108- `build:contract <name>` - Build a specific contract
107109- `test` - Run all tests
108110- `add-contract <name>` - Add a new contract
111+ - `deploy` - Deploy contracts to CKB network
109112- `clean` - Remove all build outputs
110113- `format` - Format code with Prettier
111114
115+ ## Deployment
116+
117+ Deploy your contracts to CKB networks using the built-in deploy script:
118+
119+ ### Basic Usage
120+
121+ ```bash
122+ # Deploy to devnet (default)
123+ {{PACKAGE_MANAGER}} run deploy
124+
125+ # Deploy to testnet
126+ {{PACKAGE_MANAGER}} run deploy -- --network testnet
127+
128+ # Deploy to mainnet
129+ {{PACKAGE_MANAGER}} run deploy -- --network mainnet
130+ ```
131+
132+ ### Advanced Options
133+
134+ ```bash
135+ # Deploy with upgradable type ID
136+ {{PACKAGE_MANAGER}} run deploy -- --network testnet --type-id
137+
138+ # Deploy with custom private key
139+ {{PACKAGE_MANAGER}} run deploy -- --network testnet --privkey 0x...
140+
141+ # Combine multiple options
142+ {{PACKAGE_MANAGER}} run deploy -- --network testnet --type-id --privkey 0x...
143+ ```
144+
145+ ### Available Options
146+
147+ - `--network <network>` - Target network: `devnet`, `testnet`, or `mainnet` (default: `devnet`)
148+ - `--privkey <privkey>` - Private key for deployment (default: uses offckb's deployer account)
149+ - `--type-id` - Enable upgradable type ID for contract updates
150+
151+ ### Deployment Artifacts
152+
153+ After successful deployment, artifacts are saved to the `deployment/` directory:
154+ - `deployment/scripts.json` - Contract script information
155+ - `deployment/<network>/<contract>/deployment.toml` - Deployment configuration
156+ - `deployment/<network>/<contract>/migrations/` - Migration history
157+
112158## Dependencies
113159
114160### Core Dependencies
0 commit comments