2

I write code for staking:

 const stakeAccount = Keypair.generate();

then I get the validator that I trust

const validators = await connection.getVoteAccounts();
  // just choose the first one
  const selectedValidator = validators.current[0];

then delegate the transaction

const delegateTx = StakeProgram.delegate({
    stakePubkey: stakeAccount.publicKey,
    authorizedPubkey: wallet.publicKey,
    votePubkey: selectedWalidatorPubKey,
  });

Now the question is where is this stake account created and who creates it? What does delegating mean?

1 Answer 1

1

stake account is owned by the stake program which runs the complex transactions requried to facilitate staking.

If you have sol in your wallet and you want to stake, phantom wallet creates stake Account. I thought somehow you have to send the sol to the validator account. Your original wallet is the controller and owner of the staking account. the amount of sol that you want to stake is moved to the stake account.

After you moved the sol to the "stake account", you delegate the stake account's sol to the validator. this sol amount is not leaving the state account, we are just delegating the voting rights of this stake account to the validator.

I just noticed how it is easy to stake on phantom:

enter image description here

Once I click on "start earning sol", i would get input to choose the validator and then choose the amound press on "stake". Once you press on "stake", this will initiate two transactions:

1- It is creating the staking account and moving the Solana to the staking account.

2- Then it performs the delegation of the staking account.

But staking does not start right away. You have to wait for the activation period to end to make money. Staking request has to go through an activation period. This prevents people from stake a big load of Solana on the validator and manipulating the blockchain immediately.

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.