Hey I try to create a basic program which takes and manages sol for users. Something like the weth contract on ethereum.

The program just needs to store the SOL and under some conditions users will be able to withdraw and deposit SOL into the program. My understanding is that only programs that are owned by some system program can transfer SOL, so can I give the ownership of my program to the system program and then transfer sol with that? Can the PDA's of my program be owned by the system program? And in general when I have a PDA or program with SOL how can I get it back?

I am looking for some insight on this or perhaps examples of such things, since so far must of the resources I saw were using anchor.

Any help would be appreciated.

2 Answers 2


Here is an example of SOL transfers with a native program: https://github.com/solana-developers/program-examples/tree/main/basics/transfer-sol/native

Yes, the PDAs derived from your program's program ID can be owned by the System Program. If SOL is transferred to the PDA, by default it will be owned by the System program. You can then have an instruction in your program that transfers SOL from(out of) the PDA using the seeds to sign for the SOL transfer CPI (using invoke_signed).


Typically, you will write your program to support spl-tokens in general, then when dealing with SOL, you will wrap it on the front end to make wrapped sol (wsol), which you can use like any other spl token. Most applications will also handle wrapping and unwrapping transparently behind the scenes, so a deposit may look like:

  1. Figure out amount to deposit
  2. Wrap that amount
  3. Execute your deposit ix (same tx as the wrap)

To the user, this looks the same as depositing sol.

It is not typically worthwhile to make your program support native SOL given how much easier it is to wrap the SOL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.