(image)

Programming Hotmoka
A tutorial on Hotmoka and smart contracts in Takamaka

2.5 Importing accounts

We have created 7a73a0a6f4df0515…#0 with moka and 826b150ccd5bf7ac…#0 with Mokito. We might want to import the former in Mokito and the latter in moka, so that we can operate on both accounts with both tools. In order to import 826b150ccd5bf7ac…#0 in moka, we can use the moka accounts import command and insert its 36 words passphrase from Fig. 2.7a:

moka accounts import bench cradle hat deer game nation stage extra elite alarm pupil eight sudden amused uniform clip catch apart alpha autumn fat away theme ski excuse truly gospel clay silent stairs route pyramid exile find outside
decade
The key pair of the account has been imported into "7d88107b595a2401481c07d53620f806524f1d2d93151c87a8af25784faad676#0.pem".

After that, it is possible to control that account with moka (if we remember its password, that is, chocolate).

(image)

(a) The menu of the accounts screen.

(image)

(b) Inserting the 36 words passphrase in Mokito.
Figure 2.8: In order to import an account in Mokito the top-right menu of the accounts screen allows one to insert the passphrase that identifies the account to import and its password.

(image)

Figure 2.9: The new account The Boss has been imported.

Vice versa, in order to import into Mokito the account that was created with moka, first export the 36 words of that account:

moka account export 7a73a0a6f4df05153f4bb3e86e04034cd8a8756ce3f9a1e91b9fa4c1c08c52a6#0
The following BIP39 words represent the account:
 1: famous
 2: furnace
 3: glad
 4: page
 5: sight
 6: call
 7: rocket
 8: joy
 9: olympic
10: vehicle
11: family
12: wife
13: poet
14: space
15: orange
16: orbit
17: agree
18: prepare
19: spray
20: guitar
21: manage
22: acoustic
23: artwork
24: only
25: position
26: problem
27: decline
28: viable
29: burden
30: miss
31: leader
32: oblige
33: scene
34: glad
35: praise
36: thing

Then go to the accounts page of Mokito and show the top-right menu of the accounts page; select Import account (see Fig. 2.8a). In the screen that will appear, insert the name that you want to give to the account, its password and its 36 words passphrase (Fig. 2.8b). Tap on the Import Account button. The new account will show in the list of available accounts (Fig. 2.9). From this moment, it will be possible to control the account from Mokito.

The 36 words of an account are enough for moving accounts around different clients. Note that clients do not contain accounts but only the cryptographic information needed to access the accounts. If a client is uninstalled, the accounts that it used still exist in the remote Hotmoka node and can still be re-imported and used in some other client, if we have written down their 36 words.