Suppose account aaa
is associated with pubkey1
. Is there a way to completely transfer ownership of account aaa
to another public key pubkey2
? The desired result is only pubkey2
can be used to authorize actions while pubkey1
can't do anything.
1 Answer
Yes, you can.
Original fff
account's owner key and active key are EOS4zQiTie***tBQ4
.
bob@bob-VirtualBox:~/eosio-wallet$ cleos get account fff
permissions:
owner 1: 1 EOS4zQiTiebtvcQqUe1t2Bkn4aLZcdRWR5NcqAZ4bsXxHyBP1tBQ4
active 1: 1 EOS4zQiTiebtvcQqUe1t2Bkn4aLZcdRWR5NcqAZ4bsXxHyBP1tBQ4
memory:
quota: unlimited used: 2.66 KiB
net bandwidth:
used: unlimited
available: unlimited
limit: unlimited
cpu bandwidth:
used: unlimited
available: unlimited
limit: unlimited
First update owner key.
bob@bob-VirtualBox:~/eosio-wallet$ cleos set account permission fff owner EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV -p fff@owner
executed transaction: dbe50e1f6c350d46c1b75fc9815776c7347a3b5e37bf9f6723ae8a316f0616b8 160 bytes 177 us
# eosio <= eosio::updateauth {"account":"fff","permission":"owner","parent":"","auth":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8...
warning: transaction executed locally, but may not be confirmed by the network yet
And now let's query fff
's account.
bob@bob-VirtualBox:~/eosio-wallet$ cleos get account fff
permissions:
owner 1: 1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
active 1: 1 EOS4zQiTiebtvcQqUe1t2Bkn4aLZcdRWR5NcqAZ4bsXxHyBP1tBQ4
memory:
quota: unlimited used: 2.66 KiB
net bandwidth:
used: unlimited
available: unlimited
limit: unlimited
cpu bandwidth:
used: unlimited
available: unlimited
limit: unlimited
As you can see, owner key already updated. Now update active key.
bob@bob-VirtualBox:~/eosio-wallet$ cleos set account permission fff active '{"threshold": 1, "keys": [{"key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", "weight": 1}], "accounts": []}' owner
executed transaction: 8f39cb0171e3cd3ebf2dbd848f73d1cade0cccee9a2a15bc4e2484335d9cce17 160 bytes 208 us
# eosio <= eosio::updateauth {"account":"fff","permission":"active","parent":"owner","auth":{"threshold":1,"keys":[{"key":"EOS6MR...
warning: transaction executed locally, but may not be confirmed by the network yet
Let's query fff
's account.
bob@bob-VirtualBox:~/eosio-wallet$ cleos get account fff
permissions:
owner 1: 1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
active 1: 1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
memory:
quota: unlimited used: 2.66 KiB
net bandwidth:
used: unlimited
available: unlimited
limit: unlimited
cpu bandwidth:
used: unlimited
available: unlimited
limit: unlimited
By now, the account fff
is transfered from EOS4zQiTie***tBQ4
key's owner to EOS6MRyAj***5GDW5CV
key's owner, now it has nothing to do with EOS4zQiTie***tBQ4
, EOS6MRyAj***5GDW5CV
has full control of fff
.
-
Hi @spartucus, is it possible to perform the same action that you've outlined above from within a smart contract rather than using cleos? If so, do you happen to have a code example of that?– MaxAug 3, 2018 at 2:11