The purpose of this project is to easily deploy a complete logion infrastructure locally in order to enable the functional testing of the platform as a whole.
- Docker
- Docker Compose
- Bash (see scripts for more details)
Below steps must be executed only if you did not yet create the logion-test
network.
- Create
logion-test network
:docker network create logion-test
- Get network's gateway IP address:
docker network inspect logion-test | jq '.[0].IPAM.Config[0].Gateway'
- Set
RPC_WS
variable in.env
file (see.env.sample
for an example) with the above IP address
First, instantiate the Logion chain locally (see here for instructions).
In another terminal, run the following command to execute logion locally:
./scripts/up.sh
You should now be able to connect to the app (http://localhost:8080).
Initially, you may see some screens assisting you in the on-boarding process which essentially consists in:
- Install the Polkadot extension.
- Add accounts into it.
After that, you'll be invited to log in. This is done by signing with the extension. Once logged in, you will be able to switch accounts (upper right corner of the window).
The first time you start the logion infrastructure (or after a data reset), you'll have to register at least one legal officer. To do so, log in as Alice (see here to see how you can add Alice, Bob and Charlie to your extension) and fill-in:
- directory data (at least name and e-mail) and
- the node URL (
http://localhost:8080
for Alice,http://localhost:8081
for Bob andhttp://localhost:8082
for Charlie).
Do not forget to save and publish.
You may also use ./script/init_data.sh
which will automatically fill-in the data for all legal officers both in the directory
and on chain. Before running the script for the first time, do not forget to install Node.JS and run yarn
.
Note that, by default, logion's Docker images with latest
tag are being used. In order to select other tags, update .env
file.
Once you are done testing, you may want to:
- Clean-up: run
./scripts/down.sh
and stop Zombienet - Restart from scratch: restart Zombienet, then run
./scripts/reset.sh
This section describes the "script" to run when testing a given use case.
Below steps are executed by a new user which wants to activate the protection on its account. Essentially, the process consists in contacting two legal officers to ask them to become "friends" (in the recovery pallet sense). The legal officers, after doing their due diligence, may accept the request. Once both legal officers accepted, the new user may activate the protection on-chain.
Note that currently, a legal officer has to send some tokens to new users. Otherwise, they would not be able to submit extrinsics. A better solution will be designed in the future.
- Deploy logion locally.
- Add test accounts to your Polkadot extension.
- Log in as a regular user (i.e. any account which is not part of the set of test legal officers).
- In the dialog popping up, click on "Activate the logion protection" button.
- Choose the 2 first legal officers in the list (Alice and Bob), fill-in the form and click on "Next" button.
- Log in legal officer Alice.
- In the menu, click on "Protection Management".
- In the "Pending" tab, locate your request and click on "Review and process" button.
- Accept the request by clicking on "Yes" button and choose "Create the required Identity LOC". Click on "Submit", sign then click on "OK".
- Click on "Close and accept request", then click on "Confirm" and sign. You should now see the request marked as "Accepted" in the history.
- Log in legal officer Bob and execute steps 6 to 9.
- In the menu, click on "Wallet" then "Send" and transfer some LGNTs (1 LGNT should do) to the user of step 2.
- Switch back to the regular user and, in the menu, click on "My Logion Protection".
- Click on "Activate" button and sign the transaction (this actually creates the recovery configuration on-chain, see recovery pallet documentation).
- With the Polkadot JS app, see that the account is now recoverable.
Below steps are executed by an existing user which wants to gain access to one of its protected accounts after he/she lost the keys. Essentially, the process consists in creating a new account and asking to the legal officers which protected the lost account (the "friends") to "vouch" for the recovery request on-chain. Once both legal officers vouched for the request (after doing their due diligence), the user can claim the access to the lost account using the new one. The new account then acts as a proxy and can be used to transfer all the assets in the lost account to the new account.
- If not already done, run steps of "Account protection" use case.
- Log in as another regular user and Alice.
- Switch to account Alice, click on "Wallet", click on "Send" and transfer some LGNTs to the user of step 1.
- Switch to the user of step 1. In the dialog popping up, click on "Start a recovery process" button.
- Fill-in "Addresss to Recover" field with the address of the regular user used in "Account protection" use case.
- Click on "Initiate recovery" button (this initiates the recovery on-chain, see recovery pallet documentation).
- Choose the same legal officers as in "Account protection" use case (Alice and Bob), fill-in the form and click on "Next" button.
- Switch to legal officer Alice and click on "Recovery Requests" in the menu.
- Locate the recovery request in the table and click on "Review and process".
- Accept the request by clicking on "Proceed" button and select "Create the required Identity LOC". Click on "Submit", sign then click on "OK".
- Click on "Close and accept request", then click on "Confirm" and sign. Sign an additional transaction (this vouches for the recovery attempt on-chain, see recovery pallet documentation). You should now see the request marked as "Accepted" in the history.
- Switch to legal officer Bob, click on "Recovery Requests" in the menu and run steps 8, 9 and 10.
- Switch to the regular user of step 1 and click on "Recovery" in the menu.
- Click on "Activate" button and sign the transaction (this creates the recovery configuration on-chain, see recovery pallet documentation).
- Click on "Claim" (this claims the access to recovered account on-chain, see recovery pallet documentation).
- Click on "Transfer" to transfer your assets from recovered account.
Below steps simulate a disaster recovery. Step 2 essentially consists in erasing node 1's private data then restoring them (see script for more details).
- If not already done, add data to the private database (e.g. by running the steps of use case "Account protection").
- Wait for more or less one minute to make sure that all data were backed up (see here for a detailed explanation of why this is so).
- Run
./scripts/restore_demo.sh
: this will clear the private database of node 1 and restore the data from IPFS.
Below steps describe how a user, after activating its protection (step 0), is able to protect assets by transferring them into its Vault (steps 2 and 3) and how, later, it's able to transfer the assets back with one of its legal officers actually countersigning the operation (steps 6 to 9).
- If not already done, run steps of "Account protection" use case.
- Switch to the regular user
- In the menu, click on "Wallet" then "Send to Vault" button
- Set an amount (lower than available balance, mind the units), click "Transfer" and sign.
- In the menu, click on "Vault", you should now see the transferred LGNTs in your Vault (i.e. the multisig account).
- On the logion token row, click on "More".
- Click on "Request a vault-out transfer" then set the regular user's address, set an amount to transfer back and choose Alice.
- Click on transfer.
- Switch to legal officer Alice and, in the menu, click on "Vault-out requests".
- Click on the "V" in order to accept the request then click on "Proceed".
- Switch to the regular user and go back to the Vault, see that the transaction has been executed (Vault account balance is lower).