This the multi-page printable view of this section. Click here to print.
Development Environment
1 - Development Tools
Anchor is the Solidity of Solana
The Solana program SDK provides low-level interfaces for writing smart contracts. It doesn’t help you define methods for you contract or how data is stored, you can decide for yourself what tools you want to use.
The Anchor framework makes Solana program development much simpler. Developing a contract with Anchor will a little closer to the experience of building with Solidity. It allows programs to define human readable method names and provides helpers for serializing contract state in many different programming languages.
solana-test-validator
is the Ganache of Solana
Solana provides a tool called solana-test-validator
which starts up
a local node on your machine for development purposes. It is installed as
part of the Solana Tool Suite.
Useful solana-test-validator
Options
--reset
Running solana-test-validator
to setup a new node with a local blockhain
ledger. Restarting from the same directory will reuse the same ledger state.
Pass the --reset
flag to start fresh.
--bpf-program
Add your own locally built programs (smart contracts) to your local blockchain’s
genesis block by using the --bpf-program
option for as many programs as you
need. This is useful for speeding up development iterations and setting up other
programs that your program will call.
--clone
Copy the account state from another cluster by using the --clone
option. This must
be used along with the --url
option to specify which cluster to fetch accounts from.
solana-program-test
is the Truffle of Solana
Solana provides Rust package called
solana-program-test
which includes a test framework
which can be used to test programs in a local Solana VM instance. Check out the
Solana Program Library to learn how to use it.
2 - Program Languages
Rust
Solana has first class support for the Rust programming language.
New to Rust?
It may be difficult to learn at first, but once you master it, there’s a good chance you’ll never look back. Rust has consistently ranked as the moved loved programming language in Stack Overflow’s developer surveys from many years.
Most Rust developers have learned through the Rust “book”. The Rust book explains Rust’s unique and tricky features in an easy to understand way. Give it a try!
Anchor
The easiest way to write Rust programs for Solana is by using the Anchor framework.
Solidity?
Solidity is not yet supported on Solana. Solidity was built to work really well for the Ethereum Virtual Machine (EVM). However, Solana’s smart contract VM was designed with fundamental differences from the EVM and so it currently does not support Solidity. There are two ongoing efforts to support Solidity on Solana:
-
Porting the EVM to run on Solana
- Driven by the team at Neon Labs
- Track development progress in the
#cybercore
channel on the Solana Discord server - Read the latest Solana EVM project spec.
-
Support Solidity for writing Solana programs
- This is a cross-chain effort to allow compiling Solidity into byte code for many different blockchains including Solana.
- Track development progress in the
#solang-solidity-compiler
channel on the Solana Discord server. - Learn more on the Solang documentation site.
C
Solana has support for C as well but the vast majority of resources are written for Rust. C developers are recommended to use Rust for a better development experience.
Move
Solana has previously experimented with adding support for the Move language but has set that project aside to prioritize other projects.
3 - Client Languages
Rust
Solana provides a Rust SDK for creating bots and tools.
solana-sdk
is used to create Transactionssolana-client
is used to interact with a Solana clustersolana-cli-config
is used to create CLI tools
TypeScript / JavaScript
Solana provides a web3 SDK for writing browser applications in TypeScript and JavaScript. Check out the documentation for how to use it.
@solana/web3.js
is used to create transactions and connect to a Solana cluster@project-serum/anchor
is used to interact with Solana programs built with Anchor
Golang
Community created Go SDK: https://github.com/portto/solana-go-sdk
Swift
Community created Swift SDK: https://github.com/crewshin/solana-swift
Python
Community created Python SDK: https://michaelhly.github.io/solana-py/