当设置一个账户的权限为多个账户时
cleos set account permission bcskillsurou active '{"threshold":1,"keys":[{"key":"EOS5bu13CujrEUdKB57LnvihUAqkdUycwSz2p7vPuac7vNBvfh7M7","weight":1}],"accounts":[{"permission":{"actor":"222222222222","permission":"eosio.code"},"weight":1},{"permission":{"actor":"111111111111","permission":"eosio.code"},"weight":1}],"waits":[{"wat_sec":1,"weight":1}]}' owner -p bcskillsurou
报错如下
Error 3010004: Invalid authority
Ensure that your authority JSON is valid follows the following format!
{
"threshold": <INTEGER [1-2^32): the threshold that must be met to satisfy this authority>,
"keys": [ <keys must be alpha-numerically sorted by their string representations and unique>
...
{
"key": <STRING: EOS.IO compatible Public Key>,
"weight": <INTEGER [1-2^16): a signature from this key contributes this to satisfying the threshold>
}
...
],
"accounts": [ <accounts must be alpha-numerically sorted by their permission (actor, then permission) and unique>
...
{
"permission": {
"actor": <STRING: account name of the delegated signer>,
"permission": <STRING: permission level on the account that must be satisfied>,
},
"weight": <INTEGER [1-2^16): satisfying the delegation contributes this to satisfying the threshold>
}
...
],
"waits": [ <waits must be sorted by wait_sec, largest first, and be unique>
...
{
"wait_sec": <INTEGER [1-2^32): seconds of delay which qualifies as passing this wait>
"weight": <INTEGER [1-2^16): satisfying the delay contributes this to satisfying the threshold>
}
...
]
}
Error Details:
Authority failed validation! ensure that keys, accounts, and waits are sorted and that the threshold is valid and satisfiable!
解决问题
将添加的accounts按照ascii顺序添加
例如上面的例子,先添加 111111111111 再添加 222222222222
cleos set account permission bcskillsurou active '{"threshold":1,"keys":[{"key":"EOS5bu13CujrEUdKB57LnvihUAqkdUycwSz2p7vPuac7vNBvfh7M7","weight":1}],"accounts":[{"permission":{"actor":"111111111111","permission":"eosio.code"},"weight":1},{"permission":{"actor":"222222222222","permission":"eosio.code"},"weight":1}],"waits":[{"wat_sec":1,"weight":1}]}' owner -p bcskillsurou