1

Solana account is represented by the AccountInfo struct, which can be seen here and whose structure is basically this:

pub struct AccountInfo<'a> {
    pub key: &'a Pubkey,
    pub is_signer: bool,
    pub is_writable: bool,
    pub lamports: Rc<RefCell<&'a mut u64>>,
    pub data: Rc<RefCell<&'a mut [u8]>>,
    pub owner: &'a Pubkey,
    pub executable: bool,
    pub rent_epoch: Epoch,
}

Now I am reading this page of the documentation about showing the program account from the command line. See here

The following command was ran:

solana program show <ACCOUNT_ADDRESS>

and the result shown as:

Program Id: 3KS2k14CmtnuVv2fvYcvdrNgC94Y11WETBpMUGgXyWZL
Owner: BPFLoaderUpgradeab1e11111111111111111111111
ProgramData Address: EHsACWBhgmw8iq5dmUZzTA1esRqcTognhKNHUkPi4q4g
Authority: FwoGJNUaJN2zfVEex9BB11Dqb3NJKy3e9oY3KTh9XzCU
Last Deployed In Slot: 63890568
Data Length: 5216 (0x1460) bytes

Now I am not sure how to map this to AccountInfo. Specifically what is Authority? is it the same as key in AccountInfo?

Also how does ProgramData Address from the output corresponds to data in AccountInfo?

1 Answer 1

1

Authority is the address which deployed the program on the blockchain. Only this address has the authority to upgrade the program. You can't map it within the program.

No, key in AccountInfo is not the Authority. Key is the public key of the account. In your case, it will be 3KS2k14CmtnuVv2fvYcvdrNgC94Y11WETBpMUGgXyWZL for the program account.

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.