diff --git a/res/ui/accountConfigurationDialog.ui b/res/ui/accountConfigurationDialog.ui
index 28d83eec363069d6aca71b6b58c1c4263c689cac..522ac2152bdd4f1edcee445d26fe5e792964a92d 100644
--- a/res/ui/accountConfigurationDialog.ui
+++ b/res/ui/accountConfigurationDialog.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>400</width>
-    <height>300</height>
+    <height>238</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -30,6 +30,19 @@
           <string>Account parameters</string>
          </property>
          <layout class="QVBoxLayout" name="verticalLayout_2">
+          <item>
+           <spacer name="verticalSpacer_3">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>20</width>
+              <height>40</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
           <item>
            <layout class="QHBoxLayout" name="horizontalLayout">
             <item>
@@ -45,24 +58,113 @@
            </layout>
           </item>
           <item>
-           <layout class="QHBoxLayout" name="horizontalLayout_2">
-            <item>
-             <widget class="QLabel" name="label_2">
-              <property name="text">
-               <string>PGPKey </string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QComboBox" name="combo_keys_list"/>
-            </item>
-           </layout>
+           <spacer name="verticalSpacer_4">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>20</width>
+              <height>40</height>
+             </size>
+            </property>
+           </spacer>
           </item>
          </layout>
         </widget>
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="page_gpg">
+      <layout class="QVBoxLayout" name="verticalLayout_7">
+       <item>
+        <widget class="QLabel" name="label_3">
+         <property name="text">
+          <string>Key parameters</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <layout class="QVBoxLayout" name="verticalLayout_6">
+           <item>
+            <layout class="QHBoxLayout" name="horizontalLayout_5">
+             <item>
+              <widget class="QLineEdit" name="edit_secretkey_path"/>
+             </item>
+             <item>
+              <widget class="QPushButton" name="button_import">
+               <property name="text">
+                <string>Import a secret key</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </item>
+           <item>
+            <widget class="QLabel" name="label_4">
+             <property name="text">
+              <string>OR</string>
+             </property>
+             <property name="alignment">
+              <set>Qt::AlignCenter</set>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <layout class="QHBoxLayout" name="horizontalLayout_6">
+             <property name="topMargin">
+              <number>5</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="label_fingerprint">
+               <property name="text">
+                <string/>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QPushButton" name="button_generate">
+               <property name="text">
+                <string>Generate a secret key</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
      <widget class="QWidget" name="page__communities">
       <layout class="QVBoxLayout" name="verticalLayout_5">
        <item>
@@ -224,6 +326,38 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>button_import</sender>
+   <signal>clicked()</signal>
+   <receiver>AccountConfigurationDialog</receiver>
+   <slot>open_import_key()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>312</x>
+     <y>175</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>149</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>button_generate</sender>
+   <signal>clicked()</signal>
+   <receiver>AccountConfigurationDialog</receiver>
+   <slot>open_generate_key()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>224</x>
+     <y>221</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>149</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>open_process_add_community()</slot>
@@ -232,5 +366,7 @@
   <slot>open_process_edit_community(QModelIndex)</slot>
   <slot>next()</slot>
   <slot>previous()</slot>
+  <slot>open_import_key()</slot>
+  <slot>open_generate_key()</slot>
  </slots>
 </ui>
diff --git a/src/cutecoin/core/__init__.py b/src/cutecoin/core/__init__.py
index c31390349a50a05e80fe754334ad6ce77f44f662..05fc098b10c6f04575e91bbe3c7c7b8729a6a2ad 100644
--- a/src/cutecoin/core/__init__.py
+++ b/src/cutecoin/core/__init__.py
@@ -7,6 +7,7 @@ Created on 1 févr. 2014
 import os
 import logging
 import json
+import gnupg
 
 from cutecoin.core import config
 from cutecoin.tools.exceptions import KeyAlreadyUsed
@@ -46,6 +47,9 @@ class Core(object):
     def del_account(self, account):
         self.accounts.remove(account)
 
+    def change_current_account(self, account):
+        self.current_account = account
+
     def load(self):
         if not os.path.exists(config.parameters['home']):
             logging.info("Creating home directory")
