This is a program demonstrating transfer of sols from one key to another.
let fromKeypair = Keypair.generate();
let toKeypair = Keypair.generate();
let transaction = new Transaction();
transaction.add(
SystemProgram.transfer({
fromPubkey: fromKeypair.publicKey,
toPubkey: toKeypair.publicKey,
lamports: LAMPORTS_PER_SOL,
}),
);
But it's also said that everything in Solana is an account. So, how could one add sols to just randomly generated key pairs without creating accounts?
Also explain what these "from_pubkey" and "to_pubkey" are when creating an account.
system_instruction::create_account(from_pubkey, to_pubkey, lamports, space, owner);