genuine-developer
genuine-developer

Reputation: 21

Smart Contract for sending Solana Coin(Sol) from one wallet to another wallet

I'm going to create a smart contract to send Sol from one wallet to another wallet on Solana. I'm using Phantom wallet.

How to implement the above?

Upvotes: 1

Views: 767

Answers (1)

Harshit Verma
Harshit Verma

Reputation: 11

You can transfer sol directly from the client application(basically ts) or you can create a contract to do so via Cross Program Invocation

Export keypair from your Phantom wallet(and store it in a safe place or use a dummy) and use it to sign the transaction.

For Cross Program Invocation - use invoke() to call the system program-

    // Transfer from PAYER to PAYEE a specific amount:
invoke(
    &system_instruction::transfer(payer.key, payee.key, amount),
    &[payer.clone(), payee.clone()],
)?;

Check out Solana Bytes and its Github.

Upvotes: 1

Related Questions