Writing On-Chain Code
This section shows you how to write session code and smart contracts in Rust and WebAssembly (Wasm) for a Casper network. When referring to session code, these documents outline logic that executes in the context of an account. In contrast, smart contracts consist of logic installed on-chain, for use by multiple parties. There is a large overlap between the processes of writing session code versus contract code, with some semantic differences outlined in their respective documentation. The Video Series for Writing On-Chain Code accompanies the topics below.
Title | Description |
---|---|
Getting Started with Rust | An introduction to using Rust with the Casper Platform |
Best Practices for Casper Smart Contract Authors | An outline of best practices when developing smart contracts on a Casper network |
Writing a Basic Smart Contract in Rust | An example of a smart contract built in Rust |
Unit Testing Smart Contracts | Steps to test contract code using the unit testing framework |
Smart Contracts and Session Code | Understand what session code is and when you would use it over contract code |
Writing Session Code | An introduction to writing session code |
Unit Testing Session Code | Steps to test session code using the unit testing framework |
Installing Smart Contracts and Querying Global State | A guide on installing smart contracts and querying global state |
Calling Smart Contracts with the Rust Client | Steps to call a smart contract with the Rust command-line client |
Upgrading and Maintaining Smart Contracts | An introduction to versioning smart contracts |
Reading and Writing to Dictionaries | Information on Dictionaries and how to read and write to them on the Casper Platform. |
Execution Error Codes | Possible error codes when writing smart contracts. |
Getting Started with AssemblyScript | An introduction to using AssemblyScript with the Casper Platform |
Additionally, the following tutorials outline some aspects of writing smart contracts on a Casper network.
Title | Description |
---|---|
Getting Started Video | Step-by-step video tutorial for setting up the Casper development environment |
NFTs on Casper with the CEP-78 NFT Standard | Implementing the Casper CEP-78 NFT standard |
A Counter on an NCTL Network | An example contract that maintains a counter variable on a local Casper Network with NCTL |
A Counter on the Testnet | An example contract that maintains a counter variable on the Casper Testnet |
Fungible Tokens on Casper | Implement the Casper Fungible Token standard |
Interacting with Runtime Return Values | Learning how to return a value using contract code |
Safely Transfer Tokens to a Contract | How to handle tokens via a contract |
Smart Contract Upgrades | Learn how to upgrade smart contracts |