diff --git a/src/cutecoin/core/config.py b/src/cutecoin/core/config.py
index 61e73a1ee9bc3853ba7756641e10dff3143f8ebb..38c16c2322c9f35e483a42ddc325a2e3525517ca 100644
--- a/src/cutecoin/core/config.py
+++ b/src/cutecoin/core/config.py
@@ -21,7 +21,7 @@ else:
     config_path = path.dirname(__file__)
 
 parameters = {'home': config_path + '/cutecoin/',
-              'data': config_path + '/cutecoin/' 'data'}
+              'data': config_path + '/cutecoin/' + 'data'}
 
 
 def parse_arguments(argv):
@@ -35,9 +35,6 @@ def parse_arguments(argv):
                       action="store_true", dest="debug", default=False,
                       help="Print DEBUG messages to stdout")
 
-    parser.add_option("--home", dest="home", default=parameters['home'],
-                      help="Set another home for cutecoin.")
-
     (options, args) = parser.parse_args(argv)
 
     if options.debug:
@@ -55,6 +52,4 @@ def parse_arguments(argv):
     logger = logging.getLogger("gnupg")
     logger.setLevel(logging.INFO)
 
-    parameters['home'] = options.home
-
     pass
diff --git a/src/cutecoin/gui/generateKeyDialog.py b/src/cutecoin/gui/generateKeyDialog.py
new file mode 100644
index 0000000000000000000000000000000000000000..add210b4a7dba5060998b46b09911d7c8578a96a
--- /dev/null
+++ b/src/cutecoin/gui/generateKeyDialog.py
@@ -0,0 +1,96 @@
+'''
+Created on 22 mai 2014
+
+@author: inso
+'''
+import re
+from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox, QProgressDialog
+from PyQt5.QtCore import QThread, pyqtSignal
+
+from cutecoin.models.person import Person
+
+from cutecoin.gen_resources.generateKeyDialog_uic import Ui_GenerateKeyDialog
+
+
+
+class TaskGenKey(QThread):
+    taskFinished = pyqtSignal()
+
+    def run(self):
+        self.key = self.account.gpg.gen_key(self.input_data)
+        self.taskFinished.emit()
+
+class GenerateKeyDialog(QDialog, Ui_GenerateKeyDialog):
+
+    '''
+    classdocs
+    '''
+
+    def __init__(self, account, parent=None):
+        '''
+        Constructor
+        '''
+        super(GenerateKeyDialog, self).__init__()
+        self.setupUi(self)
+        self.account = account
+        self.main_window = parent
+        self.button_box.button(QDialogButtonBox.Ok).setEnabled(False)
+
+    def accept(self):
+        name = self.edit_name.text()
+        passphrase = self.edit_password.text()
+        input_data = self.account.gpg.gen_key_input(key_type="RSA", key_length=2048,
+                                 name_real=name, passphrase=passphrase)
+
+        self.progress_dialog = QProgressDialog(self)
+        self.progress_dialog.setLabelText("Generating key...")
+        self.progress_dialog.setMinimum(0)
+        self.progress_dialog.setMaximum(0)
+        self.progress_dialog.setCancelButton(None)
+        self.progress_dialog.setValue(-1) # As set in Designer
+        self.progress_dialog.show()
+        self.gen_task = TaskGenKey()
+        self.gen_task.input_data = input_data
+        self.gen_task.account = self.account
+        self.gen_task.taskFinished.connect(self.gen_finished)
+        self.gen_task.run()
+
+    def gen_finished(self):
+        self.progress_dialog.close()
+        if self.account.keyid is not '':
+            self.account.gpg.delete_keys(self.account.keyid)
+
+        key = self.gen_task.key
+        secret_keys = self.account.gpg.list_keys(True)
+        for k in secret_keys:
+            if k['fingerprint'] == key.fingerprint:
+                self.account.keyid = k['keyid']
+
+        print(self.account.keyid)
+
+        QMessageBox.information(self, "Key generation", "Key " +
+                                key.fingerprint + " has been generated",
+                        QMessageBox.Ok)
+        self.main_window.label_fingerprint.setText("Key : " + key.fingerprint)
+        self.main_window.button_next.setEnabled(True)
+        self.close()
+
+    def check(self):
+        if len(self.edit_password.text()) < 8:
+            self.label_errors.setText("Please enter a password with more than 8 characters")
+            self.button_box.button(QDialogButtonBox.Ok).setEnabled(False)
+            return
+        elif self.edit_password.text() != self.edit_password_bis.text():
+            self.label_errors.setText("Passphrases do not match")
+            self.button_box.button(QDialogButtonBox.Ok).setEnabled(False)
+            return
+        else:
+            pattern = re.compile("([A-Za-z-.]+ )([A-Za-z-.]+( )*)+")
+            if not pattern.match(self.edit_name.text()):
+                self.label_errors.setText("Please enter your name and family name.")
+                self.button_box.button(QDialogButtonBox.Ok).setEnabled(False)
+                return
+
+        self.label_errors.setText("")
+        self.button_box.button(QDialogButtonBox.Ok).setEnabled(True)
+
diff --git a/src/cutecoin/gui/mainWindow.py b/src/cutecoin/gui/mainWindow.py
index 88b356e6a5bfbff348d2e45f101c793116686d1e..92202f5b329eeafa3d193272ec9940ab8f4f17d7 100644
--- a/src/cutecoin/gui/mainWindow.py
+++ b/src/cutecoin/gui/mainWindow.py
@@ -113,7 +113,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 
     def refresh_wallets(self):
         for wallet in self.core.current_account.wallets:
