Multiple signature functions allow for permission grading, and each permission can correspond to multiple private keys. This makes it possible to achieve multi-person joint control of accounts. This guide walks the user through TRON's multi-signature implementation and design.
The scheme includes the three privilege levels of owner, duration, and active privilege. Owner privilege has the authority to execute all contracts, duration privilege is used for super delegates, and active is a custom privilege (can be combined with permission sets).
## Structure Description
**1. Account Modification**
Three permission attributes are added to the account structure, namely owner_permission, witness_permission, and active_permission, where active_permission is a list and can be specified up to 8.
**2. Contract Type Modification**
Added a transaction type AccountPermissionUpdateContract to update account permissions.
|owner_address||The address of the account to be modified|
|owner||Modified owner permission|
|witness||Modified witness permission (if it is a witness)|
|actives||Modified actives permission|
This interface overrides the original account permissions, so if you only want to modify the owner permissions, the witness (if it is a witness account) and actives also need to be set.
|PermissionType||Permission type, currently only supports three permissions.|
|id||The value is automatically set by the system, with Owner id=0 and Witness id=1. Active id is incremented from 2 onwards. When the contract is executed, the id is used to specify which permission to use. For example, if the owner permission is used, the id is set to 0.|
|permission_name||Permission name, set by the user, limited to 32 bytes in length.|
|threshold||Threshold, the corresponding operation is allowed only when the sum of the weights of the participating signatures exceeds the domain value. Requires a maximum value less than the Long type.|
|parent_id||Currently only 0|
|operations||A total of 32 bytes (256 bits), each representing the authority of a contract, a 1 means the authority to own the contract. Please refer to below detailed example: "Example of operations in active permissions"|
|keys||The address and weight that jointly own the permission can be up to 5 keys.|
|address||Address with this privilege|
|weight||This address has weight for this permission|
**6. Transaction Modification**
Add a `
Permission_id` field to the transaction, corresponding to `
Permission.id`, which specifies which permission to use. The default is 0, which is the owner permission. It is not allowed to be 1, because the witness permission is only used for block creation and is not used to sign the transaction.
## Owner Permission
OwnerPermission is the highest privilege of the account, used to control the ownership of the user, adjust the privilege structure, and the Owner privilege can also execute all contracts.
The Owner privilege has the following characteristics:
The OwnerPermission address can be modified by OwnerPermission.
When OwnerPermission is empty, the account address is assumed to have owner permission by default.
When the account is newly created, the address of the account is automatically filled in the OwnerPermission, and the default domain value is 1, the only address in the keys is included and the weight is 1.
When the permissionId is not specified when the contract is executed, OwnerPermission is used by default.
## Witness Permission
The super representative can use this privilege to manage the block nodes. Non-witness accounts do not have this permission.
Example of usage scenario: A super representative deploys a block program on the cloud server. For account security, you can assign the block permission to another address. Since the address only has the outbound permission, there is no TRX rollout permission, and even if the private key on the server is compromised, TRX will not be lost.
Witness block production node configuration:
No special configuration is required when the witness permissions are not modified.
The block node modified to witness permission needs to be reconfigured. The configuration items are as follows:
## Active Permissions
Active permission is used to provide a combination of permissions, such as providing a permission to perform only the creation of accounts and transfer functions.
Active permissions have the following features:
With the address of OwnerPermission can modify Active permissions
The address with the permission to execute AccountPermissionUpdateContract can also modify Active permissions
Support up to 8 combinations.
The id of the permission is automatically incremented from 2.
When the account is newly created, an Active permission is automatically created, and the address of the account is filled in. The default domain value is 1, and only the account address is included in the keys and the weight is 1.
When using the account update permission, that is, the AccountPermissionUpdate contract, 100TRX is charged.
When using a multi-signature transaction, that is, a transaction that includes two or more signatures in the transaction, in addition to the transaction fee, 1TRX is charged.
The above fees can be revised by the proposal.
## Modify Permissions
AccountPermissionUpdateContract`, modify the permissions steps are as follows:
Use the interface `
getaccount` to query the account and get the original permissions
Modify the permission
Create a contract, signature
Send a transaction
**Example of operations in active permissions**
"operations" is a hexadecimal coded sequence (little-endian byte order), 32 bytes (256 bits), and each represents the authority of a contract. the value 1 means that it has the authority to execute the contract.
To make it easier for users to read, take the binary big-endian byte order as an example to illustrate how to calculate the value of operations: the number of digits starting from 0 from left to right corresponds to the id of the contract type. For the id value of different contracts, please refer to: [enum ContractType](🔗)
Convert a binary big-endian byte sequence to a hexadecimal little-endian byte sequence, that will be the value of operations, please refer to below examples:
|Operations Allowed||Binary Code||Hex Code|
|TransferContract(1) & VoteAssetContract(3)||01010000 00000000 00000000 ...||0A 00 00 ...|
|TransferContract(1) & UpdateAssetContract(15)||01000000 00000001 00000000 ...||02 80 00 ...|
|All||11111110 11111111 11111000 ...||7F FF 1F ...|
**Example of calculation of operations in active authority**
## Contract Execution
Create a transaction, the same as the construction process of a non-multiple signature transaction 2, specify the Permission_id, the default is 0, indicating the owner-permission
The user A signs the post-signature transaction to B through other means.
User B signs, and the signed transaction is sent to C by other means. ... n. The last user who completed the signature broadcasts the transaction to the node. N+1, verify that the sum of the weights of the multi-signature is greater than the domain value, accept the transaction, otherwise reject the transaction
## Other New Interfaces
For detailed interface description, please see Tron-http.md and wave field wallet RPC-API.md
Query Signed Address
Query Transaction Signature Weight
The owner-permission and an active-permission are automatically generated during account creation. The owner-permission contains one key, with the permissions and thresholds both set as 1. The active-permission also contains a key with permissions and thresholds set at 1.
The operations are "7fff1fc0037e0000000000000000000000000000000000000000000000000000", which means all operations except AccountPermissionUpdateContract are supported.