Demo bellowed is what I figure out to make program receive SOL. But it seem have room to improve, especially 'NewAccount', which look ugly, but I can't found property Account type to replace it. I mean I just want a standard account to store SOL, and there is likelihood thatanchor have provide this type of account handy to use that I just not found. The purpose of 'sol_faucet' is just to receive from and send out to users wallet.

use anchor_lang::prelude::*;

// This is your program's public key and it will update
// automatically when you build the project.

mod hello_anchor {
    use super::*;
    pub fn initialize(ctx: Context<Initialize>, data: u64) -> Result<()> {
        msg!("Changed data to: {}!", data); // Message will show up in the tx logs
        msg!("sol_faucet: {}!", ctx.accounts.sol_faucet.key());  

pub struct Initialize<'info> {
    #[account(init, seeds = [b"faucet", signer.key().as_ref()], bump, payer = signer, space = 8)]
    pub sol_faucet: Account<'info, NewAccount>,

    pub signer: Signer<'info>,

    pub system_program: Program<'info, System>,

pub struct NewAccount {

1 Answer 1


You can actually just use a SystemProgram account that is seeded just like a PDA in your program. Something like:

        seeds = [
    vault: SystemAccount<'info>,

When you want to send funds from that account you just sign with seeds. Note that you do not use init in Anchor for these accounts--just mut and transfer SOL to it.

Here's a program example with tests, and here's a guide to walk through it.

  • 1
    That's of great help. It work and here is my demo on playground: beta.solpg.io/65b76e90cffcf4b13384cf36 Commented Jan 29 at 9:51
  • 1
    One thing to note: you should not use 'init' attribute on SystemAccount, otherwise endless error, fixing, error ... ^_^ Commented Jan 29 at 9:52
  • Great! Yes RE: init. I added a note to my response. Good suggestion.
    – AMilz
    Commented Jan 29 at 12:07

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.