-            wallet.refresh_coins()
+            wallet.refresh_coins(self.core.current_account.gpg)
 
         wallets_list_model = WalletsListModel(self.core.current_account)
         self.list_wallets.setModel(wallets_list_model)
diff --git a/src/cutecoin/gui/processConfigureAccount.py b/src/cutecoin/gui/processConfigureAccount.py
index 4dc3b0be4cc975233366d533307eedab703b5205..c7171714a27a57de6dccc9119f005a1bc070e56e 100644
--- a/src/cutecoin/gui/processConfigureAccount.py
+++ b/src/cutecoin/gui/processConfigureAccount.py
@@ -4,6 +4,7 @@ Created on 6 mars 2014
 @author: inso
 '''
 from cutecoin.gen_resources.accountConfigurationDialog_uic import Ui_AccountConfigurationDialog
+from cutecoin.gui.generateKeyDialog import GenerateKeyDialog
 from cutecoin.gui.processConfigureCommunity import ProcessConfigureCommunity
 from cutecoin.models.account.communities.listModel import CommunitiesListModel
 from cutecoin.tools.exceptions import KeyAlreadyUsed
@@ -11,8 +12,9 @@ from cutecoin.models.account import Account
 from cutecoin.models.account.communities import Communities
 from cutecoin.models.account.wallets import Wallets
 from cutecoin.models.node import Node
+from cutecoin.core import config
 
-from PyQt5.QtWidgets import QDialog, QErrorMessage, QInputDialog
+from PyQt5.QtWidgets import QDialog, QErrorMessage, QFileDialog, QMessageBox
 
 import gnupg
 
@@ -35,10 +37,42 @@ class StepPageInit(Step):
         return True
 
     def process_next(self):
-        pass
+        if self.config_dialog.account is None:
+            self.config_dialog.account = Account.create(
+                self.config_dialog.edit_account_name.text(),
+                Communities.create(),
+                Wallets.create(),
+                config.parameters)
+        else:
+            name = self.config_dialog.edit_account_name.text()
+            self.config_dialog.account.name = name
+
+    def display_page(self):
+        if self.config_dialog.account is not None:
+            self.config_dialog.edit_account_name.setText(self.config_dialog.account.name)
+            model = CommunitiesListModel(self.config_dialog.account)
+            self.config_dialog.list_communities.setModel(model)
+
+        self.config_dialog.button_previous.setEnabled(False)
+
+
+class StepPageGPG(Step):
+    '''
+    First step when adding a community
+    '''
+    def __init__(self, config_dialog):
+        super().__init__(config_dialog)
+
+    def is_valid(self):
+        return self.config_dialog.account.keyid != ''
+
+    def process_next(self):
+        model = CommunitiesListModel(self.config_dialog.account)
+        self.config_dialog.list_communities.setModel(model)
 
     def display_page(self):
         self.config_dialog.button_previous.setEnabled(False)
+        self.config_dialog.button_next.setEnabled(False)
 
 
 class StepPageCommunities(Step):
@@ -64,6 +98,7 @@ class StepPageCommunities(Step):
         #TODO: Get existing Wallet from ucoin node
         account.wallets.add_wallet(account.keyid,
                                    self.config_dialog.community)
+        self.config_dialog.refresh()
 
     def display_page(self):
         self.config_dialog.button_previous.setEnabled(False)
@@ -87,39 +122,18 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog):
         self.account = account
         self.core = core
         step_init = StepPageInit(self)
+        step_gpg = StepPageGPG(self)
         step_communities = StepPageCommunities(self)
-        step_init.next_step = step_communities
+        step_init.next_step = step_gpg
+        step_gpg.next_step = step_communities
         self.step = step_init
         self.step.display_page()
         if self.account is None:
             self.setWindowTitle("New account")
         else:
+            self.stacked_pages.removeWidget(self.stacked_pages.widget(1))
+            step_init.next_step = step_communities
             self.setWindowTitle("Configure " + self.account.name)
-            self.combo_keys_list.setEnabled(False)
-
-        self.set_data()
-
-    def set_data(self):
-        gpg = gnupg.GPG()
-        self.combo_keys_list.clear()
-        available_keys = gpg.list_keys(True)
-
-        if self.account is None:
-            self.account = Account.create(
-                available_keys[0]['keyid'],
-                "",
-                Communities.create(),
-                Wallets.create())
-            self.combo_keys_list.currentIndexChanged[
-                int].connect(self.key_changed)
-
-        for index, key in enumerate(available_keys):
-            self.combo_keys_list.addItem(key['uids'][0])
-            if (key['keyid']) == self.account.keyid:
-                self.combo_keys_list.setCurrentIndex(index)
-
-        self.list_communities.setModel(CommunitiesListModel(self.account))
-        self.edit_account_name.setText(self.account.name)
 
     def open_process_add_community(self):
         dialog = ProcessConfigureCommunity(self.account, None)
@@ -127,8 +141,6 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog):
         dialog.exec_()
 
     def action_add_community(self):
-        self.combo_keys_list.setEnabled(False)
-        self.combo_keys_list.disconnect()
         self.list_communities.setModel(CommunitiesListModel(self.account))
 
     def action_remove_community(self):
@@ -148,10 +160,35 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog):
         dialog.accepted.connect(self.action_edit_community)
         dialog.exec_()
 
-    def key_changed(self, key_index):
-        gpg = gnupg.GPG()
-        available_keys = gpg.list_keys(True)
-        self.account.keyid = available_keys[key_index]['keyid']
+    def open_generate_key(self):
+        dialog = GenerateKeyDialog(self.account, self)
+        dialog.exec_()
+
+    def open_import_key(self):
+        keyfile = QFileDialog.getOpenFileName(self,
+                                              "Choose a secret key",
+                                              "",
+                                              "All key files (*.asc);; Any file (*)")
+        keyfile = keyfile[0]
+        key = open(keyfile).read()
+        result = self.account.gpg.import_keys(key)
+        if result.count == 0:
+            QErrorMessage(self).showMessage("Bad key file")
+        else:
+            QMessageBox.information(self, "Key import", "Key " +
+                                    result.fingerprints[0] + " has been imported",
+                            QMessageBox.Ok)
+            if self.account.keyid is not '':
+                self.account.gpg.delete_keys(self.account.keyid)
+
+            secret_keys = self.account.gpg.list_keys(True)
+            for k in secret_keys:
+                if k['fingerprint'] == result.fingerprints[0]:
+                    self.account.keyid = k['keyid']
+
+            self.label_fingerprint.setText("Key : " + result.fingerprints[0])
+            self.edit_secretkey_path.setText(keyfile)
+            self.button_next.setEnabled(True)
 
     def next(self):
         if self.step.next_step is not None:
diff --git a/src/cutecoin/gui/processConfigureCommunity.py b/src/cutecoin/gui/processConfigureCommunity.py
index 4e5e60a489ed7864ac08ad42cf438839f2669684..4b1c970e81012f8b78c2ec77e101c439963084e3 100644
--- a/src/cutecoin/gui/processConfigureCommunity.py
+++ b/src/cutecoin/gui/processConfigureCommunity.py
@@ -187,7 +187,7 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog):
     def accept(self):
         #TODO: Push wht only if changed
         for wallet in self.account.wallets:
-            wallet.push_wht()
+            wallet.push_wht(self.account.gpg)
 
         self.accepted.emit()
         self.close()
diff --git a/src/cutecoin/models/account/__init__.py b/src/cutecoin/models/account/__init__.py
index f043b20da33c0f9479507d06e1165e1012279ed4..635645d450f4f67e1443a90edf88ff009d3b3d0b 100644
--- a/src/cutecoin/models/account/__init__.py
+++ b/src/cutecoin/models/account/__init__.py
@@ -23,7 +23,8 @@ class Account(object):
     be locally referenced by only one account.
     '''
 
