创建或修改权限
命令格式:$ cleos set account permission ${permission} ${account} ${permission_json} ${account_authority}
要修改帐户的权限,你必须拥有该帐户的权限和你正在修改的权限。设置帐户权限命令可能会更改,因此它关联的类没有完整记录。
$ 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对象...
{
"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*/
}
...其中包括一个或多个权限对象
/*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开发入门教程》,欢迎大家来学习互动:
本教程帮助你快速入门EOS区块链去中心化应用的开发,内容涵盖EOS工具链、账户与钱包、发行代币、智能合约开发与部署、使用代码与智能合约交互等核心知识点,最后综合运用React和EOS的各知识点完成一个便签DApp的开发。