Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7855

`createWithSeed` vs using a PDA with f`indProgramAddress`

$
0
0
  1. In what situations would I want to use createWithSeed function vs deriving a PDA address.

  2. Why do the two generate different addresses

const programId = new PublicKey("4mFDYND4AVREYEJXCPhjq1LnbjELHHebJqG3NZechA7X");const address = PublicKey.findProgramAddressSync([], programId)[0];const add = PublicKey.findProgramAddressSync(    [address.toBuffer(), Buffer.from("anchor:idl")],    programId)[0];// CuisJpFYLe18u7T14Z9kRKveJqFPRb3XwfR7Jh1xo8Kgconst createdAdd = await PublicKey.createWithSeed(    address,"anchor:idl",    programId);// 44nqWMbW4Rgm1q2VddgJJUTFZYAqHsmXETfupaKNxzDN

Viewing all articles
Browse latest Browse all 7855

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>