Introduction
This guide will walk you through setting up your development environment, creating a simple "Hello World" smart contract, and deploying it to a local Synergeia testnet.
Prerequisites
Before you begin, ensure your system meets the following requirements:
- Rust Toolchain: The Synergeia node and smart contracts are built in Rust. If you don't have it, install it from rustup.rs.
- Synergeia Node Source Code: You must have the complete source code for the node.
Set Up and Run a Local Testnet
First, you need a local testnet running. For a detailed guide on this, please see the Interactive Testnet Guide. For this quick start, you can run the setup and start scripts:
./setup_testnet.sh
./start_testnet.sh
Create a "Hello World" Smart Contract
Create a new Rust file, for example, `hello_world.rs`, and add the following code. This simple contract will have a single function that returns a string.
// In a real implementation, this would use a smart contract SDK
// For now, this is a placeholder
pub fn hello() -> String {
"Hello, Synergeia!".to_string()
}
Deploy the Contract
Compile and deploy your contract to the local testnet. (In a real scenario, this would involve a deployment script and interaction with the RPC server).
# Placeholder for deployment command
synergeia-cli deploy --contract hello_world.rs