I'm curious if there is any way to get author of solana smart contract. In the case of solidity, I have used save msg.sender in constructor to keep owner address of the contract.
contract KeepOwner {
address private _owner;
constructor() {
_owner = msg.sender;
}
function isOwner(address likeOwner) public view returns (bool) {
return likeOwner == _owner;
}
}
But I can't find any method to save and get author(who have sent deploy transaction) pubkey on solana. I have tried to get the information from AccountInfo of solana program but couldn't success.
Hardcoding the owner's private information into the program is not secure, so we should use another method to verify whether an account is the owner or not. We can use an SPL token to represent ownership of a program.
Of course, you should check if the account has the hardcoded mint token balance to check if that account is the owner of the program or not. You can transfer ownership by transferring the spl token. Also can extend functionalities along functionalities of the SPL token as well.