Within this tutorial, we will be crafting a Sway contract for an online marketplace similar to Amazon, where:
One of the compelling features of smart contracts is their immutability and permissionless nature. This ensures that no single entity can modify or adjust the rules of the marketplace after its deployment. For instance, once a product is listed in the contract, the deployer cannot suddenly alter its status. Similarly, if a commission amount is hardcoded into the contract, it remains fixed, preventing any changes to the commission charged for products.
Furthermore, the contract remains open for interaction by anyone. This universality allows any individual to engage with the marketplace using their custom frontend without requiring permission.
In this tutorial, our attention will be specifically directed towards the
contract program type. This is just one of the four program types inherent to the Sway language.
Sway is a strongly-typed programming language based on Rust, designed for authoring smart contracts on the Fuel blockchain. It leverages Rust's performance, control, and safety attributes, making it suitable for a blockchain virtual machine environment that's optimized for gas costs and contract security.
Sway is bolstered by a robust compiler and toolchain. These tools simplify the complexities and ensure that your code is efficient, secure, and performs optimally.
What truly distinguishes Sway is the exceptional suite of tools built around it. These tools are meticulously designed to convert contracts into full-stack dapps, ensuring a seamless and unparalleled developer experience.
📚 Sway Standard Library : A native library equipped with useful types and methods.
🧑🔧 Fuelup : The official Fuel toolchain manager aids in installing and managing different versions.
🦀 Fuel's Rust SDK : Test and interact with your Sway contracts using Rust.
⚡ Fuel's TypeScript SDK : Test and interact with your Sway contracts using TypeScript.