Scrypto [ /āskrÉŖptoŹ/ ] is an open-source, smart-contract programming language, designed specifically for the development of decentralized applications (dApps) on the Radix Network.
Scrypto exists as a set of libraries and compiler extensions that add features, syntax and data types to the Rust programming language, allowing for an āasset-orientedā style of programming that treats tokens, NFTs and other āresourcesā as native objects.
DEVELOPMENT | |
Paradigm | Imperative (Procedural, Object-Oriented);
Supports Functional programming;
Structured; |
Developer(s) | |
Initial Release | 2021-12-15 |
Official Announcement | |
Latest Release | |
Documentation | |
Github Repo | |
Language | Rust |
License | |
Community |
Blueprints
Blueprints are inactive stateless source codes that live on the ledger.
Packages
Packages cater for when these blueprints need to work together. Packages verify the existence of blueprints because it instantiates them as part of their operations. Grouping blueprints together is expected to help save deployment costs.
Components
Components are like the smart contract of Radix DLT. It is created by instantiating the constructor of the blueprint, and it is responsible for distributing resources according to the logic provided in its' associated blueprint. The address of a newly created instance is generated once the creation process is completed.
Asset-based Token Engineering
Tokens are important in the DeFi space. Many DeFi protocols have tokens that either has a monetary value or are used for accounting purposes. Uniswap, the second largest DEX in the ecosystem with over $3.91 billion in total value locked (TVL), according to DeFillama, also has its token, UNI.
One of the flaws of smart contract design with the languages available today is that tokens are an afterthought when they are a big part of the ecosystem. This is what Scrypto claims to rectify as an asset-oriented language.
Asset-oriented programming is largely associated with Radix and vice versa. Tokens are built into Radix Engine. Tokens are not implemented in smart contracts but can be created by directly requesting them from the platform with some desired parameters. This negates what is obtainable as developers have to deploy a smart contract to create tokens which can open them up to security risks from incorrect contract logic.
Assets are a part of the fabric of the platform. Developers could develop their tokens in seconds by passing desired parameters to suit their needs. Radix built its engine this way to enable developers to create safe and secure tokens (assets).
Installation
MacOS
- Download and install VS Code.
- In VS Code, click on Terminal > New Terminal.
- Install xcode command line tools with the following command line:
- Install the Homebrew package manager and follow the prompts:
- Install the Java SDK, C++ compiler and LLVM:
- Install Rust compiler
- If you already have Rustup installed, make sure you are running the latest stable version:
- Enable cargo:
- Add WebAssembly target:
- Install simulator and command-line tools:
Windows
- Install git by running the installer fromĀ here.
- Install Visual StudioĀ Build Tools for Visual Studio 2019
- Install Rust from here.
- If you already have Rustup installed, make sure you are running the latest stable version:
- Install LLVMĀ 13.0.1 (tick the option that adds LLVM to the system PATH).
- Install the Homebrew package manager and follow the prompts:
- Install cmake:
- Install Rust compiler:
- Start a new PowerShell
- Add WebAssembly target:
- Install simulator and command-line tools:
Linux
- Install C++ compiler and LLVM is installed:
- Install Rust compiler
- If you already have Rustup installed, make sure you are running the latest stable version:
- EnableĀ
cargo
Ā in the current shell: - Add WebAssembly target:
- Install simulator and command-line tools:
Example
An example Scrypto blueprint that creates a fixed supply of 1000 āHelloTokensā.