命令格式:$ cleos set account permission ${permission} ${account} ${permission_json} ${account_authority}
json
要修改賬戶的權限,你必須擁有該賬戶的權限和你正在修改的權限。設置賬戶權限命令可能會更改,所以它關聯的類沒有完整記錄。工具
$ cleos set account permission test active '{"threshold" : 1, "keys" : [{"permission":{"key":"EOS8X7Mp7apQWtL6T2sfSZzBcQNUqZB7tARFEm9gA9Tn9nbMdsvBB","permission":"active"},"weight":1}], "accounts" : [{"permission":{"actor":"acc2","permission":"active"},"weight":50}]}' owner
第二個示例修改相同的賬戶權限,但刪除上一個示例中的密鑰集,並將@test賬戶的活動權限授予另外一個賬戶。學習
$ cleos set account permission test active '{"threshold" : 1, "keys" : [], "accounts" : [{"permission":{"actor":"sandwich","permission":"active"},"weight":1},{"permission":{"actor":"acc1","permission":"active"},"weight":50}]}' owner
第三個示例演示如何設置multisig的權限區塊鏈
$ cleos set account permission test active '{"threshold" : 100, "keys" : [{"permission":{"key":"EOS8X7Mp7apQWtL6T2sfSZzBcQNUqZB7tARFEm9gA9Tn9nbMdsvBB","permission":"active"},"weight":25}], "accounts" : [{"permission":{"actor":"@sandwich","permission":"active"},"weight":75}]}' owner
此命令中使用的JSON對象實際上由兩種不一樣類型的對象組成 權限JSON對象...ui
{ "threshold" : 100, /*An integer that defines cumulative signature weight required for authorization*/ "keys" : [], /*An array made up of individual permissions defined with an EOS PUBLIC KEY*/ "accounts" : [] /*An array made up of individual permissions defined with an EOS ACCOUNT*/ }
...其中包括一個或多個權限對象this
/*Set Permission with Key*/ { "permission" : { "key" : "EOS8X7Mp7apQWtL6T2sfSZzBcQNUqZB7tARFEm9gA9Tn9nbMdsvBB", "permission" : "active" }, weight : 25 /*Set the weight of a signature from this permission*/ } /*Set Permission with Account*/ { "permission" : { "actor" : "sandwich", "permission" : "active" }, weight : 75 /*Set the weight of a signature from this permission*/ }
分享個《EOS智能合約與DApp開發入門教程》,歡迎你們來學習互動:code
EOS教程對象
本教程幫助你快速入門EOS區塊鏈去中心化應用的開發,內容涵蓋EOS工具鏈、帳戶與錢包、發行代幣、智能合約開發與部署、使用代碼與智能合約交互等核心知識點,最後綜合運用React和EOS的各知識點完成一個便籤DApp的開發。教程