Skip to main content
3 of 3
added 5 characters in body; added 142 characters in body
Jonas H.
  • 7.2k
  • 1
  • 7
  • 26

The code you posted would not work out of the box.

The fromKeypair is paying for the new account to be created, and would need to have enough SOL to create a new account.

The default system account on solana is 136 bytes and costs 0.00178176 SOL to be rent exempt.

So the system program will create this account when you do the transfer. Using the CLI it would actually ask you if you want to fund that account.

The fromKeypair is the one that is paying for the new account and the toKeypair is the address where the new account will be created.

Jonas H.
  • 7.2k
  • 1
  • 7
  • 26