Deploy on SVM
This is a brief tutorial on how to use SVM on the current Lumio on Solana devnet. For EVM and Move VM, you can refer to the tutorials from the Lumio on Optimism testnet, but be sure to use the correct RPC and faucet RPC endpoints.
Config
Solana CLI required.
Configure RPC URL:
solana config set --url https://svm.devnet.lumio.ioIf you need a new key:
solana-keygen new -o ./keypair.jsonFaucet
Get some SOL:
solana airdrop 1Create Token
# Install
cargo install spl-token-cli
# Create token
spl-token create-tokenAfter you got token address:
# Check supply
spl-token supply <address>
# Create an account to hold balance
spl-token create-account <address>
# Check balance
spl-token balance <address>
# Mint some
spl-token mint <address> <amount>
# Check supply again
spl-token supply <address>Create a program
Be sure CLI is configured and account funded.
Create a new project:
cargo init hello_world --lib
cd hello_worldAdd deps:
cargo add solana-programOpen Cargo.toml and add the following:
[lib]
name = "hello_world"
crate-type = ["cdylib", "lib"]Replace src/lib.rs with the following code:
use solana_program::{
account_info::AccountInfo,
entrypoint,
entrypoint::ProgramResult,
pubkey::Pubkey,
msg,
};
// declare and export the program's entrypoint
entrypoint!(process_instruction);
// program entrypoint's implementation
pub fn process_instruction(
program_id: &Pubkey,
accounts: &[AccountInfo],
instruction_data: &[u8]
) -> ProgramResult {
// log a message to the blockchain
msg!("Hello, world!");
// gracefully exit the program
Ok(())
}
Build:
cargo build-bpfDeploy:
solana program deploy ./target/deploy/hello_world.soLast updated