-    def __init__(self, keyid, name, communities, wallets, contacts):
+    def __init__(self, keyid, name, communities, wallets, contacts,
+                 keyring, secret_keyring):
         '''
         Constructor
         '''
@@ -33,19 +34,28 @@ class Account(object):
         print(len(communities))
         self.wallets = wallets
         self.contacts = contacts
+        self.keyring = keyring
+        self.secret_keyring = secret_keyring
+        self.gpg = gnupg.GPG(keyring=self.keyring,
+                    secret_keyring=self.secret_keyring)
 
     @classmethod
-    def create(cls, keyid, name, communities, wallets):
+    def create(cls, name, communities, wallets, confpath):
         '''
         Constructor
         '''
-        account = cls(keyid, name, communities, wallets, [])
+        keyring = confpath['home'] + name + "_keyring"
+        secret_keyring = confpath['home'] + name + "_secretkeyring"
+        account = cls('', name, communities, wallets, [],
+                      keyring, secret_keyring)
         return account
 
     @classmethod
     def load(cls, json_data):
         keyid = json_data['keyid']
         name = json_data['name']
+        keyring = json_data['keyring']
+        secret_keyring = json_data['secret_keyring']
         contacts = []
 
         for contact_data in json_data['contacts']:
@@ -54,7 +64,8 @@ class Account(object):
         wallets = Wallets.load(json_data['wallets'])
         communities = Communities.load(json_data['communities'])
 
