use solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint, entrypoint::ProgramResult, msg, native_token::LAMPORTS_PER_SOL, program::invoke, pubkey::Pubkey, system_instruction, system_program, }; entrypoint!(process_instruction); fn process_instruction( _program_id: &Pubkey, accounts: &[AccountInfo], _instruction_data: &[u8], ) -> ProgramResult { let accounts_iter = &mut accounts.iter(); let payer = next_account_info(accounts_iter)?; let new_account = next_account_info(accounts_iter)?; let system_program = next_account_info(accounts_iter)?; msg!("Program invoked. Creating a system account..."); msg!(" New public key will be: {}", &new_account.key.to_string()); invoke( &system_instruction::create_account( payer.key, new_account.key, LAMPORTS_PER_SOL, 0, &system_program::ID, ), &[payer.clone(), new_account.clone(), system_program.clone()], )?; msg!("Account created succesfully."); Ok(()) }