Access Keys
In most blockchains, users control their accounts by holding a singleprivate key (a secret only they know) and using it to sign transactions.
In NEAR we distinguish two types of Access Keys:
Full-Access Keys: Have full control over the account, and should never be sharedFunction-Call Keys: Can only sign calls for specific contracts, and are meant to be shared
Function-Call Keys
Function-Call keys can only sign transactions calling a specific contract, and do not allow to attach NEAR tokens to the call.
They are defined by three attributes:
The only contract which the key allows to call, no other contract can be called with this key
The contract’s methods the key allows to call. If omitted, all contract’s methods can be called
The amount of NEAR allowed to be spent on gas. If omitted, the key can consume unlimited gas
Function Call Keys are meant to be shared with applications, so third-parties can make contract calls in your name. This is useful in multiple scenarios.
Function-Call keys are secure to share, as they only permit calls to a specific contract and prohibit NEAR token transfersFull-Access Keys
As the name suggests,Full-Access keys have full control of an account, meaning they can be used to sign transactions doing any action in your account’s behalf:
You should never share your
Full-Access, otherwise you are giving total control over the account.
Implicit accounts already have a
Full-Access Key by default, while for named accounts their first Full-Access Key is added on creation