(image)

Programming Hotmoka
A tutorial on Hotmoka and smart contracts in Takamaka

2.5 Importing accounts

We have created 3fcbb8889b77be34…#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 3fcbb8889b77be347c3bfe0019683d3fefe2f58712085208c58cfc4d91add793#0
The following BIP39 words represent the account:
 1: orient
 2: joy
 3: timber
 4: light
 5: unveil
 6: effort
 7: quick
 8: broccoli
 9: tongue
10: box
11: job
12: mask
13: witness
14: sword
15: carbon
16: humble
17: sail
18: physical
19: auction
20: winter
21: account
22: reduce
23: visual
24: worth
25: title
26: promote
27: setup
28: awful
29: calm
30: glare
31: crop
32: meadow
33: museum
34: huge
35: top
36: feel

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.