Guidelines
- Introduction
- Installation
- Quick Start
Guides
- Introductions
- Build local test node
- Smart Contract - ABI Files
- Smart Contract——JS Contract
- Deploy Contracts
- Test Contract
- Develop DApp Client
Smart Contracts
- Contract Introduction
- ABI File
- Database
- Account Authority
- Call In-contract
- Notification
System Contracts
- Resources
- Account
- Permission
Token Contracts
- Transfer
- Token
- Token Exchange
- Contract Sub-Wallet
Node Guide
- Node Introduction
- Add to nodes network
- Node Data Persistence
Access Guide
- FO 接入安全指南
Permission
What is permission
There are 2 types of FIBOS account permissions: owner、active. An account must be “associated” with owner、active permissions.
owner:
Has super privileges. Represents the owner of the account. Because the owner of this permission can operate the other permissions’ configuration, this permission is commonly used in transactions (Transfer, contract action, etc) It is not usually used.active:
Common business permissions,Exp:transfer,vote,etc.
Relationships Between Account and Permission
Create FIBOS account
1 | var FIBOS = require('fibos.js'); |
Result:
1 | { |
For the string permissions
in the result, owner、active permission controller is indeed the owner of public key: FO5dZut9MG9ZdqrT1WYdPkp1Txxi6JLRYEgYCtAUDWH6ymNqdJpR
.
Analyze Accounts and Permissions
Select part of the execution script:
1 | fibos.newaccountSync({ |
the codes above transferred owner, active permissions to the public key FO5dZut9MG9ZdqrT1WYdPkp1Txxi6JLRYEgYCtAUDWH6ymNqdJpR
. That is to say the private key owner corresponding to the public key has owner, active permissions.
Select the part of the execution script:
1 | 'ram_quota': -1, |
Use eosio account to create hellofibos01,the resources is unlimited,so RAM、NET、CPU are all -1
. The rest of resources we created are all 0
,0 represents no resources.
Permission Configuration
Change the active permission of account hellofibos01.
1 | var FIBOS = require('fibos.js'); |
Results:
1 | { |
The codes above created hellofibos02,and called updateauthSync
method to do permission change operation. We transferred active permiision of hellofibos01 to the public key.FO5UFAzxUsbjQCijL5LtS6TaTtkJgPJACZ8qwDpXyLaW3sE9Ed2D
.
Multiple Signature
What is Multiple Signature?
Multiple signiture means signing multiple times. While we use blockchain to do authorized operations, the private key is used to sign all.
Thresholds and Weights
Threshold is the minimum permission you need to access an account. Weight represents the permission level owned by your private key.
Example
Single Signature Account
permission | Public Key | Weight | Threshold |
---|---|---|---|
owner | 1 | ||
FO5dZut9MG9ZdqrT1WYdPkp1Txxi6JLRYEgYCtAUDWH6ymNqdJpR | 1 | - | |
active | 1 | ||
FO5dZut9MG9ZdqrT1WYdPkp1Txxi6JLRYEgYCtAUDWH6ymNqdJpR | 1 | - |
As the table above shows,if you want to get owner permission,the weight of the owner must be greater than or equal to the threshold corresponding to the owner,the example above shows the threshold of owner is 1,and the weight of public key FO6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
is 1. Therefore, the owner of the public key can be directly obtained for operation.
Active permissions are the same as explained above, we understand this type of account that only has one public key as the single signature account.
Multi-Signature Account
For correct signature, must satisfy the threshold authorization
Permission | Public Key | Weight | Threshold |
---|---|---|---|
owner | 2 | ||
FO5dZut9MG9ZdqrT1WYdPkp1Txxi6JLRYEgYCtAUDWH6ymNqdJpR | 1 | - | |
FO5UFAzxUsbjQCijL5LtS6TaTtkJgPJACZ8qwDpXyLaW3sE9Ed2D | 1 | - | |
active | 1 | ||
FO5dZut9MG9ZdqrT1WYdPkp1Txxi6JLRYEgYCtAUDWH6ymNqdJpR | 1 | - |
As the table above shows,if you want to get owner permission,two public keys must be authorized at the same time.