RADIX WikiRADIX Wiki

Overview

Scrypto is Radix's smart contract programming language. Built on Rust, it implements asset-oriented programming where tokens and NFTs are native primitives that the developer manipulates directly — not entries in mappings.

Key Differences from Solidity

  • No reentrancyScrypto's execution model makes reentrancy structurally impossible. Assets are in call-frame-local buckets that can't be accessed from nested calls.
  • No approval pattern — Assets move directly via buckets. No approve() + transferFrom().
  • Authorization via badges — Instead of msg.sender checks, Scrypto uses badge-based authorization. Present a proof of holding a badge to access protected methods.
  • Blueprints → Components — Scrypto code is organized into blueprints (like classes) that are instantiated into components (like objects) on-ledger.

Modern Rust Support

Scrypto 1.3.1 unlocked modern Rust (1.92.0+) support with a new WASM build pipeline, ending the previous Rust 1.81.0 lockdown.

Deterministic Arithmetic

Every Radix Engine transaction must produce an identical result on every validator, so Scrypto does not allow IEEE floating-point math on-ledger. Floating-point rounding differs across hardware and compilers, which means two nodes could compute the same swap and disagree in the final digits. That disagreement would stall consensus. All on-ledger values use fixed-point integer types instead.

  • Decimal is a 192-bit signed fixed-point number with 18 decimal places (values of the form m / 1018). It is the default type for token amounts and account balances.
  • PreciseDecimal is a 256-bit signed fixed-point number with 36 decimal places, used for intermediate calculations where the extra precision limits rounding loss.

Both types panic on overflow or underflow rather than wrapping around, so an out-of-range result reverts the whole transaction instead of leaving a corrupted balance. The tradeoff is that precision is fixed and rounding is the developer's responsibility to manage.