Compiling
Automatic Compilation
Modify the code on the editor, IDE will automatically compile the code to check whether the latest code can be compiled. If the compilation fails, an error message will appear in the Problems panel. Automatic compilation will not output the contract description file.
Manual Compilation
IDE supports compiling contract files in the context menu of code editor or resource manager.
After the compilation is completed, there will be a notification in the lower right corner of the VS Code window, and the output panel will also show the compilation results, including the name of the compiled contract file, the size of the compiled script 1, the storage path of the contract description file.
Contract Description File
The contract description file is the output of compiling a contract, which can be used for testing, deploying, calling and integrating the contract.
Hint
The scryptlib document has a detailed introduction about the contract description file.
Debug Build
Right click on the code editor and select : Compile Contract: Debug
In the development process, debug build is mainly used to build contracts, including debuggers, unit tests, deployment, and calling contracts. Under this build mode, the script generated by the compiler is not optimized, but contains auxiliary information used for debugging and locating exceptions.
Release Build
Right click on the code editor and select : Compile Contract: Release
When everything is ready, release compilation should be used to build the contract. Under this build mode, the compiler will generate optimized script, delete auxiliary information, so that the script will become smaller and save transaction fees. Currently only paid users can use this feature, please refer to Premium paid features
Warning
The scripts compiled by different versions of the compiler may be different, but they are equivalent. If the compiled script changes, it can cause the old transaction preimage to fail verification. This problem can be fixed by calculating a new transaction preimage.
- 1
Change the size calculation method to not include contract constructor parameters