Use the dedicated web application “LOCK-APP” to interact with the smart contract on the EOS mainnet and easily lock/unlock your account for/after the specified time period.

WARNING

The account-lock utility is intended for advanced use by EOSIO dapp developers. It is provided “as is” and its adoption by inexperienced users is strongly discouraged.

Change of the owner permission is a potentially dangerous action which can make your account irrecoverable. Please make sure you are doing it correctly or you can permanently loose access to your account. We suggest to test the process with a secondary account until you are sure that everything is working properly.


GETTING LOCKED

Follow these steps to provide temporary immutability to your account:

1. Add the accountlock1@eosio.code permission to the owner authority of your account:

cleos set account permission YOUR_CONTRACT owner ‘{“threshold”: 1,”keys”: [{“key”: “CURRENT_PUBLIC_KEY”,”weight”: 1}], “accounts”: [{“permission”:{“actor”:”accountlock1″,”permission”:”eosio.code”},”weight”:1}]}’ -p YOUR_CONTRACT@owner

In alternative to the above cleos command line or to the lock-app user interface you can use the eosio account management tools available online.

2. Call the lock action of the accountlock1 smart contract. Set the following parameters:

  • target_contract: [YOUR_CONTRACT]
  • lock_time: [insert the lock time period in seconds]
  • public_key_string: [insert the public key that should be used to restore your account after the lock time has expired]

cleos push action accountlock1 lock ‘{“target_contract”: “YOUR_CONTRACT”, “lock_time”: 60, “public_key_string”: “YOUR_PUBLIC_KEY”}’ -p YOUR_CONTRACT@active

Warning: make sure to insert correctly your public key string or you might permanently loose control of your account.

3. After the lock time has expired, call the unlock action of the accountlock1 contract to restore the owner authority:

  • target_contract: [YOUR_CONTRACT]

cleos push action accountlock1 unlock ‘{“target_contract”: “YOUR_CONTRACT”}’ -p ANY_ACCOUNT@active

To call the unlock action you can use any eos account you control (please note that you will not be able to call the unlock action using YOUR_CONTRACT’s permissions as these will be locked at this time);

This action will unlock your account by setting the public_key_string provided at step 2 as the new owner authority.


Note: the accountlock1 permissions are set to “eosio.null” to ensure that no-one can take control of your account while locked


Troubleshooting


PROOF OF LOCK AND EXPIRY TIME

Locked account names and the corresponding lock-up expiry dates are recorded on a table on the accountlock1 contract.

Any user of your dapp can check, using a simple blockchain explorer, that your account is currently locked and the date in which it will be unlocked.

At the time this screenshot was taken, three accounts were locked with expiry dates on 22-08-2019, 16-09-2019 and 16-10-2019 respectively.

When a locked account gets unlocked, the corresponding record on the accountlock1‘s data table is removed. Actually, the data table stored on the contract address provides at the same time a certification of the lockup and information of the unlock time/date. Any dapp user can easily access these details using an eos blockchain explorer.