How to send SOL with a solana rust contract

Viewed 1707

I'm a noob Rust/Solana Developer and feel like I'm encountering an issue that would be helpful to most other noobs.

I want to how to transfer SOL from an account to a program during an instruction, and then be able to send SOL back to the account who called the instruction.

I read the https://docs.solana.com/ but I could not find anything about SOL transfers via programs.

Example:

Acc1 calls the gamble instruction in Program1, which transfers 1 SOL from the caller and then runs a verifiable random function. If Acct1 wins the gamble, Program1 then sends 2 SOL back to Acct1.

I would really appreciate some help, thanks!

1 Answers
Related