Scrypto is the programming language used to create smart contract blueprints and components on Radix.
Based on Rust, Scrypto substantially improves the Web3 and DeFi developer experience by providing assets (tokens) as a native first-class feature of the language. Scrypto is asset-oriented.
The Problem with Smart Contracts Today
For the majority of smart contract programming languages today, developers build all the logic for tokens themselves in their own smart contracts, repeating this process for every new token. A single mistake can result in hacks that steal millions of dollars, as we have seen countless times. As a result, Web3 and DeFi developers can spend up to 80% of their time on the validations, testing and audit required to make secure DeFi. This is highly unproductive as the burden on creating secure tokens is entirely the responsibility of smart contract developers who have limited on-ledger tools to reuse code safely.
To understand these problems in greater depth, see: The Problem with Smart Contracts Today.
Scrypto: An Asset-Oriented Smart Contract Language
Scrypto has been designed differently. It is asset-oriented.
This means that instead of building all the logic for tokens in their own smart contracts, Scrypto developers can leverage Scypto's native in-built tools off-the-shelf for creating assets and defining the rules around how they can be transacted with.
Creating a token in Scrypto is done via native function call to the platform (or via API), with the token creator choosing the parameters they would like the token to have, such as maximum supply of 1,000. Logic around how the token can be transacted with is handled by a well-constrained Finite State Machine (FSM) within Radix Engine v2, the Radix platform's execution environment. Something as complex as "Soulbound" tokens on other platforms becomes as simple as setting a platform-level flag in Scrypto: Asset-Oriented “Soulbound” Tokens? Done.
Because of this, many of the mistakes made by developers that result in DeFi hacks on other platforms are just not possible on Radix. This blog post outlines the reasons why: Comparing Virtual Machines: Message Only vs Asset-Oriented.
This not only makes DeFi built with Scrypto far safer, but it means developing DeFi becomes far more intuitive, easier, and quicker. An automated market maker with equivalent functionality to Uniswap v2 goes from ~750 lines of Solidity, to ~179 lines of Scrypto.
To understand Scrypto in greater depth, see: Scrypto: An Asset-Oriented Smart Contract Language.
Blueprints and components written in Scrypto went live as part of Radix's Babylon Mainnet on the Radix Engine v2 execution environment.
To get started with Scrypto today:
- Radix Technical Docs - Introduction to Scrypto
- Radix Discord - Scrypto Quick-Start Guide
To keep up to date on Scrypto developments:
- Sign up to the Scrypto developer program.
Further reading:
- Radix Blog - The Problem with Smart Contracts Today.
- Radix Blog - Radix Engine v2: An Asset-Oriented Smart Contract Environment
- Radix Blog - Scrypto: An Asset-Oriented Smart Contract Language
- Radix Blog - Comparing Virtual Machines: Message Only vs Asset-Oriented.
- Radix DeFi Whitepaper
- What are Components, Blueprints, and the Blueprint Catalog?