-        account = cls(keyid, name, communities, wallets, contacts)
+        account = cls(keyid, name, communities, wallets, contacts,
+                      keyring, secret_keyring)
         return account
 
     def __eq__(self, other):
@@ -72,14 +83,14 @@ class Account(object):
         amendment_data = promoted.get()
         currency = amendment_data['currency']
         community = self.communities.add_community(currency)
-        self.wallets.add_wallet(self.keyid,
+        self.wallets.add_wallet(self.gpg,
+                                self.keyid,
                                    currency,
                                    default_node)
         return community
 
     def fingerprint(self):
-        gpg = gnupg.GPG()
-        available_keys = gpg.list_keys()
+        available_keys = self.gpg.list_keys()
         logging.debug(self.keyid)
         for k in available_keys:
             logging.debug(k)
@@ -90,14 +101,14 @@ class Account(object):
     def transactions_received(self):
         received = []
         for w in self.wallets:
-            for r in w.transactions_received():
+            for r in w.transactions_received(self.gpg):
                 received.append(r)
         return received
 
     def transactions_sent(self):
         sent = []
         for w in self.wallets:
-            for t in w.transactions_sent():
+            for t in w.transactions_sent(self.gpg):
                 sent.append(t)
         return sent
 
@@ -116,5 +127,7 @@ class Account(object):
                 'keyid': self.keyid,
                 'communities': self.communities.jsonify(),
                 'wallets': self.wallets.jsonify(),
-                'contacts': self.jsonify_contacts()}
+                'contacts': self.jsonify_contacts(),
+                'keyring': self.keyring,
+                'secret_keyring': self.secret_keyring}
         return data
