(image)

Programming Hotmoka
A tutorial on Hotmoka and smart contracts in Takamaka

2.5 Importing accounts

We have created afed291bbba43215…#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 afed291bbba43215c3d44124b2c46e06a803422edd55cf620811bc843c28baac#0
The following BIP39 words represent the account:
 1: husband
 2: soft
 3: obey
 4: try
 5: menu
 6: tag
 7: churn
 8: spoil
 9: laugh
10: already
11: vapor
12: crew
13: yard
14: nest
15: humble
16: innocent
17: craft
18: puppy
19: vital
20: liquid
21: enroll
22: giraffe
23: retreat
24: steak
25: addict
26: badge
27: resemble
28: process
29: wage
30: advice
31: eight
32: mountain
33: destroy
34: easy
35: private
36: voyage

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.