TRON Multi-Signature mechanism

Introduction

Background

Scenario

Specification

Account:

message Account {    ...    Permission owner_permission = 31;    Permission witness_permission = 32;    repeated Permission active_permission = 33;}

Permission:

message Permission {    enum PermissionType {        Owner = 0;        Witness = 1;        Active = 2;    }    PermissionType type = 1; // enum permission type, {0,1,2}    int32 id = 2; // Generated by system. Owner id=0, Witness id=1, Active id increases from 2. Specifying using which permission to execute a contract by setting id. For instance, using owner permission, set id=0, {0,1,2,3,4,5,6,7,8,9}    string permission_name = 3;  // Permission name, 32 bytes length limit    int64 threshold = 4;  // The threshold of the signature weight    int32 parent_id = 5;  // deprecated, 0    bytes operations = 6;  // 32 bytes (256 bit), each bit corresponds whether has the execution permission of each type of contract    repeated Key keys = 7;// The list of accounts and weights that own the permission, the length must <= 5.}

Key:

message Key {    bytes address = 1;// the account address    int64 weight = 2;// the signature weight}

ContractType:

message Transaction {    message Contract {        enum ContractType {            AccountCreateContract = 0;            ...            AccountPermissionUpdateContract = 46;            ...
}
} ContractType type = 1; ... int32 Permission_id = 5;// Permission_id in Transaction corresponds to id in Permission.}

Owner Permission:

Witness Permission:

#config.conf// Optional.The default is empty.// It is used when the witness account has set the witnessPermission.// When it is not empty, the localWitnessAccountAddress represents the address of the witness account,// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account.// When it is empty,the localwitness is configured with the private key of the witness account.//localWitnessAccountAddress =localwitness = [f4df789d3210ac881cb900464dd30409453044d2777060a0c391cbdf4c6a4f57]

Active Permission:

Fee:

Change Permission:

http://{host}:{port}/wallet/accountpermissionupdate{"owner_address": "41ffa9466d5bf6bb6b7e4ab6ef2b1cb9f1f41f9700","owner": {"type": 0,"id": 0,"permission_name": "owner","threshold": 2,"keys": [{"address": "41ffa9466d5bf6bb6b7e4ab6ef2b1cb9f1f41f9700","weight": 1},{"address": "{account_1}","weight": 1},{"address": "{account_2}","weight": 1}]},"witness": {"type": 1,"id": 1,"permission_name": "witness","threshold": 1,"keys": [{"address": "41F08012B4881C320EB40B80F1228731898824E09D","weight": 1}]},"actives": [{"type": 2,"id": 2,"permission_name": "active0","threshold": 3,"operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000","keys": [{"address": "{account_3}","weight": 1},{"address": "{account_4}","weight": 1},{"address": "{account_5}","weight": 1}]},{"type": 2,"id": 3,"permission_name": "active1","threshold": 3,"operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000","keys": [{"address": "{account_6}","weight": 1},{"address": "{account_7}","weight": 1},{"address": "{account_8}","weight": 1}
]}]}

How to make Multi-signature with http API:

# curl -X POST  http://47.252.84.158:8090/wallet/accountpermissionupdate{"owner_address" : "41AF498B43EE098B26926798CFEAE1AB1154EF4430","owner": {"type": 0,"id": 0,"permission_name": "owner","threshold": 1,"keys": [{"address": "41AF498B43EE098B26926798CFEAE1AB1154EF4430","weight": 1}]},"actives": [{"type": 2,"id": 2,"permission_name": "active1","threshold": 2,"operations": "7fff1fc0033e0000000000000000000000000000000000000000000000000000","keys": [{"address": "41A6D58DCB0E0FC0C3FE23CC405D5BD7979E9016FB","weight": 1},{"address": "41F04DC975557388CD5D5FBCAAA706D76AAD415E59","weight": 1},{"address": "41CC187927EB7D648D779FE363F7915DDCFBF2212B","weight": 1}]}]}
# curl -X POST http://47.252.84.158:8090/wallet/gettransactionsign{"transaction" :${result_2} ,"privateKey": "1bb32958909299db452d3c9bbfd15fd745160d63e4985357874ee57708435a00"}
# curl -X POST http://47.252.84.158:8090/wallet/broadcasttransaction${result_3}
# curl -X POST http://47.252.84.158:8090/wallet/createtransaction{"owner_address": "41AF498B43EE098B26926798CFEAE1AB1154EF4430","to_address": "41CA6E0F4BC55CFEC286B3E2F3CB45CBAC87792B78","amount": 1000,"Permission_id" : 2}
# curl -X POST http://47.252.84.158:8090/wallet/gettransactionsign{"transaction" : ${result_5},"privateKey": "1bb32958909299db452d3c9bbfd15fd745160d63e4985357874ee57708435a11"}
curl -X POST http://47.252.84.158:8090/wallet/gettransactionsign{"transaction" : ${result_6},"privateKey": "1bb32958909299db452d3c9bbfd15fd745160d63e4985357874ee57708435a22"}
# curl -X POST  http://47.252.84.158:8090/wallet/broadcasttransaction${result_7}
# curl -X POST http://47.252.84.158:8090/wallet/getaccount{"address": "41CA6E0F4BC55CFEC286B3E2F3CB45CBAC87792B78"}

Conclusion

References

For more information

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store