Odak modu

Smart Contract development on Solana using Rust

Smart contracts on other blockchains are called Programs on Solana. 

Solana, unlike other blockchains, divides code and data into two different components: Programs and Accounts. That means, rather than keeping data internally in variables, Programs interact with external data saved in Accounts with the ability to change them. Solana's design enables a program to work across several accounts without extra deployments.

There are 3 ways to create Programs on Solana as we mentioned earlier:

  • Using native programs
  • Using existing libraries on Solana(eg. Solana SPL)
  • Developing your own code from scratch on Solana

Per Solana Cookbook Rust-based programs(developed from scratch) adhere to the following architecture:

  • Lib.rs: Registering modules
  • Entrypoint.rs: Entrypoint to the program
  • Instruction.rs: Program API, (de)serializing instruction data
  • Processor.rs: Program logic
  • State.rs: Program objects, (de)serializing state
  • Error.rs: Program-specific errors

Programs can be deployed via Solana CLI or other Solana compatible CLI’s like Anchor. Loaded into the Solana cluster when a program is deployed via compiling into an object containing BPF byte code. Programs live in accounts and once invoked, they are executed by the Solana Runtime.

You can find further information from Solana Cookbook: https://solanacookbook.com/core-concepts/programs.html 

Resources:

https://medium.com/coinmonks/solana-internals-part-2-how-is-a-solana-deployed-and-upgraded-d0ae52601b99 

left-disk

Yazılım Kariyerinde İlerlemeni Hızlandıracak Programlar

Patika+ programlarımız ile 4-8 aylık yoğun yazılım kamplarına katıl, temel bilgilerden başlayarak kapsamlı bilgiler edin, yazılım kariyerine başla!

right-cube

Yorumlar

Yorum yapabilmek için derse kayıt olmalısın!