diff --git a/src/cutecoin/models/account/wallets/__init__.py b/src/cutecoin/models/account/wallets/__init__.py
index 0a9ae2395b0d3753f26e93fc02f5e730a5056cff..aa5f370a8a6b0ac3079e49a16240245d6fcc9e09 100644
--- a/src/cutecoin/models/account/wallets/__init__.py
+++ b/src/cutecoin/models/account/wallets/__init__.py
@@ -46,7 +46,7 @@ class Wallets(object):
     def __getitem__(self, key):
         return self._wallets_list[key]
 
-    def add_wallet(self, keyid, community, node,
+    def add_wallet(self, gpg, keyid, community, node,
                    required_trusts=1, name="Main Wallet"):
         '''
         Create a new wallet of a specific currency.
@@ -54,7 +54,7 @@ class Wallets(object):
         wallet = Wallet.create(keyid, community, node,
                                required_trusts, name)
         # We try to add already present nodes to the wallet
-        present_nodes = wallet.get_nodes_in_peering(wallet.pull_wht())
+        present_nodes = wallet.get_nodes_in_peering(wallet.pull_wht(gpg))
         if present_nodes is None:
             present_nodes = []
 
diff --git a/src/cutecoin/models/wallet/__init__.py b/src/cutecoin/models/wallet/__init__.py
index 3112b513c651f2ce50f6d9850cef06e3d74e34b8..8d6e6997ba36b646cbbbe5d005162e0f56845d9d 100644
--- a/src/cutecoin/models/wallet/__init__.py
+++ b/src/cutecoin/models/wallet/__init__.py
@@ -9,6 +9,7 @@ import logging
 import gnupg
 import json
 import time
+import hashlib
 import importlib
 from cutecoin.models.coin import Coin
 from cutecoin.models.coin import algorithms
@@ -66,24 +67,72 @@ class Wallet(object):
         return value
 
     #TODO: Enhance this code. Loading the amendment each time we load a coin is bad
-    def refresh_coins(self):
+    def refresh_coins(self, gpg):
         self.coins = []
-        coins_list_request = ucoin.hdc.coins.List(self.fingerprint())
+        coins_list_request = ucoin.hdc.coins.List(self.fingerprint(gpg))
         data = self.request(coins_list_request)
         for coin_data in data['coins']:
             coin = Coin.from_id(self, coin_data)
             self.coins.append(coin)
 
-    def transfer_coins(self, recipient, coins, message):
-        #TODO: Do my own wrapper
-        transfer = ucoin.wrappers.transactions.Transaction(
-            self.fingerprint(),
-            recipient.fingerprint,
-            coins,
-            message,
-            keyid=self.keyid,
-            server=self.trusts()[0].server,
-            port=self.trusts()[0].port)
+    def transfer_coins(self, recipient, coins, message, gpg):
+        coins.sort()
+        try:
+            lasttx_req = ucoin.hdc.transactions.sender.Last(count=1,
+                                                            pgp_fingerprint=self.fingerprint())
+            last_tx = self.request(lasttx_req)
+            last_tx = last_tx['transactions'][0]
+            txview_req = ucoin.hdc.transactions.sender.View(self.fingerprint(),
+                                                            tx_number=last_tx['number'])
+            last_tx = self.request(txview_req)
+        except ValueError:
+            last_tx = None
+
+        if last_tx:
+            previous_hash = hashlib.sha1(("%s%s" % (last_tx['raw'],
+                                                    last_tx['transaction']['signature'])
+                                          ).encode('ascii')).hexdigest().upper()
+        else:
+            previous_hash = None
+
+        context_data = {}
+        context_data['currency'] = self.currency
+        context_data['version'] = 1
+        context_data['number'] = 0 if not last_tx else last_tx['transaction']['number']+1
+        context_data['previousHash'] = previous_hash
+        context_data['message'] = message
+        context_data['fingerprint'] = self.fingerprint()
+        context_data['recipient'] = recipient.fingerprint
+        tx = """\
+Version: %(version)d
+Currency: %(currency)s
+Sender: %(fingerprint)s
+Number: %(number)d
+""" % context_data
+
+        if last_tx:
+            tx += "PreviousHash: %(previousHash)s\n" % context_data
+
+        tx += """\
+Recipient: %(recipient)s
+Coins:
+""" % context_data
+
+        for coin in coins:
+            tx += '%s' % coin
+            ownership_req = ucoin.hdc.coins.view.Owner(coin)
+            ownership = self.request(ownership_req)
+            if 'transaction' in ownership:
+                tx += ':%(transaction)s\n' % ownership
+            else:
+                tx += "\n"
+
+        tx += """\
+Comment:
+%(message)s""" % context_data
+
+        tx = tx.replace("\n", "\r\n")
+        txs = gpg.sign(tx, keyid=self.keyid, detach=True)
 
         try:
             wht_request = ucoin.network.Wallet(recipient.fingerprint)
@@ -94,14 +143,15 @@ class Wallet(object):
         nodes = self.get_nodes_in_peering(recipient_wht['entry']['trusts'])
         nodes += [h for h in self.hosters() if h not in nodes]
         result = self.broadcast(nodes,
-                                ucoin.hdc.transactions.Process(), transfer())
+                                ucoin.hdc.transactions.Process(),
+                                {'transaction': tx, 'signature': str(txs)})
         if result:
             return result
 
-    def transactions_received(self):
+    def transactions_received(self, gpg):
         received = []
         transactions_data = self.request(
-            ucoin.hdc.transactions.Recipient(self.fingerprint()))
+            ucoin.hdc.transactions.Recipient(self.fingerprint(gpg)))
         for trx_data in transactions_data:
             received.append(
                 Transaction.create(
@@ -110,11 +160,11 @@ class Wallet(object):
                     self))
         return received
 
-    def transactions_sent(self):
+    def transactions_sent(self, gpg):
         sent = []
         transactions_data = self.request(
             ucoin.hdc.transactions.sender.Last(
-                self.fingerprint(), 20))
+                self.fingerprint(gpg), 20))
         for trx_data in transactions_data['transactions']:
             # Small bug in ucoinpy library
             if not isinstance(trx_data, str):
@@ -125,14 +175,14 @@ class Wallet(object):
                         self))
         return sent
 
-    def pull_wht(self):
-        wht = self.request(ucoin.network.Wallet(self.fingerprint()))
+    def pull_wht(self, gpg):
+        wht = self.request(ucoin.network.Wallet(self.fingerprint(gpg)))
         if wht is None:
             return []
         else:
             return wht['entry']
 
-    def push_wht(self):
+    def push_wht(self, gpg):
         hosters_fg = []
         trusts_fg = []
         for trust in self.trusts():
@@ -149,7 +199,7 @@ Key: %s
 Date: %s
 RequiredTrusts: %d
 Hosters:
-''' % (self.currency, self.fingerprint(), int(time.time()),
+''' % (self.currency, self.fingerprint(gpg), int(time.time()),
        self.required_trusts)
         for hoster in hosters_fg:
             wht_message += '''%s\n''' % hoster
@@ -158,7 +208,6 @@ Hosters:
             wht_message += '''%s\n''' % trust
 
         wht_message = wht_message.replace("\n", "\r\n")
-        gpg = gnupg.GPG()
         signature = gpg.sign(wht_message, keyid=self.keyid, detach=True)
 
         data_post = {'entry': wht_message,
@@ -170,7 +219,6 @@ Hosters:
     # TODO: Check if its working
     def _search_node_by_fingerprint(self, node_fg, next_node, traversed_nodes=[]):
         next_fg = next_node.peering()['fingerprint']
-        print(traversed_nodes)
         if next_fg not in traversed_nodes:
             traversed_nodes.append(next_fg)
             if node_fg == next_fg:
@@ -250,8 +298,7 @@ Hosters:
             self.amendments_cache[am_number] = new_am
             return new_am
 
-    def fingerprint(self):
-        gpg = gnupg.GPG()
+    def fingerprint(self, gpg):
         available_keys = gpg.list_keys()
         logging.debug(self.keyid)
         for k in available_keys: