]> Git Repo - VerusCoin.git/commitdiff
Manual merge of jaromil's source tree reorg commit.
authorJeff Garzik <[email protected]>
Mon, 9 May 2011 18:00:14 +0000 (14:00 -0400)
committerJeff Garzik <[email protected]>
Mon, 9 May 2011 18:00:14 +0000 (14:00 -0400)
Conflicts:
src/sha256.cpp

14 files changed:
1  2 
doc/build-unix.txt
share/setup.nsi
share/uiproject.fbp
src/db.cpp
src/init.cpp
src/main.cpp
src/main.h
src/makefile.unix
src/rpc.cpp
src/serialize.h
src/ui.cpp
src/ui.h
src/uibase.cpp
src/uibase.h

index 0000000000000000000000000000000000000000,4494c752da85b906210fd23c4e4df67661f2e73f..0c4e88e5238c3cb325242f1292dce7b935d4597f
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,107 +1,110 @@@
 -Requires miniupnpc for UPnP port mapping.  To compile with UPnP support,
 -install miniupnpc and compile after setting USE_UPNP.  It can be downloaded
 -from http://miniupnp.tuxfamily.org/files/.  
+ Copyright (c) 2009-2010 Satoshi Nakamoto
+ Distributed under the MIT/X11 software license, see the accompanying
+ file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ This product includes software developed by the OpenSSL Project for use in
+ the OpenSSL Toolkit (http://www.openssl.org/).  This product includes
+ cryptographic software written by Eric Young ([email protected]) and UPnP
+ software written by Thomas Bernard.
+ UNIX BUILD NOTES
+ ================
+ To Build
+ --------
+ cd src/
+ make -f makefile.unix            # Bitcoin with wxWidgets GUI
+   or
+ make -f makefile.unix bitcoind   # Headless bitcoin
+ Dependencies
+ ------------
+ sudo apt-get install build-essential
+ sudo apt-get install libgtk2.0-dev
+ sudo apt-get install libssl-dev
+ sudo apt-get install libdb4.7-dev
+ sudo apt-get install libdb4.7++-dev
+ Boost 1.40+: sudo apt-get install libboost-all-dev
+ or Boost 1.37: sudo apt-get install libboost1.37-dev
+ If using Boost 1.37, append -mt to the boost libraries in the makefile.
+ Requires wxWidgets 2.9.0 or greater, which uses UTF-8.  Don't try 2.8, it
+ won't work.
+ You need to download wxWidgets from http://www.wxwidgets.org/downloads/
+ and build it yourself.  See the build instructions and configure parameters
+ below.
 -../configure --with-gtk --enable-debug --disable-shared --enable-monolithic
++Requires miniupnpc for UPnP port mapping.  It can be downloaded from
++http://miniupnp.tuxfamily.org/files/.  UPnP support is compiled in and
++turned off by default.  Set USE_UPNP to a different value to control this:
++USE_UPNP=   no UPnP support, miniupnp not required;
++USE_UPNP=0  (the default) UPnP support turned off by default at runtime;
++USE_UPNP=1  UPnP support turned on by default at runtime.
+ Licenses of statically linked libraries:
+ wxWidgets      LGPL 2.1 with very liberal exceptions
+ Berkeley DB    New BSD license with additional requirement that linked software must be free open source
+ Boost          MIT-like license
+ miniupnpc      New (3-clause) BSD license
+ Versions used in this release:
+ GCC          4.3.3
+ OpenSSL      0.9.8g
+ wxWidgets    2.9.0
+ Berkeley DB  4.7.25.NC
+ Boost        1.37
+ miniupnpc    1.5
+ Notes
+ -----
+ The UI layout is edited with wxFormBuilder.  The project file is
+ uiproject.fbp.  It generates uibase.cpp and uibase.h, which define base
+ classes that do the rote work of constructing all the UI elements.
+ The release is built with GCC and then "strip bitcoin" to strip the debug
+ symbols, which reduces the executable size by about 90%.
+ wxWidgets
+ ---------
+ cd /usr/local
+ tar -xzvf wxWidgets-2.9.0.tar.gz
+ cd wxWidgets-2.9.0
+ mkdir buildgtk
+ cd buildgtk
++../configure --with-gtk --enable-debug --disable-shared --enable-monolithic --without-libpng --disable-svg
+ make
+ sudo su
+ make install
+ ldconfig
+ miniupnpc
+ ---------
+ tar -xzvf miniupnpc-1.5.tar.gz
+ cd miniupnpc-1.5
+ make
+ sudo su
+ make install
+ Berkeley DB
+ -----------
+ You need Berkeley DB 4.7.  Don't use 4.8, the database/log0000* files
+ are incompatible.  If you have to build Berkeley DB yourself:
+ ../dist/configure --enable-cxx
+ make
+ Boost
+ -----
+ If you need to build Boost yourself:
+ sudo su
+ ./bootstrap.sh
+ ./bjam install
diff --cc share/setup.nsi
index 0000000000000000000000000000000000000000,a4efc603a2eb4ec780bee0b46aafb2dc0ee91b0b..b17e5533721e6d99b7fd6f6b74bb112aee0b51eb
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,151 +1,151 @@@
 -!define VERSION 0.3.21\r
+ Name Bitcoin\r
\r
+ RequestExecutionLevel highest\r
\r
+ # General Symbol Definitions\r
+ !define REGKEY "SOFTWARE\$(^Name)"\r
 -OutFile bitcoin-0.3.21-win32-setup.exe\r
++!define VERSION 0.3.22\r
+ !define COMPANY "Bitcoin project"\r
+ !define URL http://www.bitcoin.org/\r
\r
+ # MUI Symbol Definitions\r
+ !define MUI_ICON "src\rc\bitcoin.ico"\r
+ !define MUI_FINISHPAGE_NOAUTOCLOSE\r
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM\r
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}\r
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup\r
+ !define MUI_STARTMENUPAGE_DEFAULTFOLDER Bitcoin\r
+ !define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin.exe\r
+ !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"\r
+ !define MUI_UNFINISHPAGE_NOAUTOCLOSE\r
\r
+ # Included files\r
+ !include Sections.nsh\r
+ !include MUI2.nsh\r
\r
+ # Variables\r
+ Var StartMenuGroup\r
\r
+ # Installer pages\r
+ !insertmacro MUI_PAGE_WELCOME\r
+ !insertmacro MUI_PAGE_DIRECTORY\r
+ !insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup\r
+ !insertmacro MUI_PAGE_INSTFILES\r
+ !insertmacro MUI_PAGE_FINISH\r
+ !insertmacro MUI_UNPAGE_CONFIRM\r
+ !insertmacro MUI_UNPAGE_INSTFILES\r
\r
+ # Installer languages\r
+ !insertmacro MUI_LANGUAGE English\r
\r
+ # Installer attributes\r
 -VIProductVersion 0.3.21.0\r
++OutFile bitcoin-0.3.22-win32-setup.exe\r
+ InstallDir $PROGRAMFILES\Bitcoin\r
+ CRCCheck on\r
+ XPStyle on\r
+ ShowInstDetails show\r
++VIProductVersion 0.3.22.0\r
+ VIAddVersionKey ProductName Bitcoin\r
+ VIAddVersionKey ProductVersion "${VERSION}"\r
+ VIAddVersionKey CompanyName "${COMPANY}"\r
+ VIAddVersionKey CompanyWebsite "${URL}"\r
+ VIAddVersionKey FileVersion "${VERSION}"\r
+ VIAddVersionKey FileDescription ""\r
+ VIAddVersionKey LegalCopyright ""\r
+ InstallDirRegKey HKCU "${REGKEY}" Path\r
+ ShowUninstDetails show\r
\r
+ # Installer sections\r
+ Section -Main SEC0000\r
+     SetOutPath $INSTDIR\r
+     SetOverwrite on\r
+     File bitcoin.exe\r
+     File libeay32.dll\r
+     File license.txt\r
+     File readme.txt\r
+     SetOutPath $INSTDIR\daemon\r
+     File /r daemon\*.*\r
+     SetOutPath $INSTDIR\locale\r
+     File /r locale\*.*\r
+     SetOutPath $INSTDIR\src\r
+     File /r src\*.*\r
+     SetOutPath $INSTDIR\r
+     WriteRegStr HKCU "${REGKEY}\Components" Main 1\r
+ SectionEnd\r
\r
+ Section -post SEC0001\r
+     WriteRegStr HKCU "${REGKEY}" Path $INSTDIR\r
+     SetOutPath $INSTDIR\r
+     WriteUninstaller $INSTDIR\uninstall.exe\r
+     !insertmacro MUI_STARTMENU_WRITE_BEGIN Application\r
+     CreateDirectory $SMPROGRAMS\$StartMenuGroup\r
+     CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin.exe\r
+     CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe\r
+     !insertmacro MUI_STARTMENU_WRITE_END\r
+     WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"\r
+     WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"\r
+     WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"\r
+     WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"\r
+     WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe\r
+     WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe\r
+     WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1\r
+     WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1\r
+ SectionEnd\r
\r
+ # Macro for selecting uninstaller sections\r
+ !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID\r
+     Push $R0\r
+     ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"\r
+     StrCmp $R0 1 0 next${UNSECTION_ID}\r
+     !insertmacro SelectSection "${UNSECTION_ID}"\r
+     GoTo done${UNSECTION_ID}\r
+ next${UNSECTION_ID}:\r
+     !insertmacro UnselectSection "${UNSECTION_ID}"\r
+ done${UNSECTION_ID}:\r
+     Pop $R0\r
+ !macroend\r
\r
+ # Uninstaller sections\r
+ Section /o -un.Main UNSEC0000\r
+     Delete /REBOOTOK $INSTDIR\bitcoin.exe\r
+     Delete /REBOOTOK $INSTDIR\libeay32.dll\r
+     Delete /REBOOTOK $INSTDIR\license.txt\r
+     Delete /REBOOTOK $INSTDIR\readme.txt\r
+     RMDir /r /REBOOTOK $INSTDIR\daemon\r
+     RMDir /r /REBOOTOK $INSTDIR\locale\r
+     RMDir /r /REBOOTOK $INSTDIR\src\r
+     DeleteRegValue HKCU "${REGKEY}\Components" Main\r
+ SectionEnd\r
\r
+ Section -un.post UNSEC0001\r
+     DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"\r
+     Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk"\r
+     Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk"\r
+     Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"\r
+     Delete /REBOOTOK $INSTDIR\uninstall.exe\r
+     Delete /REBOOTOK $INSTDIR\debug.log\r
+     Delete /REBOOTOK $INSTDIR\db.log\r
+     DeleteRegValue HKCU "${REGKEY}" StartMenuGroup\r
+     DeleteRegValue HKCU "${REGKEY}" Path\r
+     DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components"\r
+     DeleteRegKey /IfEmpty HKCU "${REGKEY}"\r
+     RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup\r
+     RmDir /REBOOTOK $INSTDIR\r
+     Push $R0\r
+     StrCpy $R0 $StartMenuGroup 1\r
+     StrCmp $R0 ">" no_smgroup\r
+ no_smgroup:\r
+     Pop $R0\r
+ SectionEnd\r
\r
+ # Installer functions\r
+ Function .onInit\r
+     InitPluginsDir\r
+ FunctionEnd\r
\r
+ # Uninstaller functions\r
+ Function un.onInit\r
+     ReadRegStr $INSTDIR HKCU "${REGKEY}" Path\r
+     !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup\r
+     !insertmacro SELECT_UNSECTION Main ${UNSEC0000}\r
+ FunctionEnd\r
index 0000000000000000000000000000000000000000,d55566eefc5f708a460897525f1280f8098eee29..d9d46382d383f37bb12ecdd7edbb86e97d6ea916
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,6554 +1,6358 @@@
 -                    <object class="wxMenuItem" expanded="1">\r
 -                        <property name="bitmap"></property>\r
 -                        <property name="checked">0</property>\r
 -                        <property name="enabled">1</property>\r
 -                        <property name="help"></property>\r
 -                        <property name="id">wxID_OPTIONSGENERATEBITCOINS</property>\r
 -                        <property name="kind">wxITEM_CHECK</property>\r
 -                        <property name="label">&amp;Generate Coins</property>\r
 -                        <property name="name">m_menuOptionsGenerateBitcoins</property>\r
 -                        <property name="permission">none</property>\r
 -                        <property name="shortcut"></property>\r
 -                        <property name="unchecked_bitmap"></property>\r
 -                        <event name="OnMenuSelection">OnMenuOptionsGenerate</event>\r
 -                        <event name="OnUpdateUI">OnUpdateUIOptionsGenerate</event>\r
 -                    </object>\r
+ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\r
+ <wxFormBuilder_Project>\r
+     <FileVersion major="1" minor="9" />\r
+     <object class="Project" expanded="1">\r
+         <property name="class_decoration"></property>\r
+         <property name="code_generation">C++</property>\r
+         <property name="disconnect_events">1</property>\r
+         <property name="encoding">UTF-8</property>\r
+         <property name="event_generation">connect</property>\r
+         <property name="event_handler">impl_virtual</property>\r
+         <property name="file">uibase</property>\r
+         <property name="first_id">1000</property>\r
+         <property name="help_provider">none</property>\r
+         <property name="internationalize">1</property>\r
+         <property name="name"></property>\r
+         <property name="namespace"></property>\r
+         <property name="path">.</property>\r
+         <property name="precompiled_header"></property>\r
+         <property name="relative_path">1</property>\r
+         <property name="use_enum">0</property>\r
+         <property name="use_microsoft_bom">0</property>\r
+         <object class="Frame" expanded="0">\r
+             <property name="bg">wxSYS_COLOUR_BTNFACE</property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_MAINFRAME</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CMainFrameBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">723,484</property>\r
+             <property name="style">wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">Bitcoin</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style">wxTAB_TRAVERSAL</property>\r
+             <property name="xrc_skip_sizer">1</property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose">OnClose</event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize">OnIconize</event>\r
+             <event name="OnIdle">OnIdle</event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents">OnMouseEvents</event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint">OnPaint</event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxMenuBar" expanded="1">\r
+                 <property name="bg"></property>\r
+                 <property name="context_help"></property>\r
+                 <property name="enabled">1</property>\r
+                 <property name="fg"></property>\r
+                 <property name="font"></property>\r
+                 <property name="hidden">0</property>\r
+                 <property name="id">wxID_ANY</property>\r
+                 <property name="label">MyMenuBar</property>\r
+                 <property name="maximum_size"></property>\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">m_menubar</property>\r
+                 <property name="permission">protected</property>\r
+                 <property name="pos"></property>\r
+                 <property name="size"></property>\r
+                 <property name="style"></property>\r
+                 <property name="subclass"></property>\r
+                 <property name="tooltip"></property>\r
+                 <property name="validator_data_type"></property>\r
+                 <property name="validator_style">wxFILTER_NONE</property>\r
+                 <property name="validator_type">wxDefaultValidator</property>\r
+                 <property name="validator_variable"></property>\r
+                 <property name="window_extra_style"></property>\r
+                 <property name="window_name"></property>\r
+                 <property name="window_style"></property>\r
+                 <event name="OnChar"></event>\r
+                 <event name="OnEnterWindow"></event>\r
+                 <event name="OnEraseBackground"></event>\r
+                 <event name="OnKeyDown"></event>\r
+                 <event name="OnKeyUp"></event>\r
+                 <event name="OnKillFocus"></event>\r
+                 <event name="OnLeaveWindow"></event>\r
+                 <event name="OnLeftDClick"></event>\r
+                 <event name="OnLeftDown"></event>\r
+                 <event name="OnLeftUp"></event>\r
+                 <event name="OnMiddleDClick"></event>\r
+                 <event name="OnMiddleDown"></event>\r
+                 <event name="OnMiddleUp"></event>\r
+                 <event name="OnMotion"></event>\r
+                 <event name="OnMouseEvents"></event>\r
+                 <event name="OnMouseWheel"></event>\r
+                 <event name="OnPaint"></event>\r
+                 <event name="OnRightDClick"></event>\r
+                 <event name="OnRightDown"></event>\r
+                 <event name="OnRightUp"></event>\r
+                 <event name="OnSetFocus"></event>\r
+                 <event name="OnSize"></event>\r
+                 <event name="OnUpdateUI"></event>\r
+                 <object class="wxMenu" expanded="1">\r
+                     <property name="label">&amp;File</property>\r
+                     <property name="name">m_menuFile</property>\r
+                     <property name="permission">protected</property>\r
+                     <object class="wxMenuItem" expanded="1">\r
+                         <property name="bitmap"></property>\r
+                         <property name="checked">0</property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="help"></property>\r
+                         <property name="id">wxID_EXIT</property>\r
+                         <property name="kind">wxITEM_NORMAL</property>\r
+                         <property name="label">E&amp;xit</property>\r
+                         <property name="name">m_menuFileExit</property>\r
+                         <property name="permission">none</property>\r
+                         <property name="shortcut"></property>\r
+                         <property name="unchecked_bitmap"></property>\r
+                         <event name="OnMenuSelection">OnMenuFileExit</event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+                 <object class="wxMenu" expanded="1">\r
+                     <property name="label">&amp;Settings</property>\r
+                     <property name="name">m_menuOptions</property>\r
+                     <property name="permission">public</property>\r
 -                                                <object class="sizeritem" expanded="1">\r
 -                                                    <property name="border">5</property>\r
 -                                                    <property name="flag"></property>\r
 -                                                    <property name="proportion">0</property>\r
 -                                                    <object class="wxBoxSizer" expanded="1">\r
 -                                                        <property name="minimum_size"></property>\r
 -                                                        <property name="name">bSizer71</property>\r
 -                                                        <property name="orient">wxHORIZONTAL</property>\r
 -                                                        <property name="permission">none</property>\r
 -                                                        <object class="sizeritem" expanded="1">\r
 -                                                            <property name="border">5</property>\r
 -                                                            <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
 -                                                            <property name="proportion">0</property>\r
 -                                                            <object class="wxCheckBox" expanded="1">\r
 -                                                                <property name="bg"></property>\r
 -                                                                <property name="checked">0</property>\r
 -                                                                <property name="context_help"></property>\r
 -                                                                <property name="enabled">1</property>\r
 -                                                                <property name="fg"></property>\r
 -                                                                <property name="font"></property>\r
 -                                                                <property name="hidden">0</property>\r
 -                                                                <property name="id">wxID_ANY</property>\r
 -                                                                <property name="label">&amp;Limit coin generation to</property>\r
 -                                                                <property name="maximum_size"></property>\r
 -                                                                <property name="minimum_size"></property>\r
 -                                                                <property name="name">m_checkBoxLimitProcessors</property>\r
 -                                                                <property name="permission">protected</property>\r
 -                                                                <property name="pos"></property>\r
 -                                                                <property name="size"></property>\r
 -                                                                <property name="style"></property>\r
 -                                                                <property name="subclass"></property>\r
 -                                                                <property name="tooltip"></property>\r
 -                                                                <property name="validator_data_type"></property>\r
 -                                                                <property name="validator_style">wxFILTER_NONE</property>\r
 -                                                                <property name="validator_type">wxDefaultValidator</property>\r
 -                                                                <property name="validator_variable"></property>\r
 -                                                                <property name="window_extra_style"></property>\r
 -                                                                <property name="window_name"></property>\r
 -                                                                <property name="window_style"></property>\r
 -                                                                <event name="OnChar"></event>\r
 -                                                                <event name="OnCheckBox">OnCheckBoxLimitProcessors</event>\r
 -                                                                <event name="OnEnterWindow"></event>\r
 -                                                                <event name="OnEraseBackground"></event>\r
 -                                                                <event name="OnKeyDown"></event>\r
 -                                                                <event name="OnKeyUp"></event>\r
 -                                                                <event name="OnKillFocus"></event>\r
 -                                                                <event name="OnLeaveWindow"></event>\r
 -                                                                <event name="OnLeftDClick"></event>\r
 -                                                                <event name="OnLeftDown"></event>\r
 -                                                                <event name="OnLeftUp"></event>\r
 -                                                                <event name="OnMiddleDClick"></event>\r
 -                                                                <event name="OnMiddleDown"></event>\r
 -                                                                <event name="OnMiddleUp"></event>\r
 -                                                                <event name="OnMotion"></event>\r
 -                                                                <event name="OnMouseEvents"></event>\r
 -                                                                <event name="OnMouseWheel"></event>\r
 -                                                                <event name="OnPaint"></event>\r
 -                                                                <event name="OnRightDClick"></event>\r
 -                                                                <event name="OnRightDown"></event>\r
 -                                                                <event name="OnRightUp"></event>\r
 -                                                                <event name="OnSetFocus"></event>\r
 -                                                                <event name="OnSize"></event>\r
 -                                                                <event name="OnUpdateUI"></event>\r
 -                                                            </object>\r
 -                                                        </object>\r
 -                                                        <object class="sizeritem" expanded="1">\r
 -                                                            <property name="border">5</property>\r
 -                                                            <property name="flag">wxALIGN_CENTER_VERTICAL</property>\r
 -                                                            <property name="proportion">0</property>\r
 -                                                            <object class="wxSpinCtrl" expanded="1">\r
 -                                                                <property name="bg"></property>\r
 -                                                                <property name="context_help"></property>\r
 -                                                                <property name="enabled">1</property>\r
 -                                                                <property name="fg"></property>\r
 -                                                                <property name="font"></property>\r
 -                                                                <property name="hidden">0</property>\r
 -                                                                <property name="id">wxID_ANY</property>\r
 -                                                                <property name="initial">1</property>\r
 -                                                                <property name="max">999</property>\r
 -                                                                <property name="maximum_size"></property>\r
 -                                                                <property name="min">1</property>\r
 -                                                                <property name="minimum_size"></property>\r
 -                                                                <property name="name">m_spinCtrlLimitProcessors</property>\r
 -                                                                <property name="permission">protected</property>\r
 -                                                                <property name="pos"></property>\r
 -                                                                <property name="size">48,-1</property>\r
 -                                                                <property name="style">wxSP_ARROW_KEYS</property>\r
 -                                                                <property name="subclass"></property>\r
 -                                                                <property name="tooltip"></property>\r
 -                                                                <property name="validator_data_type"></property>\r
 -                                                                <property name="validator_style">wxFILTER_NONE</property>\r
 -                                                                <property name="validator_type">wxDefaultValidator</property>\r
 -                                                                <property name="validator_variable"></property>\r
 -                                                                <property name="value"></property>\r
 -                                                                <property name="window_extra_style"></property>\r
 -                                                                <property name="window_name"></property>\r
 -                                                                <property name="window_style"></property>\r
 -                                                                <event name="OnChar"></event>\r
 -                                                                <event name="OnEnterWindow"></event>\r
 -                                                                <event name="OnEraseBackground"></event>\r
 -                                                                <event name="OnKeyDown"></event>\r
 -                                                                <event name="OnKeyUp"></event>\r
 -                                                                <event name="OnKillFocus"></event>\r
 -                                                                <event name="OnLeaveWindow"></event>\r
 -                                                                <event name="OnLeftDClick"></event>\r
 -                                                                <event name="OnLeftDown"></event>\r
 -                                                                <event name="OnLeftUp"></event>\r
 -                                                                <event name="OnMiddleDClick"></event>\r
 -                                                                <event name="OnMiddleDown"></event>\r
 -                                                                <event name="OnMiddleUp"></event>\r
 -                                                                <event name="OnMotion"></event>\r
 -                                                                <event name="OnMouseEvents"></event>\r
 -                                                                <event name="OnMouseWheel"></event>\r
 -                                                                <event name="OnPaint"></event>\r
 -                                                                <event name="OnRightDClick"></event>\r
 -                                                                <event name="OnRightDown"></event>\r
 -                                                                <event name="OnRightUp"></event>\r
 -                                                                <event name="OnSetFocus"></event>\r
 -                                                                <event name="OnSize"></event>\r
 -                                                                <event name="OnSpinCtrl"></event>\r
 -                                                                <event name="OnSpinCtrlText"></event>\r
 -                                                                <event name="OnUpdateUI"></event>\r
 -                                                            </object>\r
 -                                                        </object>\r
 -                                                        <object class="sizeritem" expanded="1">\r
 -                                                            <property name="border">5</property>\r
 -                                                            <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
 -                                                            <property name="proportion">0</property>\r
 -                                                            <object class="wxStaticText" expanded="1">\r
 -                                                                <property name="bg"></property>\r
 -                                                                <property name="context_help"></property>\r
 -                                                                <property name="enabled">1</property>\r
 -                                                                <property name="fg"></property>\r
 -                                                                <property name="font"></property>\r
 -                                                                <property name="hidden">0</property>\r
 -                                                                <property name="id">wxID_ANY</property>\r
 -                                                                <property name="label">processors</property>\r
 -                                                                <property name="maximum_size"></property>\r
 -                                                                <property name="minimum_size"></property>\r
 -                                                                <property name="name">m_staticText35</property>\r
 -                                                                <property name="permission">protected</property>\r
 -                                                                <property name="pos"></property>\r
 -                                                                <property name="size"></property>\r
 -                                                                <property name="style"></property>\r
 -                                                                <property name="subclass"></property>\r
 -                                                                <property name="tooltip"></property>\r
 -                                                                <property name="validator_data_type"></property>\r
 -                                                                <property name="validator_style">wxFILTER_NONE</property>\r
 -                                                                <property name="validator_type">wxDefaultValidator</property>\r
 -                                                                <property name="validator_variable"></property>\r
 -                                                                <property name="window_extra_style"></property>\r
 -                                                                <property name="window_name"></property>\r
 -                                                                <property name="window_style"></property>\r
 -                                                                <property name="wrap">-1</property>\r
 -                                                                <event name="OnChar"></event>\r
 -                                                                <event name="OnEnterWindow"></event>\r
 -                                                                <event name="OnEraseBackground"></event>\r
 -                                                                <event name="OnKeyDown"></event>\r
 -                                                                <event name="OnKeyUp"></event>\r
 -                                                                <event name="OnKillFocus"></event>\r
 -                                                                <event name="OnLeaveWindow"></event>\r
 -                                                                <event name="OnLeftDClick"></event>\r
 -                                                                <event name="OnLeftDown"></event>\r
 -                                                                <event name="OnLeftUp"></event>\r
 -                                                                <event name="OnMiddleDClick"></event>\r
 -                                                                <event name="OnMiddleDown"></event>\r
 -                                                                <event name="OnMiddleUp"></event>\r
 -                                                                <event name="OnMotion"></event>\r
 -                                                                <event name="OnMouseEvents"></event>\r
 -                                                                <event name="OnMouseWheel"></event>\r
 -                                                                <event name="OnPaint"></event>\r
 -                                                                <event name="OnRightDClick"></event>\r
 -                                                                <event name="OnRightDown"></event>\r
 -                                                                <event name="OnRightUp"></event>\r
 -                                                                <event name="OnSetFocus"></event>\r
 -                                                                <event name="OnSize"></event>\r
 -                                                                <event name="OnUpdateUI"></event>\r
 -                                                            </object>\r
 -                                                        </object>\r
 -                                                    </object>\r
 -                                                </object>\r
+                     <object class="wxMenuItem" expanded="1">\r
+                         <property name="bitmap"></property>\r
+                         <property name="checked">0</property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="help"></property>\r
+                         <property name="id">wxID_ANY</property>\r
+                         <property name="kind">wxITEM_NORMAL</property>\r
+                         <property name="label">&amp;Your Receiving Addresses...</property>\r
+                         <property name="name">m_menuOptionsChangeYourAddress</property>\r
+                         <property name="permission">none</property>\r
+                         <property name="shortcut"></property>\r
+                         <property name="unchecked_bitmap"></property>\r
+                         <event name="OnMenuSelection">OnMenuOptionsChangeYourAddress</event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                     <object class="wxMenuItem" expanded="1">\r
+                         <property name="bitmap"></property>\r
+                         <property name="checked">0</property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="help"></property>\r
+                         <property name="id">wxID_PREFERENCES</property>\r
+                         <property name="kind">wxITEM_NORMAL</property>\r
+                         <property name="label">&amp;Options...</property>\r
+                         <property name="name">m_menuOptionsOptions</property>\r
+                         <property name="permission">none</property>\r
+                         <property name="shortcut"></property>\r
+                         <property name="unchecked_bitmap"></property>\r
+                         <event name="OnMenuSelection">OnMenuOptionsOptions</event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+                 <object class="wxMenu" expanded="1">\r
+                     <property name="label">&amp;Help</property>\r
+                     <property name="name">m_menuHelp</property>\r
+                     <property name="permission">protected</property>\r
+                     <object class="wxMenuItem" expanded="1">\r
+                         <property name="bitmap"></property>\r
+                         <property name="checked">0</property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="help"></property>\r
+                         <property name="id">wxID_ABOUT</property>\r
+                         <property name="kind">wxITEM_NORMAL</property>\r
+                         <property name="label">&amp;About...</property>\r
+                         <property name="name">m_menuHelpAbout</property>\r
+                         <property name="permission">none</property>\r
+                         <property name="shortcut"></property>\r
+                         <property name="unchecked_bitmap"></property>\r
+                         <event name="OnMenuSelection">OnMenuHelpAbout</event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+             <object class="wxToolBar" expanded="1">\r
+                 <property name="bg"></property>\r
+                 <property name="bitmapsize">20,20</property>\r
+                 <property name="context_help"></property>\r
+                 <property name="enabled">1</property>\r
+                 <property name="fg"></property>\r
+                 <property name="font">,90,90,-1,70,0</property>\r
+                 <property name="hidden">0</property>\r
+                 <property name="id">wxID_ANY</property>\r
+                 <property name="margins"></property>\r
+                 <property name="maximum_size"></property>\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">m_toolBar</property>\r
+                 <property name="packing">1</property>\r
+                 <property name="permission">protected</property>\r
+                 <property name="pos"></property>\r
+                 <property name="separation">1</property>\r
+                 <property name="size">-1,-1</property>\r
+                 <property name="style">wxTB_FLAT|wxTB_HORZ_TEXT</property>\r
+                 <property name="subclass"></property>\r
+                 <property name="tooltip"></property>\r
+                 <property name="validator_data_type"></property>\r
+                 <property name="validator_style">wxFILTER_NONE</property>\r
+                 <property name="validator_type">wxDefaultValidator</property>\r
+                 <property name="validator_variable"></property>\r
+                 <property name="window_extra_style"></property>\r
+                 <property name="window_name"></property>\r
+                 <property name="window_style"></property>\r
+                 <event name="OnChar"></event>\r
+                 <event name="OnEnterWindow"></event>\r
+                 <event name="OnEraseBackground"></event>\r
+                 <event name="OnKeyDown"></event>\r
+                 <event name="OnKeyUp"></event>\r
+                 <event name="OnKillFocus"></event>\r
+                 <event name="OnLeaveWindow"></event>\r
+                 <event name="OnLeftDClick"></event>\r
+                 <event name="OnLeftDown"></event>\r
+                 <event name="OnLeftUp"></event>\r
+                 <event name="OnMiddleDClick"></event>\r
+                 <event name="OnMiddleDown"></event>\r
+                 <event name="OnMiddleUp"></event>\r
+                 <event name="OnMotion"></event>\r
+                 <event name="OnMouseEvents"></event>\r
+                 <event name="OnMouseWheel"></event>\r
+                 <event name="OnPaint"></event>\r
+                 <event name="OnRightDClick"></event>\r
+                 <event name="OnRightDown"></event>\r
+                 <event name="OnRightUp"></event>\r
+                 <event name="OnSetFocus"></event>\r
+                 <event name="OnSize"></event>\r
+                 <event name="OnUpdateUI"></event>\r
+                 <object class="tool" expanded="1">\r
+                     <property name="bitmap">xpm/send20.xpm; Load From File</property>\r
+                     <property name="id">wxID_BUTTONSEND</property>\r
+                     <property name="kind">wxITEM_NORMAL</property>\r
+                     <property name="label">Send Coins</property>\r
+                     <property name="name">m_tool1</property>\r
+                     <property name="statusbar"></property>\r
+                     <property name="tooltip"></property>\r
+                     <event name="OnMenuSelection"></event>\r
+                     <event name="OnToolClicked">OnButtonSend</event>\r
+                     <event name="OnToolEnter"></event>\r
+                     <event name="OnToolRClicked"></event>\r
+                     <event name="OnUpdateUI"></event>\r
+                 </object>\r
+                 <object class="tool" expanded="1">\r
+                     <property name="bitmap">xpm/addressbook20.xpm; Load From File</property>\r
+                     <property name="id">wxID_BUTTONRECEIVE</property>\r
+                     <property name="kind">wxITEM_NORMAL</property>\r
+                     <property name="label">Address Book</property>\r
+                     <property name="name">m_tool2</property>\r
+                     <property name="statusbar"></property>\r
+                     <property name="tooltip"></property>\r
+                     <event name="OnMenuSelection"></event>\r
+                     <event name="OnToolClicked">OnButtonAddressBook</event>\r
+                     <event name="OnToolEnter"></event>\r
+                     <event name="OnToolRClicked"></event>\r
+                     <event name="OnUpdateUI"></event>\r
+                 </object>\r
+             </object>\r
+             <object class="wxStatusBar" expanded="1">\r
+                 <property name="bg"></property>\r
+                 <property name="context_help"></property>\r
+                 <property name="enabled">1</property>\r
+                 <property name="fg"></property>\r
+                 <property name="fields">1</property>\r
+                 <property name="font"></property>\r
+                 <property name="hidden">0</property>\r
+                 <property name="id">wxID_ANY</property>\r
+                 <property name="maximum_size"></property>\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">m_statusBar</property>\r
+                 <property name="permission">public</property>\r
+                 <property name="pos"></property>\r
+                 <property name="size"></property>\r
+                 <property name="style">wxST_SIZEGRIP</property>\r
+                 <property name="subclass"></property>\r
+                 <property name="tooltip"></property>\r
+                 <property name="validator_data_type"></property>\r
+                 <property name="validator_style">wxFILTER_NONE</property>\r
+                 <property name="validator_type">wxDefaultValidator</property>\r
+                 <property name="validator_variable"></property>\r
+                 <property name="window_extra_style"></property>\r
+                 <property name="window_name"></property>\r
+                 <property name="window_style"></property>\r
+                 <event name="OnChar"></event>\r
+                 <event name="OnEnterWindow"></event>\r
+                 <event name="OnEraseBackground"></event>\r
+                 <event name="OnKeyDown"></event>\r
+                 <event name="OnKeyUp"></event>\r
+                 <event name="OnKillFocus"></event>\r
+                 <event name="OnLeaveWindow"></event>\r
+                 <event name="OnLeftDClick"></event>\r
+                 <event name="OnLeftDown"></event>\r
+                 <event name="OnLeftUp"></event>\r
+                 <event name="OnMiddleDClick"></event>\r
+                 <event name="OnMiddleDown"></event>\r
+                 <event name="OnMiddleUp"></event>\r
+                 <event name="OnMotion"></event>\r
+                 <event name="OnMouseEvents"></event>\r
+                 <event name="OnMouseWheel"></event>\r
+                 <event name="OnPaint"></event>\r
+                 <event name="OnRightDClick"></event>\r
+                 <event name="OnRightDown"></event>\r
+                 <event name="OnRightUp"></event>\r
+                 <event name="OnSetFocus"></event>\r
+                 <event name="OnSize"></event>\r
+                 <event name="OnUpdateUI"></event>\r
+             </object>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer2</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="spacer" expanded="1">\r
+                         <property name="height">2</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="width">0</property>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer85</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxStaticText" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="label">Your Bitcoin Address:</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_staticText32</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <property name="wrap">-1</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxTextCtrl" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_TEXTCTRLADDRESS</property>\r
+                                 <property name="maximum_size">-1,-1</property>\r
+                                 <property name="maxlength">0</property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_textCtrlAddress</property>\r
+                                 <property name="permission">public</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">340,-1</property>\r
+                                 <property name="style">wxTE_READONLY</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="value"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown">OnKeyDown</event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents">OnMouseEventsAddress</event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus">OnSetFocusAddress</event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnText"></event>\r
+                                 <event name="OnTextEnter"></event>\r
+                                 <event name="OnTextMaxLen"></event>\r
+                                 <event name="OnTextURL"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONNEW</property>\r
+                                 <property name="label"> &amp;New... </property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_buttonNew</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style">wxBU_EXACTFIT</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonNew</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONCOPY</property>\r
+                                 <property name="label"> &amp;Copy to Clipboard </property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_buttonCopy</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style">wxBU_EXACTFIT</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCopy</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer3</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND|wxALL</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="wxBoxSizer" expanded="1">\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">bSizer66</property>\r
+                                 <property name="orient">wxHORIZONTAL</property>\r
+                                 <property name="permission">none</property>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>\r
+                                     <property name="proportion">0</property>\r
+                                     <object class="wxStaticText" expanded="1">\r
+                                         <property name="bg"></property>\r
+                                         <property name="context_help"></property>\r
+                                         <property name="enabled">1</property>\r
+                                         <property name="fg"></property>\r
+                                         <property name="font"></property>\r
+                                         <property name="hidden">0</property>\r
+                                         <property name="id">wxID_ANY</property>\r
+                                         <property name="label">Balance:</property>\r
+                                         <property name="maximum_size"></property>\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">m_staticText41</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="pos"></property>\r
+                                         <property name="size">-1,15</property>\r
+                                         <property name="style"></property>\r
+                                         <property name="subclass"></property>\r
+                                         <property name="tooltip"></property>\r
+                                         <property name="validator_data_type"></property>\r
+                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                         <property name="validator_variable"></property>\r
+                                         <property name="window_extra_style"></property>\r
+                                         <property name="window_name"></property>\r
+                                         <property name="window_style"></property>\r
+                                         <property name="wrap">-1</property>\r
+                                         <event name="OnChar"></event>\r
+                                         <event name="OnEnterWindow"></event>\r
+                                         <event name="OnEraseBackground"></event>\r
+                                         <event name="OnKeyDown"></event>\r
+                                         <event name="OnKeyUp"></event>\r
+                                         <event name="OnKillFocus"></event>\r
+                                         <event name="OnLeaveWindow"></event>\r
+                                         <event name="OnLeftDClick"></event>\r
+                                         <event name="OnLeftDown"></event>\r
+                                         <event name="OnLeftUp"></event>\r
+                                         <event name="OnMiddleDClick"></event>\r
+                                         <event name="OnMiddleDown"></event>\r
+                                         <event name="OnMiddleUp"></event>\r
+                                         <event name="OnMotion"></event>\r
+                                         <event name="OnMouseEvents"></event>\r
+                                         <event name="OnMouseWheel"></event>\r
+                                         <event name="OnPaint"></event>\r
+                                         <event name="OnRightDClick"></event>\r
+                                         <event name="OnRightDown"></event>\r
+                                         <event name="OnRightUp"></event>\r
+                                         <event name="OnSetFocus"></event>\r
+                                         <event name="OnSize"></event>\r
+                                         <event name="OnUpdateUI"></event>\r
+                                     </object>\r
+                                 </object>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
+                                     <property name="proportion">0</property>\r
+                                     <object class="wxStaticText" expanded="1">\r
+                                         <property name="bg">255,255,255</property>\r
+                                         <property name="context_help"></property>\r
+                                         <property name="enabled">1</property>\r
+                                         <property name="fg"></property>\r
+                                         <property name="font">,90,90,8,70,0</property>\r
+                                         <property name="hidden">0</property>\r
+                                         <property name="id">wxID_ANY</property>\r
+                                         <property name="label"></property>\r
+                                         <property name="maximum_size"></property>\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">m_staticTextBalance</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="pos"></property>\r
+                                         <property name="size">120,15</property>\r
+                                         <property name="style">wxALIGN_RIGHT|wxST_NO_AUTORESIZE</property>\r
+                                         <property name="subclass"></property>\r
+                                         <property name="tooltip"></property>\r
+                                         <property name="validator_data_type"></property>\r
+                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                         <property name="validator_variable"></property>\r
+                                         <property name="window_extra_style"></property>\r
+                                         <property name="window_name"></property>\r
+                                         <property name="window_style"></property>\r
+                                         <property name="wrap">-1</property>\r
+                                         <event name="OnChar"></event>\r
+                                         <event name="OnEnterWindow"></event>\r
+                                         <event name="OnEraseBackground"></event>\r
+                                         <event name="OnKeyDown"></event>\r
+                                         <event name="OnKeyUp"></event>\r
+                                         <event name="OnKillFocus"></event>\r
+                                         <event name="OnLeaveWindow"></event>\r
+                                         <event name="OnLeftDClick"></event>\r
+                                         <event name="OnLeftDown"></event>\r
+                                         <event name="OnLeftUp"></event>\r
+                                         <event name="OnMiddleDClick"></event>\r
+                                         <event name="OnMiddleDown"></event>\r
+                                         <event name="OnMiddleUp"></event>\r
+                                         <event name="OnMotion"></event>\r
+                                         <event name="OnMouseEvents"></event>\r
+                                         <event name="OnMouseWheel"></event>\r
+                                         <event name="OnPaint"></event>\r
+                                         <event name="OnRightDClick"></event>\r
+                                         <event name="OnRightDown"></event>\r
+                                         <event name="OnRightUp"></event>\r
+                                         <event name="OnSetFocus"></event>\r
+                                         <event name="OnSize"></event>\r
+                                         <event name="OnUpdateUI"></event>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_BOTTOM|wxTOP|wxRIGHT|wxLEFT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxChoice" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="choices">&quot; All&quot; &quot; Sent&quot; &quot; Received&quot; &quot; In Progress&quot;</property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">1</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_choiceFilter</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="selection">0</property>\r
+                                 <property name="size">110,-1</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnChoice"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxNotebook" expanded="1">\r
+                         <property name="bg"></property>\r
+                         <property name="bitmapsize"></property>\r
+                         <property name="context_help"></property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="fg"></property>\r
+                         <property name="font"></property>\r
+                         <property name="hidden">0</property>\r
+                         <property name="id">wxID_ANY</property>\r
+                         <property name="maximum_size"></property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">m_notebook</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="pos"></property>\r
+                         <property name="size"></property>\r
+                         <property name="style"></property>\r
+                         <property name="subclass"></property>\r
+                         <property name="tooltip"></property>\r
+                         <property name="validator_data_type"></property>\r
+                         <property name="validator_style">wxFILTER_NONE</property>\r
+                         <property name="validator_type">wxDefaultValidator</property>\r
+                         <property name="validator_variable"></property>\r
+                         <property name="window_extra_style"></property>\r
+                         <property name="window_name"></property>\r
+                         <property name="window_style"></property>\r
+                         <event name="OnChar"></event>\r
+                         <event name="OnEnterWindow"></event>\r
+                         <event name="OnEraseBackground"></event>\r
+                         <event name="OnKeyDown"></event>\r
+                         <event name="OnKeyUp"></event>\r
+                         <event name="OnKillFocus"></event>\r
+                         <event name="OnLeaveWindow"></event>\r
+                         <event name="OnLeftDClick"></event>\r
+                         <event name="OnLeftDown"></event>\r
+                         <event name="OnLeftUp"></event>\r
+                         <event name="OnMiddleDClick"></event>\r
+                         <event name="OnMiddleDown"></event>\r
+                         <event name="OnMiddleUp"></event>\r
+                         <event name="OnMotion"></event>\r
+                         <event name="OnMouseEvents"></event>\r
+                         <event name="OnMouseWheel"></event>\r
+                         <event name="OnNotebookPageChanged">OnNotebookPageChanged</event>\r
+                         <event name="OnNotebookPageChanging"></event>\r
+                         <event name="OnPaint"></event>\r
+                         <event name="OnRightDClick"></event>\r
+                         <event name="OnRightDown"></event>\r
+                         <event name="OnRightUp"></event>\r
+                         <event name="OnSetFocus"></event>\r
+                         <event name="OnSize"></event>\r
+                         <event name="OnUpdateUI"></event>\r
+                         <object class="notebookpage" expanded="1">\r
+                             <property name="bitmap"></property>\r
+                             <property name="label">All Transactions</property>\r
+                             <property name="select">1</property>\r
+                             <object class="wxPanel" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_panel9</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                                 <object class="wxBoxSizer" expanded="1">\r
+                                     <property name="minimum_size"></property>\r
+                                     <property name="name">bSizer11</property>\r
+                                     <property name="orient">wxVERTICAL</property>\r
+                                     <property name="permission">none</property>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">1</property>\r
+                                         <object class="wxListCtrl" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_listCtrlAll</property>\r
+                                             <property name="permission">public</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING</property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnListBeginDrag"></event>\r
+                                             <event name="OnListBeginLabelEdit"></event>\r
+                                             <event name="OnListBeginRDrag"></event>\r
+                                             <event name="OnListCacheHint"></event>\r
+                                             <event name="OnListColBeginDrag">OnListColBeginDrag</event>\r
+                                             <event name="OnListColClick"></event>\r
+                                             <event name="OnListColDragging"></event>\r
+                                             <event name="OnListColEndDrag"></event>\r
+                                             <event name="OnListColRightClick"></event>\r
+                                             <event name="OnListDeleteAllItems"></event>\r
+                                             <event name="OnListDeleteItem"></event>\r
+                                             <event name="OnListEndLabelEdit"></event>\r
+                                             <event name="OnListInsertItem"></event>\r
+                                             <event name="OnListItemActivated">OnListItemActivated</event>\r
+                                             <event name="OnListItemDeselected"></event>\r
+                                             <event name="OnListItemFocused"></event>\r
+                                             <event name="OnListItemMiddleClick"></event>\r
+                                             <event name="OnListItemRightClick"></event>\r
+                                             <event name="OnListItemSelected"></event>\r
+                                             <event name="OnListKeyDown"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint">OnPaintListCtrl</event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="notebookpage" expanded="1">\r
+                             <property name="bitmap"></property>\r
+                             <property name="label">Sent/Received</property>\r
+                             <property name="select">0</property>\r
+                             <object class="wxPanel" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_panel91</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                                 <object class="wxBoxSizer" expanded="1">\r
+                                     <property name="minimum_size"></property>\r
+                                     <property name="name">bSizer111</property>\r
+                                     <property name="orient">wxVERTICAL</property>\r
+                                     <property name="permission">none</property>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">1</property>\r
+                                         <object class="wxListCtrl" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_listCtrlSentReceived</property>\r
+                                             <property name="permission">public</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING</property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnListBeginDrag"></event>\r
+                                             <event name="OnListBeginLabelEdit"></event>\r
+                                             <event name="OnListBeginRDrag"></event>\r
+                                             <event name="OnListCacheHint"></event>\r
+                                             <event name="OnListColBeginDrag">OnListColBeginDrag</event>\r
+                                             <event name="OnListColClick"></event>\r
+                                             <event name="OnListColDragging"></event>\r
+                                             <event name="OnListColEndDrag"></event>\r
+                                             <event name="OnListColRightClick"></event>\r
+                                             <event name="OnListDeleteAllItems"></event>\r
+                                             <event name="OnListDeleteItem"></event>\r
+                                             <event name="OnListEndLabelEdit"></event>\r
+                                             <event name="OnListInsertItem"></event>\r
+                                             <event name="OnListItemActivated">OnListItemActivated</event>\r
+                                             <event name="OnListItemDeselected"></event>\r
+                                             <event name="OnListItemFocused"></event>\r
+                                             <event name="OnListItemMiddleClick"></event>\r
+                                             <event name="OnListItemRightClick"></event>\r
+                                             <event name="OnListItemSelected"></event>\r
+                                             <event name="OnListKeyDown"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint">OnPaintListCtrl</event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="notebookpage" expanded="1">\r
+                             <property name="bitmap"></property>\r
+                             <property name="label">Sent</property>\r
+                             <property name="select">0</property>\r
+                             <object class="wxPanel" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_panel92</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                                 <object class="wxBoxSizer" expanded="1">\r
+                                     <property name="minimum_size"></property>\r
+                                     <property name="name">bSizer112</property>\r
+                                     <property name="orient">wxVERTICAL</property>\r
+                                     <property name="permission">none</property>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">1</property>\r
+                                         <object class="wxListCtrl" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_listCtrlSent</property>\r
+                                             <property name="permission">public</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING</property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnListBeginDrag"></event>\r
+                                             <event name="OnListBeginLabelEdit"></event>\r
+                                             <event name="OnListBeginRDrag"></event>\r
+                                             <event name="OnListCacheHint"></event>\r
+                                             <event name="OnListColBeginDrag">OnListColBeginDrag</event>\r
+                                             <event name="OnListColClick"></event>\r
+                                             <event name="OnListColDragging"></event>\r
+                                             <event name="OnListColEndDrag"></event>\r
+                                             <event name="OnListColRightClick"></event>\r
+                                             <event name="OnListDeleteAllItems"></event>\r
+                                             <event name="OnListDeleteItem"></event>\r
+                                             <event name="OnListEndLabelEdit"></event>\r
+                                             <event name="OnListInsertItem"></event>\r
+                                             <event name="OnListItemActivated">OnListItemActivated</event>\r
+                                             <event name="OnListItemDeselected"></event>\r
+                                             <event name="OnListItemFocused"></event>\r
+                                             <event name="OnListItemMiddleClick"></event>\r
+                                             <event name="OnListItemRightClick"></event>\r
+                                             <event name="OnListItemSelected"></event>\r
+                                             <event name="OnListKeyDown"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint">OnPaintListCtrl</event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="notebookpage" expanded="1">\r
+                             <property name="bitmap"></property>\r
+                             <property name="label">Received</property>\r
+                             <property name="select">0</property>\r
+                             <object class="wxPanel" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_panel93</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                                 <object class="wxBoxSizer" expanded="1">\r
+                                     <property name="minimum_size"></property>\r
+                                     <property name="name">bSizer113</property>\r
+                                     <property name="orient">wxVERTICAL</property>\r
+                                     <property name="permission">none</property>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">1</property>\r
+                                         <object class="wxListCtrl" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_listCtrlReceived</property>\r
+                                             <property name="permission">public</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING</property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnListBeginDrag"></event>\r
+                                             <event name="OnListBeginLabelEdit"></event>\r
+                                             <event name="OnListBeginRDrag"></event>\r
+                                             <event name="OnListCacheHint"></event>\r
+                                             <event name="OnListColBeginDrag">OnListColBeginDrag</event>\r
+                                             <event name="OnListColClick"></event>\r
+                                             <event name="OnListColDragging"></event>\r
+                                             <event name="OnListColEndDrag"></event>\r
+                                             <event name="OnListColRightClick"></event>\r
+                                             <event name="OnListDeleteAllItems"></event>\r
+                                             <event name="OnListDeleteItem"></event>\r
+                                             <event name="OnListEndLabelEdit"></event>\r
+                                             <event name="OnListInsertItem"></event>\r
+                                             <event name="OnListItemActivated">OnListItemActivated</event>\r
+                                             <event name="OnListItemDeselected"></event>\r
+                                             <event name="OnListItemFocused"></event>\r
+                                             <event name="OnListItemMiddleClick"></event>\r
+                                             <event name="OnListItemRightClick"></event>\r
+                                             <event name="OnListItemSelected"></event>\r
+                                             <event name="OnListKeyDown"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint">OnPaintListCtrl</event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="0">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CTxDetailsDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">620,450</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">Transaction Details</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose"></event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint"></event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer64</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer66</property>\r
+                         <property name="orient">wxVERTICAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="wxHtmlWindow" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_htmlWin</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style">wxHW_SCROLLBAR_AUTO</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnHtmlCellClicked"></event>\r
+                                 <event name="OnHtmlCellHover"></event>\r
+                                 <event name="OnHtmlLinkClicked"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxALIGN_RIGHT</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer65</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_OK</property>\r
+                                 <property name="label">OK</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_buttonOK</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonOK</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="0">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">COptionsDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">540,360</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">Options</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose"></event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint"></event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer55</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">9</property>\r
+                     <property name="flag">wxEXPAND|wxALL</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer66</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND|wxRIGHT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxListBox" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="choices"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_listBox</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">110,-1</property>\r
+                                 <property name="style">wxLB_NEEDED_SB|wxLB_SINGLE</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnListBox">OnListBox</event>\r
+                                 <event name="OnListBoxDClick"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND|wxLEFT</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="wxScrolledWindow" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_scrolledWindow</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="scroll_rate_x">5</property>\r
+                                 <property name="scroll_rate_y">5</property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                                 <object class="wxBoxSizer" expanded="1">\r
+                                     <property name="minimum_size"></property>\r
+                                     <property name="name">bSizer63</property>\r
+                                     <property name="orient">wxVERTICAL</property>\r
+                                     <property name="permission">none</property>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">0</property>\r
+                                         <object class="wxPanel" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_panelMain</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint"></event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                             <object class="wxBoxSizer" expanded="1">\r
+                                                 <property name="minimum_size"></property>\r
+                                                 <property name="name">bSizer69</property>\r
+                                                 <property name="orient">wxVERTICAL</property>\r
+                                                 <property name="permission">none</property>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxEXPAND</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="spacer" expanded="1">\r
+                                                         <property name="height">16</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="width">0</property>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALL</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxCheckBox" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="checked">0</property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font"></property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">&amp;Start Bitcoin on system startup</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_checkBoxStartOnSystemStartup</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnCheckBox"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALL</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxCheckBox" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="checked">0</property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font"></property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">&amp;Minimize to the tray instead of the taskbar</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_checkBoxMinimizeToTray</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnCheckBox">OnCheckBoxMinimizeToTray</event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALL</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxCheckBox" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="checked">0</property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font"></property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">Map port using &amp;UPnP</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_checkBoxUseUPnP</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnCheckBox"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxCheckBox" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="checked">0</property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font"></property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">M&amp;inimize to the tray on close</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_checkBoxMinimizeOnClose</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnCheckBox"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxEXPAND</property>\r
+                                                     <property name="proportion">1</property>\r
+                                                     <object class="wxBoxSizer" expanded="1">\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">bSizer102</property>\r
+                                                         <property name="orient">wxHORIZONTAL</property>\r
+                                                         <property name="permission">none</property>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="wxCheckBox" expanded="1">\r
+                                                                 <property name="bg"></property>\r
+                                                                 <property name="checked">0</property>\r
+                                                                 <property name="context_help"></property>\r
+                                                                 <property name="enabled">1</property>\r
+                                                                 <property name="fg"></property>\r
+                                                                 <property name="font"></property>\r
+                                                                 <property name="hidden">0</property>\r
+                                                                 <property name="id">wxID_ANY</property>\r
+                                                                 <property name="label">&amp;Connect through socks4 proxy: </property>\r
+                                                                 <property name="maximum_size"></property>\r
+                                                                 <property name="minimum_size"></property>\r
+                                                                 <property name="name">m_checkBoxUseProxy</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="pos"></property>\r
+                                                                 <property name="size"></property>\r
+                                                                 <property name="style"></property>\r
+                                                                 <property name="subclass"></property>\r
+                                                                 <property name="tooltip"></property>\r
+                                                                 <property name="validator_data_type"></property>\r
+                                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                                 <property name="validator_variable"></property>\r
+                                                                 <property name="window_extra_style"></property>\r
+                                                                 <property name="window_name"></property>\r
+                                                                 <property name="window_style"></property>\r
+                                                                 <event name="OnChar"></event>\r
+                                                                 <event name="OnCheckBox">OnCheckBoxUseProxy</event>\r
+                                                                 <event name="OnEnterWindow"></event>\r
+                                                                 <event name="OnEraseBackground"></event>\r
+                                                                 <event name="OnKeyDown"></event>\r
+                                                                 <event name="OnKeyUp"></event>\r
+                                                                 <event name="OnKillFocus"></event>\r
+                                                                 <event name="OnLeaveWindow"></event>\r
+                                                                 <event name="OnLeftDClick"></event>\r
+                                                                 <event name="OnLeftDown"></event>\r
+                                                                 <event name="OnLeftUp"></event>\r
+                                                                 <event name="OnMiddleDClick"></event>\r
+                                                                 <event name="OnMiddleDown"></event>\r
+                                                                 <event name="OnMiddleUp"></event>\r
+                                                                 <event name="OnMotion"></event>\r
+                                                                 <event name="OnMouseEvents"></event>\r
+                                                                 <event name="OnMouseWheel"></event>\r
+                                                                 <event name="OnPaint"></event>\r
+                                                                 <event name="OnRightDClick"></event>\r
+                                                                 <event name="OnRightDown"></event>\r
+                                                                 <event name="OnRightUp"></event>\r
+                                                                 <event name="OnSetFocus"></event>\r
+                                                                 <event name="OnSize"></event>\r
+                                                                 <event name="OnUpdateUI"></event>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxEXPAND</property>\r
+                                                     <property name="proportion">1</property>\r
+                                                     <object class="wxBoxSizer" expanded="1">\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">bSizer103</property>\r
+                                                         <property name="orient">wxHORIZONTAL</property>\r
+                                                         <property name="permission">none</property>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag"></property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="spacer" expanded="1">\r
+                                                                 <property name="height">0</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="width">18</property>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="wxStaticText" expanded="1">\r
+                                                                 <property name="bg"></property>\r
+                                                                 <property name="context_help"></property>\r
+                                                                 <property name="enabled">1</property>\r
+                                                                 <property name="fg"></property>\r
+                                                                 <property name="font"></property>\r
+                                                                 <property name="hidden">0</property>\r
+                                                                 <property name="id">wxID_ANY</property>\r
+                                                                 <property name="label">Proxy &amp;IP:</property>\r
+                                                                 <property name="maximum_size"></property>\r
+                                                                 <property name="minimum_size"></property>\r
+                                                                 <property name="name">m_staticTextProxyIP</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="pos"></property>\r
+                                                                 <property name="size"></property>\r
+                                                                 <property name="style"></property>\r
+                                                                 <property name="subclass"></property>\r
+                                                                 <property name="tooltip"></property>\r
+                                                                 <property name="validator_data_type"></property>\r
+                                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                                 <property name="validator_variable"></property>\r
+                                                                 <property name="window_extra_style"></property>\r
+                                                                 <property name="window_name"></property>\r
+                                                                 <property name="window_style"></property>\r
+                                                                 <property name="wrap">-1</property>\r
+                                                                 <event name="OnChar"></event>\r
+                                                                 <event name="OnEnterWindow"></event>\r
+                                                                 <event name="OnEraseBackground"></event>\r
+                                                                 <event name="OnKeyDown"></event>\r
+                                                                 <event name="OnKeyUp"></event>\r
+                                                                 <event name="OnKillFocus"></event>\r
+                                                                 <event name="OnLeaveWindow"></event>\r
+                                                                 <event name="OnLeftDClick"></event>\r
+                                                                 <event name="OnLeftDown"></event>\r
+                                                                 <event name="OnLeftUp"></event>\r
+                                                                 <event name="OnMiddleDClick"></event>\r
+                                                                 <event name="OnMiddleDown"></event>\r
+                                                                 <event name="OnMiddleUp"></event>\r
+                                                                 <event name="OnMotion"></event>\r
+                                                                 <event name="OnMouseEvents"></event>\r
+                                                                 <event name="OnMouseWheel"></event>\r
+                                                                 <event name="OnPaint"></event>\r
+                                                                 <event name="OnRightDClick"></event>\r
+                                                                 <event name="OnRightDown"></event>\r
+                                                                 <event name="OnRightUp"></event>\r
+                                                                 <event name="OnSetFocus"></event>\r
+                                                                 <event name="OnSize"></event>\r
+                                                                 <event name="OnUpdateUI"></event>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag">wxALIGN_CENTER_VERTICAL</property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="wxTextCtrl" expanded="1">\r
+                                                                 <property name="bg"></property>\r
+                                                                 <property name="context_help"></property>\r
+                                                                 <property name="enabled">1</property>\r
+                                                                 <property name="fg"></property>\r
+                                                                 <property name="font"></property>\r
+                                                                 <property name="hidden">0</property>\r
+                                                                 <property name="id">wxID_PROXYIP</property>\r
+                                                                 <property name="maximum_size"></property>\r
+                                                                 <property name="maxlength">15</property>\r
+                                                                 <property name="minimum_size"></property>\r
+                                                                 <property name="name">m_textCtrlProxyIP</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="pos"></property>\r
+                                                                 <property name="size">140,-1</property>\r
+                                                                 <property name="style"></property>\r
+                                                                 <property name="subclass"></property>\r
+                                                                 <property name="tooltip"></property>\r
+                                                                 <property name="validator_data_type"></property>\r
+                                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                                 <property name="validator_variable"></property>\r
+                                                                 <property name="value"></property>\r
+                                                                 <property name="window_extra_style"></property>\r
+                                                                 <property name="window_name"></property>\r
+                                                                 <property name="window_style"></property>\r
+                                                                 <event name="OnChar"></event>\r
+                                                                 <event name="OnEnterWindow"></event>\r
+                                                                 <event name="OnEraseBackground"></event>\r
+                                                                 <event name="OnKeyDown"></event>\r
+                                                                 <event name="OnKeyUp"></event>\r
+                                                                 <event name="OnKillFocus">OnKillFocusProxy</event>\r
+                                                                 <event name="OnLeaveWindow"></event>\r
+                                                                 <event name="OnLeftDClick"></event>\r
+                                                                 <event name="OnLeftDown"></event>\r
+                                                                 <event name="OnLeftUp"></event>\r
+                                                                 <event name="OnMiddleDClick"></event>\r
+                                                                 <event name="OnMiddleDown"></event>\r
+                                                                 <event name="OnMiddleUp"></event>\r
+                                                                 <event name="OnMotion"></event>\r
+                                                                 <event name="OnMouseEvents"></event>\r
+                                                                 <event name="OnMouseWheel"></event>\r
+                                                                 <event name="OnPaint"></event>\r
+                                                                 <event name="OnRightDClick"></event>\r
+                                                                 <event name="OnRightDown"></event>\r
+                                                                 <event name="OnRightUp"></event>\r
+                                                                 <event name="OnSetFocus"></event>\r
+                                                                 <event name="OnSize"></event>\r
+                                                                 <event name="OnText"></event>\r
+                                                                 <event name="OnTextEnter"></event>\r
+                                                                 <event name="OnTextMaxLen"></event>\r
+                                                                 <event name="OnTextURL"></event>\r
+                                                                 <event name="OnUpdateUI"></event>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="wxStaticText" expanded="1">\r
+                                                                 <property name="bg"></property>\r
+                                                                 <property name="context_help"></property>\r
+                                                                 <property name="enabled">1</property>\r
+                                                                 <property name="fg"></property>\r
+                                                                 <property name="font"></property>\r
+                                                                 <property name="hidden">0</property>\r
+                                                                 <property name="id">wxID_ANY</property>\r
+                                                                 <property name="label"> &amp;Port:</property>\r
+                                                                 <property name="maximum_size"></property>\r
+                                                                 <property name="minimum_size"></property>\r
+                                                                 <property name="name">m_staticTextProxyPort</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="pos"></property>\r
+                                                                 <property name="size"></property>\r
+                                                                 <property name="style"></property>\r
+                                                                 <property name="subclass"></property>\r
+                                                                 <property name="tooltip"></property>\r
+                                                                 <property name="validator_data_type"></property>\r
+                                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                                 <property name="validator_variable"></property>\r
+                                                                 <property name="window_extra_style"></property>\r
+                                                                 <property name="window_name"></property>\r
+                                                                 <property name="window_style"></property>\r
+                                                                 <property name="wrap">-1</property>\r
+                                                                 <event name="OnChar"></event>\r
+                                                                 <event name="OnEnterWindow"></event>\r
+                                                                 <event name="OnEraseBackground"></event>\r
+                                                                 <event name="OnKeyDown"></event>\r
+                                                                 <event name="OnKeyUp"></event>\r
+                                                                 <event name="OnKillFocus"></event>\r
+                                                                 <event name="OnLeaveWindow"></event>\r
+                                                                 <event name="OnLeftDClick"></event>\r
+                                                                 <event name="OnLeftDown"></event>\r
+                                                                 <event name="OnLeftUp"></event>\r
+                                                                 <event name="OnMiddleDClick"></event>\r
+                                                                 <event name="OnMiddleDown"></event>\r
+                                                                 <event name="OnMiddleUp"></event>\r
+                                                                 <event name="OnMotion"></event>\r
+                                                                 <event name="OnMouseEvents"></event>\r
+                                                                 <event name="OnMouseWheel"></event>\r
+                                                                 <event name="OnPaint"></event>\r
+                                                                 <event name="OnRightDClick"></event>\r
+                                                                 <event name="OnRightDown"></event>\r
+                                                                 <event name="OnRightUp"></event>\r
+                                                                 <event name="OnSetFocus"></event>\r
+                                                                 <event name="OnSize"></event>\r
+                                                                 <event name="OnUpdateUI"></event>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag">wxALIGN_CENTER_VERTICAL</property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="wxTextCtrl" expanded="1">\r
+                                                                 <property name="bg"></property>\r
+                                                                 <property name="context_help"></property>\r
+                                                                 <property name="enabled">1</property>\r
+                                                                 <property name="fg"></property>\r
+                                                                 <property name="font"></property>\r
+                                                                 <property name="hidden">0</property>\r
+                                                                 <property name="id">wxID_PROXYPORT</property>\r
+                                                                 <property name="maximum_size"></property>\r
+                                                                 <property name="maxlength">5</property>\r
+                                                                 <property name="minimum_size"></property>\r
+                                                                 <property name="name">m_textCtrlProxyPort</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="pos"></property>\r
+                                                                 <property name="size">55,-1</property>\r
+                                                                 <property name="style"></property>\r
+                                                                 <property name="subclass"></property>\r
+                                                                 <property name="tooltip"></property>\r
+                                                                 <property name="validator_data_type"></property>\r
+                                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                                 <property name="validator_variable"></property>\r
+                                                                 <property name="value"></property>\r
+                                                                 <property name="window_extra_style"></property>\r
+                                                                 <property name="window_name"></property>\r
+                                                                 <property name="window_style"></property>\r
+                                                                 <event name="OnChar"></event>\r
+                                                                 <event name="OnEnterWindow"></event>\r
+                                                                 <event name="OnEraseBackground"></event>\r
+                                                                 <event name="OnKeyDown"></event>\r
+                                                                 <event name="OnKeyUp"></event>\r
+                                                                 <event name="OnKillFocus">OnKillFocusProxy</event>\r
+                                                                 <event name="OnLeaveWindow"></event>\r
+                                                                 <event name="OnLeftDClick"></event>\r
+                                                                 <event name="OnLeftDown"></event>\r
+                                                                 <event name="OnLeftUp"></event>\r
+                                                                 <event name="OnMiddleDClick"></event>\r
+                                                                 <event name="OnMiddleDown"></event>\r
+                                                                 <event name="OnMiddleUp"></event>\r
+                                                                 <event name="OnMotion"></event>\r
+                                                                 <event name="OnMouseEvents"></event>\r
+                                                                 <event name="OnMouseWheel"></event>\r
+                                                                 <event name="OnPaint"></event>\r
+                                                                 <event name="OnRightDClick"></event>\r
+                                                                 <event name="OnRightDown"></event>\r
+                                                                 <event name="OnRightUp"></event>\r
+                                                                 <event name="OnSetFocus"></event>\r
+                                                                 <event name="OnSize"></event>\r
+                                                                 <event name="OnText"></event>\r
+                                                                 <event name="OnTextEnter"></event>\r
+                                                                 <event name="OnTextMaxLen"></event>\r
+                                                                 <event name="OnTextURL"></event>\r
+                                                                 <event name="OnUpdateUI"></event>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag"></property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="spacer" expanded="1">\r
+                                                         <property name="height">1</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="width">0</property>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxStaticText" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font"></property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">Optional transaction fee per KB that helps make sure your transactions are processed quickly.  Most transactions are 1KB.  Fee 0.01 recommended.</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_staticText32</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <property name="wrap">365</property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxEXPAND</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxBoxSizer" expanded="1">\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">bSizer56</property>\r
+                                                         <property name="orient">wxHORIZONTAL</property>\r
+                                                         <property name="permission">none</property>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="wxStaticText" expanded="1">\r
+                                                                 <property name="bg"></property>\r
+                                                                 <property name="context_help"></property>\r
+                                                                 <property name="enabled">1</property>\r
+                                                                 <property name="fg"></property>\r
+                                                                 <property name="font"></property>\r
+                                                                 <property name="hidden">0</property>\r
+                                                                 <property name="id">wxID_ANY</property>\r
+                                                                 <property name="label">Pay transaction fee:</property>\r
+                                                                 <property name="maximum_size"></property>\r
+                                                                 <property name="minimum_size"></property>\r
+                                                                 <property name="name">m_staticText31</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="pos"></property>\r
+                                                                 <property name="size"></property>\r
+                                                                 <property name="style"></property>\r
+                                                                 <property name="subclass"></property>\r
+                                                                 <property name="tooltip"></property>\r
+                                                                 <property name="validator_data_type"></property>\r
+                                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                                 <property name="validator_variable"></property>\r
+                                                                 <property name="window_extra_style"></property>\r
+                                                                 <property name="window_name"></property>\r
+                                                                 <property name="window_style"></property>\r
+                                                                 <property name="wrap">-1</property>\r
+                                                                 <event name="OnChar"></event>\r
+                                                                 <event name="OnEnterWindow"></event>\r
+                                                                 <event name="OnEraseBackground"></event>\r
+                                                                 <event name="OnKeyDown"></event>\r
+                                                                 <event name="OnKeyUp"></event>\r
+                                                                 <event name="OnKillFocus"></event>\r
+                                                                 <event name="OnLeaveWindow"></event>\r
+                                                                 <event name="OnLeftDClick"></event>\r
+                                                                 <event name="OnLeftDown"></event>\r
+                                                                 <event name="OnLeftUp"></event>\r
+                                                                 <event name="OnMiddleDClick"></event>\r
+                                                                 <event name="OnMiddleDown"></event>\r
+                                                                 <event name="OnMiddleUp"></event>\r
+                                                                 <event name="OnMotion"></event>\r
+                                                                 <event name="OnMouseEvents"></event>\r
+                                                                 <event name="OnMouseWheel"></event>\r
+                                                                 <event name="OnPaint"></event>\r
+                                                                 <event name="OnRightDClick"></event>\r
+                                                                 <event name="OnRightDown"></event>\r
+                                                                 <event name="OnRightUp"></event>\r
+                                                                 <event name="OnSetFocus"></event>\r
+                                                                 <event name="OnSize"></event>\r
+                                                                 <event name="OnUpdateUI"></event>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                         <object class="sizeritem" expanded="1">\r
+                                                             <property name="border">5</property>\r
+                                                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
+                                                             <property name="proportion">0</property>\r
+                                                             <object class="wxTextCtrl" expanded="1">\r
+                                                                 <property name="bg"></property>\r
+                                                                 <property name="context_help"></property>\r
+                                                                 <property name="enabled">1</property>\r
+                                                                 <property name="fg"></property>\r
+                                                                 <property name="font"></property>\r
+                                                                 <property name="hidden">0</property>\r
+                                                                 <property name="id">wxID_TRANSACTIONFEE</property>\r
+                                                                 <property name="maximum_size"></property>\r
+                                                                 <property name="maxlength">0</property>\r
+                                                                 <property name="minimum_size"></property>\r
+                                                                 <property name="name">m_textCtrlTransactionFee</property>\r
+                                                                 <property name="permission">protected</property>\r
+                                                                 <property name="pos"></property>\r
+                                                                 <property name="size">70,-1</property>\r
+                                                                 <property name="style"></property>\r
+                                                                 <property name="subclass"></property>\r
+                                                                 <property name="tooltip"></property>\r
+                                                                 <property name="validator_data_type"></property>\r
+                                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                                 <property name="validator_variable"></property>\r
+                                                                 <property name="value"></property>\r
+                                                                 <property name="window_extra_style"></property>\r
+                                                                 <property name="window_name"></property>\r
+                                                                 <property name="window_style"></property>\r
+                                                                 <event name="OnChar"></event>\r
+                                                                 <event name="OnEnterWindow"></event>\r
+                                                                 <event name="OnEraseBackground"></event>\r
+                                                                 <event name="OnKeyDown"></event>\r
+                                                                 <event name="OnKeyUp"></event>\r
+                                                                 <event name="OnKillFocus">OnKillFocusTransactionFee</event>\r
+                                                                 <event name="OnLeaveWindow"></event>\r
+                                                                 <event name="OnLeftDClick"></event>\r
+                                                                 <event name="OnLeftDown"></event>\r
+                                                                 <event name="OnLeftUp"></event>\r
+                                                                 <event name="OnMiddleDClick"></event>\r
+                                                                 <event name="OnMiddleDown"></event>\r
+                                                                 <event name="OnMiddleUp"></event>\r
+                                                                 <event name="OnMotion"></event>\r
+                                                                 <event name="OnMouseEvents"></event>\r
+                                                                 <event name="OnMouseWheel"></event>\r
+                                                                 <event name="OnPaint"></event>\r
+                                                                 <event name="OnRightDClick"></event>\r
+                                                                 <event name="OnRightDown"></event>\r
+                                                                 <event name="OnRightUp"></event>\r
+                                                                 <event name="OnSetFocus"></event>\r
+                                                                 <event name="OnSize"></event>\r
+                                                                 <event name="OnText"></event>\r
+                                                                 <event name="OnTextEnter"></event>\r
+                                                                 <event name="OnTextMaxLen"></event>\r
+                                                                 <event name="OnTextURL"></event>\r
+                                                                 <event name="OnUpdateUI"></event>\r
+                                                             </object>\r
+                                                         </object>\r
+                                                     </object>\r
+                                                 </object>\r
+                                             </object>\r
+                                         </object>\r
+                                     </object>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">0</property>\r
+                                         <object class="wxPanel" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_panelTest2</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint"></event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                             <object class="wxBoxSizer" expanded="1">\r
+                                                 <property name="minimum_size"></property>\r
+                                                 <property name="name">bSizer64</property>\r
+                                                 <property name="orient">wxVERTICAL</property>\r
+                                                 <property name="permission">none</property>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxEXPAND</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="spacer" expanded="1">\r
+                                                         <property name="height">16</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="width">0</property>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxStaticText" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font"></property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">// [don&apos;t translate] Test panel 2 for future expansion</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_staticText321</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <property name="wrap">-1</property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALL</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxStaticText" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font"></property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">// [don&apos;t translate] Let&apos;s not start multiple pages until the first page is filled up</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_staticText69</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <property name="wrap">-1</property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                             </object>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxALIGN_RIGHT</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer58</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_OK</property>\r
+                                 <property name="label">OK</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_buttonOK</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonOK</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_CANCEL</property>\r
+                                 <property name="label">Cancel</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCancel</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCancel</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_APPLY</property>\r
+                                 <property name="label">&amp;Apply</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonApply</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonApply</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="0">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CAboutDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">532,333</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">About Bitcoin</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose"></event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint"></event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer63</property>\r
+                 <property name="orient">wxHORIZONTAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag"></property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxStaticBitmap" expanded="1">\r
+                         <property name="bg"></property>\r
+                         <property name="bitmap">xpm/about.xpm; Load From File</property>\r
+                         <property name="context_help"></property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="fg"></property>\r
+                         <property name="font"></property>\r
+                         <property name="hidden">0</property>\r
+                         <property name="id">wxID_ANY</property>\r
+                         <property name="maximum_size"></property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">m_bitmap</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="pos"></property>\r
+                         <property name="size"></property>\r
+                         <property name="subclass"></property>\r
+                         <property name="tooltip"></property>\r
+                         <property name="validator_data_type"></property>\r
+                         <property name="validator_style">wxFILTER_NONE</property>\r
+                         <property name="validator_type">wxDefaultValidator</property>\r
+                         <property name="validator_variable"></property>\r
+                         <property name="window_extra_style"></property>\r
+                         <property name="window_name"></property>\r
+                         <property name="window_style"></property>\r
+                         <event name="OnChar"></event>\r
+                         <event name="OnEnterWindow"></event>\r
+                         <event name="OnEraseBackground"></event>\r
+                         <event name="OnKeyDown"></event>\r
+                         <event name="OnKeyUp"></event>\r
+                         <event name="OnKillFocus"></event>\r
+                         <event name="OnLeaveWindow"></event>\r
+                         <event name="OnLeftDClick"></event>\r
+                         <event name="OnLeftDown"></event>\r
+                         <event name="OnLeftUp"></event>\r
+                         <event name="OnMiddleDClick"></event>\r
+                         <event name="OnMiddleDown"></event>\r
+                         <event name="OnMiddleUp"></event>\r
+                         <event name="OnMotion"></event>\r
+                         <event name="OnMouseEvents"></event>\r
+                         <event name="OnMouseWheel"></event>\r
+                         <event name="OnPaint"></event>\r
+                         <event name="OnRightDClick"></event>\r
+                         <event name="OnRightDown"></event>\r
+                         <event name="OnRightUp"></event>\r
+                         <event name="OnSetFocus"></event>\r
+                         <event name="OnSize"></event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND|wxLEFT</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer60</property>\r
+                         <property name="orient">wxVERTICAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="wxBoxSizer" expanded="1">\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">bSizer62</property>\r
+                                 <property name="orient">wxHORIZONTAL</property>\r
+                                 <property name="permission">none</property>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxEXPAND</property>\r
+                                     <property name="proportion">1</property>\r
+                                     <object class="wxBoxSizer" expanded="1">\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">bSizer631</property>\r
+                                         <property name="orient">wxVERTICAL</property>\r
+                                         <property name="permission">none</property>\r
+                                         <object class="sizeritem" expanded="1">\r
+                                             <property name="border">5</property>\r
+                                             <property name="flag">wxEXPAND</property>\r
+                                             <property name="proportion">0</property>\r
+                                             <object class="spacer" expanded="1">\r
+                                                 <property name="height">65</property>\r
+                                                 <property name="permission">protected</property>\r
+                                                 <property name="width">0</property>\r
+                                             </object>\r
+                                         </object>\r
+                                         <object class="sizeritem" expanded="1">\r
+                                             <property name="border">5</property>\r
+                                             <property name="flag">wxEXPAND</property>\r
+                                             <property name="proportion">0</property>\r
+                                             <object class="wxBoxSizer" expanded="1">\r
+                                                 <property name="minimum_size"></property>\r
+                                                 <property name="name">bSizer64</property>\r
+                                                 <property name="orient">wxHORIZONTAL</property>\r
+                                                 <property name="permission">none</property>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALIGN_BOTTOM|wxTOP|wxBOTTOM|wxLEFT</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxStaticText" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font">Tahoma,90,92,10,74,0</property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">Bitcoin </property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_staticText40</property>\r
+                                                         <property name="permission">protected</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <property name="wrap">-1</property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                                 <object class="sizeritem" expanded="1">\r
+                                                     <property name="border">5</property>\r
+                                                     <property name="flag">wxALIGN_BOTTOM|wxTOP|wxBOTTOM|wxRIGHT</property>\r
+                                                     <property name="proportion">0</property>\r
+                                                     <object class="wxStaticText" expanded="1">\r
+                                                         <property name="bg"></property>\r
+                                                         <property name="context_help"></property>\r
+                                                         <property name="enabled">1</property>\r
+                                                         <property name="fg"></property>\r
+                                                         <property name="font">Tahoma,90,90,10,74,0</property>\r
+                                                         <property name="hidden">0</property>\r
+                                                         <property name="id">wxID_ANY</property>\r
+                                                         <property name="label">version</property>\r
+                                                         <property name="maximum_size"></property>\r
+                                                         <property name="minimum_size"></property>\r
+                                                         <property name="name">m_staticTextVersion</property>\r
+                                                         <property name="permission">public</property>\r
+                                                         <property name="pos"></property>\r
+                                                         <property name="size"></property>\r
+                                                         <property name="style"></property>\r
+                                                         <property name="subclass"></property>\r
+                                                         <property name="tooltip"></property>\r
+                                                         <property name="validator_data_type"></property>\r
+                                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                                         <property name="validator_variable"></property>\r
+                                                         <property name="window_extra_style"></property>\r
+                                                         <property name="window_name"></property>\r
+                                                         <property name="window_style"></property>\r
+                                                         <property name="wrap">-1</property>\r
+                                                         <event name="OnChar"></event>\r
+                                                         <event name="OnEnterWindow"></event>\r
+                                                         <event name="OnEraseBackground"></event>\r
+                                                         <event name="OnKeyDown"></event>\r
+                                                         <event name="OnKeyUp"></event>\r
+                                                         <event name="OnKillFocus"></event>\r
+                                                         <event name="OnLeaveWindow"></event>\r
+                                                         <event name="OnLeftDClick"></event>\r
+                                                         <event name="OnLeftDown"></event>\r
+                                                         <event name="OnLeftUp"></event>\r
+                                                         <event name="OnMiddleDClick"></event>\r
+                                                         <event name="OnMiddleDown"></event>\r
+                                                         <event name="OnMiddleUp"></event>\r
+                                                         <event name="OnMotion"></event>\r
+                                                         <event name="OnMouseEvents"></event>\r
+                                                         <event name="OnMouseWheel"></event>\r
+                                                         <event name="OnPaint"></event>\r
+                                                         <event name="OnRightDClick"></event>\r
+                                                         <event name="OnRightDown"></event>\r
+                                                         <event name="OnRightUp"></event>\r
+                                                         <event name="OnSetFocus"></event>\r
+                                                         <event name="OnSize"></event>\r
+                                                         <event name="OnUpdateUI"></event>\r
+                                                     </object>\r
+                                                 </object>\r
+                                             </object>\r
+                                         </object>\r
+                                         <object class="sizeritem" expanded="1">\r
+                                             <property name="border">5</property>\r
+                                             <property name="flag">wxEXPAND</property>\r
+                                             <property name="proportion">0</property>\r
+                                             <object class="spacer" expanded="1">\r
+                                                 <property name="height">4</property>\r
+                                                 <property name="permission">protected</property>\r
+                                                 <property name="width">0</property>\r
+                                             </object>\r
+                                         </object>\r
+                                         <object class="sizeritem" expanded="1">\r
+                                             <property name="border">5</property>\r
+                                             <property name="flag">wxALL</property>\r
+                                             <property name="proportion">0</property>\r
+                                             <object class="wxStaticText" expanded="1">\r
+                                                 <property name="bg"></property>\r
+                                                 <property name="context_help"></property>\r
+                                                 <property name="enabled">1</property>\r
+                                                 <property name="fg"></property>\r
+                                                 <property name="font"></property>\r
+                                                 <property name="hidden">0</property>\r
+                                                 <property name="id">wxID_ANY</property>\r
+                                                 <property name="label">Copyright (c) 2009-2011 Bitcoin Developers&#x0A;&#x0A;This is experimental software.&#x0A;&#x0A;Distributed under the MIT/X11 software license, see the accompanying file &#x0A;license.txt or http://www.opensource.org/licenses/mit-license.php.&#x0A;&#x0A;This product includes software developed by the OpenSSL Project for use in the &#x0A;OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by &#x0A;Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</property>\r
+                                                 <property name="maximum_size"></property>\r
+                                                 <property name="minimum_size"></property>\r
+                                                 <property name="name">m_staticTextMain</property>\r
+                                                 <property name="permission">protected</property>\r
+                                                 <property name="pos"></property>\r
+                                                 <property name="size"></property>\r
+                                                 <property name="style"></property>\r
+                                                 <property name="subclass"></property>\r
+                                                 <property name="tooltip"></property>\r
+                                                 <property name="validator_data_type"></property>\r
+                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                 <property name="validator_variable"></property>\r
+                                                 <property name="window_extra_style"></property>\r
+                                                 <property name="window_name"></property>\r
+                                                 <property name="window_style"></property>\r
+                                                 <property name="wrap">-1</property>\r
+                                                 <event name="OnChar"></event>\r
+                                                 <event name="OnEnterWindow"></event>\r
+                                                 <event name="OnEraseBackground"></event>\r
+                                                 <event name="OnKeyDown"></event>\r
+                                                 <event name="OnKeyUp"></event>\r
+                                                 <event name="OnKillFocus"></event>\r
+                                                 <event name="OnLeaveWindow"></event>\r
+                                                 <event name="OnLeftDClick"></event>\r
+                                                 <event name="OnLeftDown"></event>\r
+                                                 <event name="OnLeftUp"></event>\r
+                                                 <event name="OnMiddleDClick"></event>\r
+                                                 <event name="OnMiddleDown"></event>\r
+                                                 <event name="OnMiddleUp"></event>\r
+                                                 <event name="OnMotion"></event>\r
+                                                 <event name="OnMouseEvents"></event>\r
+                                                 <event name="OnMouseWheel"></event>\r
+                                                 <event name="OnPaint"></event>\r
+                                                 <event name="OnRightDClick"></event>\r
+                                                 <event name="OnRightDown"></event>\r
+                                                 <event name="OnRightUp"></event>\r
+                                                 <event name="OnSetFocus"></event>\r
+                                                 <event name="OnSize"></event>\r
+                                                 <event name="OnUpdateUI"></event>\r
+                                             </object>\r
+                                         </object>\r
+                                         <object class="sizeritem" expanded="1">\r
+                                             <property name="border">5</property>\r
+                                             <property name="flag">wxEXPAND</property>\r
+                                             <property name="proportion">0</property>\r
+                                             <object class="spacer" expanded="1">\r
+                                                 <property name="height">0</property>\r
+                                                 <property name="permission">protected</property>\r
+                                                 <property name="width">0</property>\r
+                                             </object>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">2</property>\r
+                             <property name="flag">wxALIGN_RIGHT|wxEXPAND|wxRIGHT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxBoxSizer" expanded="1">\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">bSizer61</property>\r
+                                 <property name="orient">wxHORIZONTAL</property>\r
+                                 <property name="permission">none</property>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxEXPAND</property>\r
+                                     <property name="proportion">1</property>\r
+                                     <object class="spacer" expanded="1">\r
+                                         <property name="height">0</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="width">0</property>\r
+                                     </object>\r
+                                 </object>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">6</property>\r
+                                     <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                                     <property name="proportion">0</property>\r
+                                     <object class="wxButton" expanded="1">\r
+                                         <property name="bg"></property>\r
+                                         <property name="context_help"></property>\r
+                                         <property name="default">0</property>\r
+                                         <property name="enabled">1</property>\r
+                                         <property name="fg"></property>\r
+                                         <property name="font"></property>\r
+                                         <property name="hidden">0</property>\r
+                                         <property name="id">wxID_OK</property>\r
+                                         <property name="label">OK</property>\r
+                                         <property name="maximum_size"></property>\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">m_buttonOK</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="pos"></property>\r
+                                         <property name="size">-1,-1</property>\r
+                                         <property name="style"></property>\r
+                                         <property name="subclass"></property>\r
+                                         <property name="tooltip"></property>\r
+                                         <property name="validator_data_type"></property>\r
+                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                         <property name="validator_variable"></property>\r
+                                         <property name="window_extra_style"></property>\r
+                                         <property name="window_name"></property>\r
+                                         <property name="window_style"></property>\r
+                                         <event name="OnButtonClick">OnButtonOK</event>\r
+                                         <event name="OnChar"></event>\r
+                                         <event name="OnEnterWindow"></event>\r
+                                         <event name="OnEraseBackground"></event>\r
+                                         <event name="OnKeyDown"></event>\r
+                                         <event name="OnKeyUp"></event>\r
+                                         <event name="OnKillFocus"></event>\r
+                                         <event name="OnLeaveWindow"></event>\r
+                                         <event name="OnLeftDClick"></event>\r
+                                         <event name="OnLeftDown"></event>\r
+                                         <event name="OnLeftUp"></event>\r
+                                         <event name="OnMiddleDClick"></event>\r
+                                         <event name="OnMiddleDown"></event>\r
+                                         <event name="OnMiddleUp"></event>\r
+                                         <event name="OnMotion"></event>\r
+                                         <event name="OnMouseEvents"></event>\r
+                                         <event name="OnMouseWheel"></event>\r
+                                         <event name="OnPaint"></event>\r
+                                         <event name="OnRightDClick"></event>\r
+                                         <event name="OnRightDown"></event>\r
+                                         <event name="OnRightUp"></event>\r
+                                         <event name="OnSetFocus"></event>\r
+                                         <event name="OnSize"></event>\r
+                                         <event name="OnUpdateUI"></event>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="1">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CSendDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">498,157</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">Send Coins</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose"></event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint"></event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer21</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="spacer" expanded="1">\r
+                         <property name="height">5</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="width">0</property>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND|wxLEFT</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxFlexGridSizer" expanded="1">\r
+                         <property name="cols">2</property>\r
+                         <property name="flexible_direction">wxBOTH</property>\r
+                         <property name="growablecols">1</property>\r
+                         <property name="growablerows"></property>\r
+                         <property name="hgap">0</property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">fgSizer1</property>\r
+                         <property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>\r
+                         <property name="permission">none</property>\r
+                         <property name="rows">0</property>\r
+                         <property name="vgap">0</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxStaticText" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="label">Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_staticTextInstructions</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <property name="wrap">-1</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND|wxLEFT</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="wxBoxSizer" expanded="1">\r
+                                 <property name="minimum_size">70,-1</property>\r
+                                 <property name="name">bSizer47</property>\r
+                                 <property name="orient">wxHORIZONTAL</property>\r
+                                 <property name="permission">none</property>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxEXPAND</property>\r
+                                     <property name="proportion">1</property>\r
+                                     <object class="spacer" expanded="1">\r
+                                         <property name="height">0</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="width">0</property>\r
+                                     </object>\r
+                                 </object>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>\r
+                                     <property name="proportion">0</property>\r
+                                     <object class="wxStaticBitmap" expanded="1">\r
+                                         <property name="bg"></property>\r
+                                         <property name="bitmap">xpm/check.xpm; Load From File</property>\r
+                                         <property name="context_help"></property>\r
+                                         <property name="enabled">1</property>\r
+                                         <property name="fg"></property>\r
+                                         <property name="font"></property>\r
+                                         <property name="hidden">0</property>\r
+                                         <property name="id">wxID_ANY</property>\r
+                                         <property name="maximum_size"></property>\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">m_bitmapCheckMark</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="pos"></property>\r
+                                         <property name="size">16,16</property>\r
+                                         <property name="subclass"></property>\r
+                                         <property name="tooltip"></property>\r
+                                         <property name="validator_data_type"></property>\r
+                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                         <property name="validator_variable"></property>\r
+                                         <property name="window_extra_style"></property>\r
+                                         <property name="window_name"></property>\r
+                                         <property name="window_style"></property>\r
+                                         <event name="OnChar"></event>\r
+                                         <event name="OnEnterWindow"></event>\r
+                                         <event name="OnEraseBackground"></event>\r
+                                         <event name="OnKeyDown"></event>\r
+                                         <event name="OnKeyUp"></event>\r
+                                         <event name="OnKillFocus"></event>\r
+                                         <event name="OnLeaveWindow"></event>\r
+                                         <event name="OnLeftDClick"></event>\r
+                                         <event name="OnLeftDown"></event>\r
+                                         <event name="OnLeftUp"></event>\r
+                                         <event name="OnMiddleDClick"></event>\r
+                                         <event name="OnMiddleDown"></event>\r
+                                         <event name="OnMiddleUp"></event>\r
+                                         <event name="OnMotion"></event>\r
+                                         <event name="OnMouseEvents"></event>\r
+                                         <event name="OnMouseWheel"></event>\r
+                                         <event name="OnPaint"></event>\r
+                                         <event name="OnRightDClick"></event>\r
+                                         <event name="OnRightDown"></event>\r
+                                         <event name="OnRightUp"></event>\r
+                                         <event name="OnSetFocus"></event>\r
+                                         <event name="OnSize"></event>\r
+                                         <event name="OnUpdateUI"></event>\r
+                                     </object>\r
+                                 </object>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>\r
+                                     <property name="proportion">0</property>\r
+                                     <object class="wxStaticText" expanded="1">\r
+                                         <property name="bg"></property>\r
+                                         <property name="context_help"></property>\r
+                                         <property name="enabled">1</property>\r
+                                         <property name="fg"></property>\r
+                                         <property name="font"></property>\r
+                                         <property name="hidden">0</property>\r
+                                         <property name="id">wxID_ANY</property>\r
+                                         <property name="label">Pay &amp;To:</property>\r
+                                         <property name="maximum_size"></property>\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">m_staticText36</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="pos"></property>\r
+                                         <property name="size">-1,-1</property>\r
+                                         <property name="style">wxALIGN_RIGHT</property>\r
+                                         <property name="subclass"></property>\r
+                                         <property name="tooltip"></property>\r
+                                         <property name="validator_data_type"></property>\r
+                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                         <property name="validator_variable"></property>\r
+                                         <property name="window_extra_style"></property>\r
+                                         <property name="window_name"></property>\r
+                                         <property name="window_style"></property>\r
+                                         <property name="wrap">-1</property>\r
+                                         <event name="OnChar"></event>\r
+                                         <event name="OnEnterWindow"></event>\r
+                                         <event name="OnEraseBackground"></event>\r
+                                         <event name="OnKeyDown"></event>\r
+                                         <event name="OnKeyUp"></event>\r
+                                         <event name="OnKillFocus"></event>\r
+                                         <event name="OnLeaveWindow"></event>\r
+                                         <event name="OnLeftDClick"></event>\r
+                                         <event name="OnLeftDown"></event>\r
+                                         <event name="OnLeftUp"></event>\r
+                                         <event name="OnMiddleDClick"></event>\r
+                                         <event name="OnMiddleDown"></event>\r
+                                         <event name="OnMiddleUp"></event>\r
+                                         <event name="OnMotion"></event>\r
+                                         <event name="OnMouseEvents"></event>\r
+                                         <event name="OnMouseWheel"></event>\r
+                                         <event name="OnPaint"></event>\r
+                                         <event name="OnRightDClick"></event>\r
+                                         <event name="OnRightDown"></event>\r
+                                         <event name="OnRightUp"></event>\r
+                                         <event name="OnSetFocus"></event>\r
+                                         <event name="OnSize"></event>\r
+                                         <event name="OnUpdateUI"></event>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND|wxRIGHT</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="wxBoxSizer" expanded="1">\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">bSizer19</property>\r
+                                 <property name="orient">wxHORIZONTAL</property>\r
+                                 <property name="permission">none</property>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
+                                     <property name="proportion">1</property>\r
+                                     <object class="wxTextCtrl" expanded="1">\r
+                                         <property name="bg"></property>\r
+                                         <property name="context_help"></property>\r
+                                         <property name="enabled">1</property>\r
+                                         <property name="fg"></property>\r
+                                         <property name="font"></property>\r
+                                         <property name="hidden">0</property>\r
+                                         <property name="id">wxID_TEXTCTRLPAYTO</property>\r
+                                         <property name="maximum_size"></property>\r
+                                         <property name="maxlength">0</property>\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">m_textCtrlAddress</property>\r
+                                         <property name="permission">protected</property>\r
+                                         <property name="pos"></property>\r
+                                         <property name="size"></property>\r
+                                         <property name="style"></property>\r
+                                         <property name="subclass"></property>\r
+                                         <property name="tooltip"></property>\r
+                                         <property name="validator_data_type"></property>\r
+                                         <property name="validator_style">wxFILTER_NONE</property>\r
+                                         <property name="validator_type">wxDefaultValidator</property>\r
+                                         <property name="validator_variable"></property>\r
+                                         <property name="value"></property>\r
+                                         <property name="window_extra_style"></property>\r
+                                         <property name="window_name"></property>\r
+                                         <property name="window_style"></property>\r
+                                         <event name="OnChar"></event>\r
+                                         <event name="OnEnterWindow"></event>\r
+                                         <event name="OnEraseBackground"></event>\r
+                                         <event name="OnKeyDown">OnKeyDown</event>\r
+                                         <event name="OnKeyUp"></event>\r
+                                         <event name="OnKillFocus"></event>\r
+                                         <event name="OnLeaveWindow"></event>\r
+                                         <event name="OnLeftDClick"></event>\r
+                                         <event name="OnLeftDown"></event>\r
+                                         <event name="OnLeftUp"></event>\r
+                                         <event name="OnMiddleDClick"></event>\r
+                                         <event name="OnMiddleDown"></event>\r
+                                         <event name="OnMiddleUp"></event>\r
+                                         <event name="OnMotion"></event>\r
+                                         <event name="OnMouseEvents"></event>\r
+                                         <event name="OnMouseWheel"></event>\r
+                                         <event name="OnPaint"></event>\r
+                                         <event name="OnRightDClick"></event>\r
+                                         <event name="OnRightDown"></event>\r
+                                         <event name="OnRightUp"></event>\r
+                                         <event name="OnSetFocus"></event>\r
+                                         <event name="OnSize"></event>\r
+                                         <event name="OnText">OnTextAddress</event>\r
+                                         <event name="OnTextEnter"></event>\r
+                                         <event name="OnTextMaxLen"></event>\r
+                                         <event name="OnTextURL"></event>\r
+                                         <event name="OnUpdateUI"></event>\r
+                                     </object>\r
+                                 </object>\r
+                                 <object class="sizeritem" expanded="1">\r
+                                     <property name="border">5</property>\r
+                                     <property name="flag">wxALIGN_CENTER_VERTICAL</property>\r
+                                     <property name="proportion">0</property>\r
+                                     <object class="wxBoxSizer" expanded="1">\r
+                                         <property name="minimum_size"></property>\r
+                                         <property name="name">bSizer66</property>\r
+                                         <property name="orient">wxHORIZONTAL</property>\r
+                                         <property name="permission">none</property>\r
+                                         <object class="sizeritem" expanded="1">\r
+                                             <property name="border">5</property>\r
+                                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND</property>\r
+                                             <property name="proportion">0</property>\r
+                                             <object class="wxButton" expanded="1">\r
+                                                 <property name="bg"></property>\r
+                                                 <property name="context_help"></property>\r
+                                                 <property name="default">0</property>\r
+                                                 <property name="enabled">1</property>\r
+                                                 <property name="fg"></property>\r
+                                                 <property name="font"></property>\r
+                                                 <property name="hidden">0</property>\r
+                                                 <property name="id">wxID_BUTTONPASTE</property>\r
+                                                 <property name="label">&amp;Paste</property>\r
+                                                 <property name="maximum_size"></property>\r
+                                                 <property name="minimum_size"></property>\r
+                                                 <property name="name">m_buttonPaste</property>\r
+                                                 <property name="permission">protected</property>\r
+                                                 <property name="pos"></property>\r
+                                                 <property name="size">-1,-1</property>\r
+                                                 <property name="style">wxBU_EXACTFIT</property>\r
+                                                 <property name="subclass"></property>\r
+                                                 <property name="tooltip"></property>\r
+                                                 <property name="validator_data_type"></property>\r
+                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                 <property name="validator_variable"></property>\r
+                                                 <property name="window_extra_style"></property>\r
+                                                 <property name="window_name"></property>\r
+                                                 <property name="window_style"></property>\r
+                                                 <event name="OnButtonClick">OnButtonPaste</event>\r
+                                                 <event name="OnChar"></event>\r
+                                                 <event name="OnEnterWindow"></event>\r
+                                                 <event name="OnEraseBackground"></event>\r
+                                                 <event name="OnKeyDown"></event>\r
+                                                 <event name="OnKeyUp"></event>\r
+                                                 <event name="OnKillFocus"></event>\r
+                                                 <event name="OnLeaveWindow"></event>\r
+                                                 <event name="OnLeftDClick"></event>\r
+                                                 <event name="OnLeftDown"></event>\r
+                                                 <event name="OnLeftUp"></event>\r
+                                                 <event name="OnMiddleDClick"></event>\r
+                                                 <event name="OnMiddleDown"></event>\r
+                                                 <event name="OnMiddleUp"></event>\r
+                                                 <event name="OnMotion"></event>\r
+                                                 <event name="OnMouseEvents"></event>\r
+                                                 <event name="OnMouseWheel"></event>\r
+                                                 <event name="OnPaint"></event>\r
+                                                 <event name="OnRightDClick"></event>\r
+                                                 <event name="OnRightDown"></event>\r
+                                                 <event name="OnRightUp"></event>\r
+                                                 <event name="OnSetFocus"></event>\r
+                                                 <event name="OnSize"></event>\r
+                                                 <event name="OnUpdateUI"></event>\r
+                                             </object>\r
+                                         </object>\r
+                                         <object class="sizeritem" expanded="1">\r
+                                             <property name="border">5</property>\r
+                                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND</property>\r
+                                             <property name="proportion">0</property>\r
+                                             <object class="wxButton" expanded="1">\r
+                                                 <property name="bg"></property>\r
+                                                 <property name="context_help"></property>\r
+                                                 <property name="default">0</property>\r
+                                                 <property name="enabled">1</property>\r
+                                                 <property name="fg"></property>\r
+                                                 <property name="font"></property>\r
+                                                 <property name="hidden">0</property>\r
+                                                 <property name="id">wxID_BUTTONADDRESSBOOK</property>\r
+                                                 <property name="label"> Address &amp;Book...</property>\r
+                                                 <property name="maximum_size"></property>\r
+                                                 <property name="minimum_size"></property>\r
+                                                 <property name="name">m_buttonAddress</property>\r
+                                                 <property name="permission">protected</property>\r
+                                                 <property name="pos"></property>\r
+                                                 <property name="size"></property>\r
+                                                 <property name="style"></property>\r
+                                                 <property name="subclass"></property>\r
+                                                 <property name="tooltip"></property>\r
+                                                 <property name="validator_data_type"></property>\r
+                                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                                 <property name="validator_variable"></property>\r
+                                                 <property name="window_extra_style"></property>\r
+                                                 <property name="window_name"></property>\r
+                                                 <property name="window_style"></property>\r
+                                                 <event name="OnButtonClick">OnButtonAddressBook</event>\r
+                                                 <event name="OnChar"></event>\r
+                                                 <event name="OnEnterWindow"></event>\r
+                                                 <event name="OnEraseBackground"></event>\r
+                                                 <event name="OnKeyDown"></event>\r
+                                                 <event name="OnKeyUp"></event>\r
+                                                 <event name="OnKillFocus"></event>\r
+                                                 <event name="OnLeaveWindow"></event>\r
+                                                 <event name="OnLeftDClick"></event>\r
+                                                 <event name="OnLeftDown"></event>\r
+                                                 <event name="OnLeftUp"></event>\r
+                                                 <event name="OnMiddleDClick"></event>\r
+                                                 <event name="OnMiddleDown"></event>\r
+                                                 <event name="OnMiddleUp"></event>\r
+                                                 <event name="OnMotion"></event>\r
+                                                 <event name="OnMouseEvents"></event>\r
+                                                 <event name="OnMouseWheel"></event>\r
+                                                 <event name="OnPaint"></event>\r
+                                                 <event name="OnRightDClick"></event>\r
+                                                 <event name="OnRightDown"></event>\r
+                                                 <event name="OnRightUp"></event>\r
+                                                 <event name="OnSetFocus"></event>\r
+                                                 <event name="OnSize"></event>\r
+                                                 <event name="OnUpdateUI"></event>\r
+                                             </object>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxStaticText" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="label">&amp;Amount:</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_staticText19</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style">wxALIGN_RIGHT</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <property name="wrap">-1</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxTextCtrl" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font">,90,90,-1,70,0</property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_TEXTCTRLAMOUNT</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="maxlength">20</property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_textCtrlAmount</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">145,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="value"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown">OnKeyDown</event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus">OnKillFocusAmount</event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnText"></event>\r
+                                 <event name="OnTextEnter"></event>\r
+                                 <event name="OnTextMaxLen"></event>\r
+                                 <event name="OnTextURL"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxStaticText" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">1</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="label">T&amp;ransfer:</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_staticText20</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style">wxALIGN_RIGHT</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <property name="wrap">-1</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxChoice" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="choices">&quot; Standard&quot;</property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">1</property>\r
+                                 <property name="id">wxID_CHOICETRANSFERTYPE</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_choiceTransferType</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="selection">0</property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnChoice"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">3</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="0">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer672</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="0">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer23</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font">,90,90,-1,70,0</property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONSEND</property>\r
+                                 <property name="label">&amp;Send</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonSend</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonSend</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_CANCEL</property>\r
+                                 <property name="label">Cancel</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCancel</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCancel</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="0">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CSendingDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">442,151</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">Sending...</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose">OnClose</event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint">OnPaint</event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer68</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">8</property>\r
+                     <property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxStaticText" expanded="1">\r
+                         <property name="bg"></property>\r
+                         <property name="context_help"></property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="fg"></property>\r
+                         <property name="font"></property>\r
+                         <property name="hidden">0</property>\r
+                         <property name="id">wxID_ANY</property>\r
+                         <property name="label"></property>\r
+                         <property name="maximum_size"></property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">m_staticTextSending</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="pos"></property>\r
+                         <property name="size">-1,14</property>\r
+                         <property name="style"></property>\r
+                         <property name="subclass"></property>\r
+                         <property name="tooltip"></property>\r
+                         <property name="validator_data_type"></property>\r
+                         <property name="validator_style">wxFILTER_NONE</property>\r
+                         <property name="validator_type">wxDefaultValidator</property>\r
+                         <property name="validator_variable"></property>\r
+                         <property name="window_extra_style"></property>\r
+                         <property name="window_name"></property>\r
+                         <property name="window_style"></property>\r
+                         <property name="wrap">-1</property>\r
+                         <event name="OnChar"></event>\r
+                         <event name="OnEnterWindow"></event>\r
+                         <event name="OnEraseBackground"></event>\r
+                         <event name="OnKeyDown"></event>\r
+                         <event name="OnKeyUp"></event>\r
+                         <event name="OnKillFocus"></event>\r
+                         <event name="OnLeaveWindow"></event>\r
+                         <event name="OnLeftDClick"></event>\r
+                         <event name="OnLeftDown"></event>\r
+                         <event name="OnLeftUp"></event>\r
+                         <event name="OnMiddleDClick"></event>\r
+                         <event name="OnMiddleDown"></event>\r
+                         <event name="OnMiddleUp"></event>\r
+                         <event name="OnMotion"></event>\r
+                         <event name="OnMouseEvents"></event>\r
+                         <event name="OnMouseWheel"></event>\r
+                         <event name="OnPaint"></event>\r
+                         <event name="OnRightDClick"></event>\r
+                         <event name="OnRightDown"></event>\r
+                         <event name="OnRightUp"></event>\r
+                         <event name="OnSetFocus"></event>\r
+                         <event name="OnSize"></event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">10</property>\r
+                     <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxTextCtrl" expanded="1">\r
+                         <property name="bg">wxSYS_COLOUR_BTNFACE</property>\r
+                         <property name="context_help"></property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="fg"></property>\r
+                         <property name="font"></property>\r
+                         <property name="hidden">0</property>\r
+                         <property name="id">wxID_ANY</property>\r
+                         <property name="maximum_size"></property>\r
+                         <property name="maxlength">0</property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">m_textCtrlStatus</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="pos"></property>\r
+                         <property name="size"></property>\r
+                         <property name="style">wxTE_CENTRE|wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY</property>\r
+                         <property name="subclass"></property>\r
+                         <property name="tooltip"></property>\r
+                         <property name="validator_data_type"></property>\r
+                         <property name="validator_style">wxFILTER_NONE</property>\r
+                         <property name="validator_type">wxDefaultValidator</property>\r
+                         <property name="validator_variable"></property>\r
+                         <property name="value">&#x0A;&#x0A;Connecting...</property>\r
+                         <property name="window_extra_style"></property>\r
+                         <property name="window_name"></property>\r
+                         <property name="window_style">wxNO_BORDER</property>\r
+                         <event name="OnChar"></event>\r
+                         <event name="OnEnterWindow"></event>\r
+                         <event name="OnEraseBackground"></event>\r
+                         <event name="OnKeyDown"></event>\r
+                         <event name="OnKeyUp"></event>\r
+                         <event name="OnKillFocus"></event>\r
+                         <event name="OnLeaveWindow"></event>\r
+                         <event name="OnLeftDClick"></event>\r
+                         <event name="OnLeftDown"></event>\r
+                         <event name="OnLeftUp"></event>\r
+                         <event name="OnMiddleDClick"></event>\r
+                         <event name="OnMiddleDown"></event>\r
+                         <event name="OnMiddleUp"></event>\r
+                         <event name="OnMotion"></event>\r
+                         <event name="OnMouseEvents"></event>\r
+                         <event name="OnMouseWheel"></event>\r
+                         <event name="OnPaint"></event>\r
+                         <event name="OnRightDClick"></event>\r
+                         <event name="OnRightDown"></event>\r
+                         <event name="OnRightUp"></event>\r
+                         <event name="OnSetFocus"></event>\r
+                         <event name="OnSize"></event>\r
+                         <event name="OnText"></event>\r
+                         <event name="OnTextEnter"></event>\r
+                         <event name="OnTextMaxLen"></event>\r
+                         <event name="OnTextURL"></event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer69</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">0</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="label">OK</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonOK</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonOK</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_CANCEL</property>\r
+                                 <property name="label">Cancel</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCancel</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCancel</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="0">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CYourAddressDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">610,390</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">Your Bitcoin Addresses</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose">OnClose</event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint"></event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer68</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="spacer" expanded="1">\r
+                         <property name="height">5</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="width">0</property>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxALL</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxStaticText" expanded="1">\r
+                         <property name="bg"></property>\r
+                         <property name="context_help"></property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="fg"></property>\r
+                         <property name="font"></property>\r
+                         <property name="hidden">0</property>\r
+                         <property name="id">wxID_ANY</property>\r
+                         <property name="label">These are your Bitcoin addresses for receiving payments.  You may want to give a different one to each sender so you can keep track of who is paying you.  The highlighted address is displayed in the main window.</property>\r
+                         <property name="maximum_size"></property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">m_staticText45</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="pos"></property>\r
+                         <property name="size"></property>\r
+                         <property name="style"></property>\r
+                         <property name="subclass"></property>\r
+                         <property name="tooltip"></property>\r
+                         <property name="validator_data_type"></property>\r
+                         <property name="validator_style">wxFILTER_NONE</property>\r
+                         <property name="validator_type">wxDefaultValidator</property>\r
+                         <property name="validator_variable"></property>\r
+                         <property name="window_extra_style"></property>\r
+                         <property name="window_name"></property>\r
+                         <property name="window_style"></property>\r
+                         <property name="wrap">590</property>\r
+                         <event name="OnChar"></event>\r
+                         <event name="OnEnterWindow"></event>\r
+                         <event name="OnEraseBackground"></event>\r
+                         <event name="OnKeyDown"></event>\r
+                         <event name="OnKeyUp"></event>\r
+                         <event name="OnKillFocus"></event>\r
+                         <event name="OnLeaveWindow"></event>\r
+                         <event name="OnLeftDClick"></event>\r
+                         <event name="OnLeftDown"></event>\r
+                         <event name="OnLeftUp"></event>\r
+                         <event name="OnMiddleDClick"></event>\r
+                         <event name="OnMiddleDown"></event>\r
+                         <event name="OnMiddleUp"></event>\r
+                         <event name="OnMotion"></event>\r
+                         <event name="OnMouseEvents"></event>\r
+                         <event name="OnMouseWheel"></event>\r
+                         <event name="OnPaint"></event>\r
+                         <event name="OnRightDClick"></event>\r
+                         <event name="OnRightDown"></event>\r
+                         <event name="OnRightUp"></event>\r
+                         <event name="OnSetFocus"></event>\r
+                         <event name="OnSize"></event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxALL|wxEXPAND</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxListCtrl" expanded="1">\r
+                         <property name="bg"></property>\r
+                         <property name="context_help"></property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="fg"></property>\r
+                         <property name="font"></property>\r
+                         <property name="hidden">0</property>\r
+                         <property name="id">wxID_LISTCTRL</property>\r
+                         <property name="maximum_size"></property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">m_listCtrl</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="pos"></property>\r
+                         <property name="size"></property>\r
+                         <property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING</property>\r
+                         <property name="subclass"></property>\r
+                         <property name="tooltip"></property>\r
+                         <property name="validator_data_type"></property>\r
+                         <property name="validator_style">wxFILTER_NONE</property>\r
+                         <property name="validator_type">wxDefaultValidator</property>\r
+                         <property name="validator_variable"></property>\r
+                         <property name="window_extra_style"></property>\r
+                         <property name="window_name"></property>\r
+                         <property name="window_style"></property>\r
+                         <event name="OnChar"></event>\r
+                         <event name="OnEnterWindow"></event>\r
+                         <event name="OnEraseBackground"></event>\r
+                         <event name="OnKeyDown"></event>\r
+                         <event name="OnKeyUp"></event>\r
+                         <event name="OnKillFocus"></event>\r
+                         <event name="OnLeaveWindow"></event>\r
+                         <event name="OnLeftDClick"></event>\r
+                         <event name="OnLeftDown"></event>\r
+                         <event name="OnLeftUp"></event>\r
+                         <event name="OnListBeginDrag"></event>\r
+                         <event name="OnListBeginLabelEdit"></event>\r
+                         <event name="OnListBeginRDrag"></event>\r
+                         <event name="OnListCacheHint"></event>\r
+                         <event name="OnListColBeginDrag"></event>\r
+                         <event name="OnListColClick"></event>\r
+                         <event name="OnListColDragging"></event>\r
+                         <event name="OnListColEndDrag"></event>\r
+                         <event name="OnListColRightClick"></event>\r
+                         <event name="OnListDeleteAllItems"></event>\r
+                         <event name="OnListDeleteItem"></event>\r
+                         <event name="OnListEndLabelEdit">OnListEndLabelEdit</event>\r
+                         <event name="OnListInsertItem"></event>\r
+                         <event name="OnListItemActivated">OnListItemActivated</event>\r
+                         <event name="OnListItemDeselected"></event>\r
+                         <event name="OnListItemFocused"></event>\r
+                         <event name="OnListItemMiddleClick"></event>\r
+                         <event name="OnListItemRightClick"></event>\r
+                         <event name="OnListItemSelected">OnListItemSelected</event>\r
+                         <event name="OnListKeyDown"></event>\r
+                         <event name="OnMiddleDClick"></event>\r
+                         <event name="OnMiddleDown"></event>\r
+                         <event name="OnMiddleUp"></event>\r
+                         <event name="OnMotion"></event>\r
+                         <event name="OnMouseEvents"></event>\r
+                         <event name="OnMouseWheel"></event>\r
+                         <event name="OnPaint"></event>\r
+                         <event name="OnRightDClick"></event>\r
+                         <event name="OnRightDown"></event>\r
+                         <event name="OnRightUp"></event>\r
+                         <event name="OnSetFocus"></event>\r
+                         <event name="OnSize"></event>\r
+                         <event name="OnUpdateUI"></event>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer69</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONRENAME</property>\r
+                                 <property name="label">&amp;Edit...</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonRename</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonRename</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONNEW</property>\r
+                                 <property name="label"> &amp;New Address... </property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonNew</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonNew</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONCOPY</property>\r
+                                 <property name="label"> &amp;Copy to Clipboard </property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCopy</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCopy</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_OK</property>\r
+                                 <property name="label">OK</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonOK</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonOK</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">1</property>\r
+                                 <property name="id">wxID_CANCEL</property>\r
+                                 <property name="label">Cancel</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCancel</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCancel</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="0">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CAddressBookDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">610,390</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>\r
+             <property name="subclass"></property>\r
+             <property name="title">Address Book</property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose">OnClose</event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint"></event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer58</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxNotebook" expanded="1">\r
+                         <property name="bg"></property>\r
+                         <property name="bitmapsize"></property>\r
+                         <property name="context_help"></property>\r
+                         <property name="enabled">1</property>\r
+                         <property name="fg"></property>\r
+                         <property name="font"></property>\r
+                         <property name="hidden">0</property>\r
+                         <property name="id">wxID_ANY</property>\r
+                         <property name="maximum_size"></property>\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">m_notebook</property>\r
+                         <property name="permission">protected</property>\r
+                         <property name="pos"></property>\r
+                         <property name="size"></property>\r
+                         <property name="style"></property>\r
+                         <property name="subclass"></property>\r
+                         <property name="tooltip"></property>\r
+                         <property name="validator_data_type"></property>\r
+                         <property name="validator_style">wxFILTER_NONE</property>\r
+                         <property name="validator_type">wxDefaultValidator</property>\r
+                         <property name="validator_variable"></property>\r
+                         <property name="window_extra_style"></property>\r
+                         <property name="window_name"></property>\r
+                         <property name="window_style"></property>\r
+                         <event name="OnChar"></event>\r
+                         <event name="OnEnterWindow"></event>\r
+                         <event name="OnEraseBackground"></event>\r
+                         <event name="OnKeyDown"></event>\r
+                         <event name="OnKeyUp"></event>\r
+                         <event name="OnKillFocus"></event>\r
+                         <event name="OnLeaveWindow"></event>\r
+                         <event name="OnLeftDClick"></event>\r
+                         <event name="OnLeftDown"></event>\r
+                         <event name="OnLeftUp"></event>\r
+                         <event name="OnMiddleDClick"></event>\r
+                         <event name="OnMiddleDown"></event>\r
+                         <event name="OnMiddleUp"></event>\r
+                         <event name="OnMotion"></event>\r
+                         <event name="OnMouseEvents"></event>\r
+                         <event name="OnMouseWheel"></event>\r
+                         <event name="OnNotebookPageChanged">OnNotebookPageChanged</event>\r
+                         <event name="OnNotebookPageChanging"></event>\r
+                         <event name="OnPaint"></event>\r
+                         <event name="OnRightDClick"></event>\r
+                         <event name="OnRightDown"></event>\r
+                         <event name="OnRightUp"></event>\r
+                         <event name="OnSetFocus"></event>\r
+                         <event name="OnSize"></event>\r
+                         <event name="OnUpdateUI"></event>\r
+                         <object class="notebookpage" expanded="1">\r
+                             <property name="bitmap"></property>\r
+                             <property name="label">Sending</property>\r
+                             <property name="select">0</property>\r
+                             <object class="wxPanel" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_PANELSENDING</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_panelSending</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                                 <object class="wxBoxSizer" expanded="1">\r
+                                     <property name="minimum_size"></property>\r
+                                     <property name="name">bSizer68</property>\r
+                                     <property name="orient">wxVERTICAL</property>\r
+                                     <property name="permission">none</property>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">0</property>\r
+                                         <object class="spacer" expanded="1">\r
+                                             <property name="height">0</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="width">0</property>\r
+                                         </object>\r
+                                     </object>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>\r
+                                         <property name="proportion">0</property>\r
+                                         <object class="wxStaticText" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">1</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="label">Bitcoin Address</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_staticText55</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style"></property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <property name="wrap">-1</property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint"></event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxALL|wxEXPAND</property>\r
+                                         <property name="proportion">1</property>\r
+                                         <object class="wxListCtrl" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_LISTCTRLSENDING</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_listCtrlSending</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING</property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnListBeginDrag"></event>\r
+                                             <event name="OnListBeginLabelEdit"></event>\r
+                                             <event name="OnListBeginRDrag"></event>\r
+                                             <event name="OnListCacheHint"></event>\r
+                                             <event name="OnListColBeginDrag"></event>\r
+                                             <event name="OnListColClick"></event>\r
+                                             <event name="OnListColDragging"></event>\r
+                                             <event name="OnListColEndDrag"></event>\r
+                                             <event name="OnListColRightClick"></event>\r
+                                             <event name="OnListDeleteAllItems"></event>\r
+                                             <event name="OnListDeleteItem"></event>\r
+                                             <event name="OnListEndLabelEdit">OnListEndLabelEdit</event>\r
+                                             <event name="OnListInsertItem"></event>\r
+                                             <event name="OnListItemActivated">OnListItemActivated</event>\r
+                                             <event name="OnListItemDeselected"></event>\r
+                                             <event name="OnListItemFocused"></event>\r
+                                             <event name="OnListItemMiddleClick"></event>\r
+                                             <event name="OnListItemRightClick"></event>\r
+                                             <event name="OnListItemSelected">OnListItemSelected</event>\r
+                                             <event name="OnListKeyDown"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint"></event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                         <object class="notebookpage" expanded="1">\r
+                             <property name="bitmap"></property>\r
+                             <property name="label">Receiving</property>\r
+                             <property name="select">1</property>\r
+                             <object class="wxPanel" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_PANELRECEIVING</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_panelReceiving</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style">wxTAB_TRAVERSAL</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                                 <object class="wxBoxSizer" expanded="1">\r
+                                     <property name="minimum_size"></property>\r
+                                     <property name="name">bSizer681</property>\r
+                                     <property name="orient">wxVERTICAL</property>\r
+                                     <property name="permission">none</property>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">0</property>\r
+                                         <object class="spacer" expanded="1">\r
+                                             <property name="height">0</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="width">0</property>\r
+                                         </object>\r
+                                     </object>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">6</property>\r
+                                         <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>\r
+                                         <property name="proportion">0</property>\r
+                                         <object class="wxStaticText" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_ANY</property>\r
+                                             <property name="label">These are your Bitcoin addresses for receiving payments.  You can give a different one to each sender to keep track of who is paying you.  The highlighted address will be displayed in the main window.</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_staticText45</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style"></property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <property name="wrap">570</property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint"></event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxEXPAND</property>\r
+                                         <property name="proportion">0</property>\r
+                                         <object class="spacer" expanded="1">\r
+                                             <property name="height">2</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="width">0</property>\r
+                                         </object>\r
+                                     </object>\r
+                                     <object class="sizeritem" expanded="1">\r
+                                         <property name="border">5</property>\r
+                                         <property name="flag">wxALL|wxEXPAND</property>\r
+                                         <property name="proportion">1</property>\r
+                                         <object class="wxListCtrl" expanded="1">\r
+                                             <property name="bg"></property>\r
+                                             <property name="context_help"></property>\r
+                                             <property name="enabled">1</property>\r
+                                             <property name="fg"></property>\r
+                                             <property name="font"></property>\r
+                                             <property name="hidden">0</property>\r
+                                             <property name="id">wxID_LISTCTRLRECEIVING</property>\r
+                                             <property name="maximum_size"></property>\r
+                                             <property name="minimum_size"></property>\r
+                                             <property name="name">m_listCtrlReceiving</property>\r
+                                             <property name="permission">protected</property>\r
+                                             <property name="pos"></property>\r
+                                             <property name="size"></property>\r
+                                             <property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING</property>\r
+                                             <property name="subclass"></property>\r
+                                             <property name="tooltip"></property>\r
+                                             <property name="validator_data_type"></property>\r
+                                             <property name="validator_style">wxFILTER_NONE</property>\r
+                                             <property name="validator_type">wxDefaultValidator</property>\r
+                                             <property name="validator_variable"></property>\r
+                                             <property name="window_extra_style"></property>\r
+                                             <property name="window_name"></property>\r
+                                             <property name="window_style"></property>\r
+                                             <event name="OnChar"></event>\r
+                                             <event name="OnEnterWindow"></event>\r
+                                             <event name="OnEraseBackground"></event>\r
+                                             <event name="OnKeyDown"></event>\r
+                                             <event name="OnKeyUp"></event>\r
+                                             <event name="OnKillFocus"></event>\r
+                                             <event name="OnLeaveWindow"></event>\r
+                                             <event name="OnLeftDClick"></event>\r
+                                             <event name="OnLeftDown"></event>\r
+                                             <event name="OnLeftUp"></event>\r
+                                             <event name="OnListBeginDrag"></event>\r
+                                             <event name="OnListBeginLabelEdit"></event>\r
+                                             <event name="OnListBeginRDrag"></event>\r
+                                             <event name="OnListCacheHint"></event>\r
+                                             <event name="OnListColBeginDrag"></event>\r
+                                             <event name="OnListColClick"></event>\r
+                                             <event name="OnListColDragging"></event>\r
+                                             <event name="OnListColEndDrag"></event>\r
+                                             <event name="OnListColRightClick"></event>\r
+                                             <event name="OnListDeleteAllItems"></event>\r
+                                             <event name="OnListDeleteItem"></event>\r
+                                             <event name="OnListEndLabelEdit">OnListEndLabelEdit</event>\r
+                                             <event name="OnListInsertItem"></event>\r
+                                             <event name="OnListItemActivated">OnListItemActivated</event>\r
+                                             <event name="OnListItemDeselected"></event>\r
+                                             <event name="OnListItemFocused"></event>\r
+                                             <event name="OnListItemMiddleClick"></event>\r
+                                             <event name="OnListItemRightClick"></event>\r
+                                             <event name="OnListItemSelected">OnListItemSelected</event>\r
+                                             <event name="OnListKeyDown"></event>\r
+                                             <event name="OnMiddleDClick"></event>\r
+                                             <event name="OnMiddleDown"></event>\r
+                                             <event name="OnMiddleUp"></event>\r
+                                             <event name="OnMotion"></event>\r
+                                             <event name="OnMouseEvents"></event>\r
+                                             <event name="OnMouseWheel"></event>\r
+                                             <event name="OnPaint"></event>\r
+                                             <event name="OnRightDClick"></event>\r
+                                             <event name="OnRightDown"></event>\r
+                                             <event name="OnRightUp"></event>\r
+                                             <event name="OnSetFocus"></event>\r
+                                             <event name="OnSize"></event>\r
+                                             <event name="OnUpdateUI"></event>\r
+                                         </object>\r
+                                     </object>\r
+                                 </object>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer69</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONDELETE</property>\r
+                                 <property name="label">&amp;Delete</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonDelete</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonDelete</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONCOPY</property>\r
+                                 <property name="label"> &amp;Copy to Clipboard </property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCopy</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCopy</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONEDIT</property>\r
+                                 <property name="label">&amp;Edit...</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonEdit</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonEdit</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_BUTTONNEW</property>\r
+                                 <property name="label"> &amp;New Address... </property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonNew</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonNew</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_OK</property>\r
+                                 <property name="label">OK</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonOK</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonOK</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_CANCEL</property>\r
+                                 <property name="label">Cancel</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCancel</property>\r
+                                 <property name="permission">public</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCancel</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+         <object class="Dialog" expanded="0">\r
+             <property name="bg"></property>\r
+             <property name="center"></property>\r
+             <property name="context_help"></property>\r
+             <property name="enabled">1</property>\r
+             <property name="extra_style"></property>\r
+             <property name="fg"></property>\r
+             <property name="font"></property>\r
+             <property name="hidden">0</property>\r
+             <property name="id">wxID_ANY</property>\r
+             <property name="maximum_size"></property>\r
+             <property name="minimum_size"></property>\r
+             <property name="name">CGetTextFromUserDialogBase</property>\r
+             <property name="pos"></property>\r
+             <property name="size">440,138</property>\r
+             <property name="style">wxDEFAULT_DIALOG_STYLE</property>\r
+             <property name="subclass"></property>\r
+             <property name="title"></property>\r
+             <property name="tooltip"></property>\r
+             <property name="validator_data_type"></property>\r
+             <property name="validator_style">wxFILTER_NONE</property>\r
+             <property name="validator_type">wxDefaultValidator</property>\r
+             <property name="validator_variable"></property>\r
+             <property name="window_extra_style"></property>\r
+             <property name="window_name"></property>\r
+             <property name="window_style"></property>\r
+             <event name="OnActivate"></event>\r
+             <event name="OnActivateApp"></event>\r
+             <event name="OnChar"></event>\r
+             <event name="OnClose">OnClose</event>\r
+             <event name="OnEnterWindow"></event>\r
+             <event name="OnEraseBackground"></event>\r
+             <event name="OnHibernate"></event>\r
+             <event name="OnIconize"></event>\r
+             <event name="OnIdle"></event>\r
+             <event name="OnInitDialog"></event>\r
+             <event name="OnKeyDown"></event>\r
+             <event name="OnKeyUp"></event>\r
+             <event name="OnKillFocus"></event>\r
+             <event name="OnLeaveWindow"></event>\r
+             <event name="OnLeftDClick"></event>\r
+             <event name="OnLeftDown"></event>\r
+             <event name="OnLeftUp"></event>\r
+             <event name="OnMiddleDClick"></event>\r
+             <event name="OnMiddleDown"></event>\r
+             <event name="OnMiddleUp"></event>\r
+             <event name="OnMotion"></event>\r
+             <event name="OnMouseEvents"></event>\r
+             <event name="OnMouseWheel"></event>\r
+             <event name="OnPaint"></event>\r
+             <event name="OnRightDClick"></event>\r
+             <event name="OnRightDown"></event>\r
+             <event name="OnRightUp"></event>\r
+             <event name="OnSetFocus"></event>\r
+             <event name="OnSize"></event>\r
+             <event name="OnUpdateUI"></event>\r
+             <object class="wxBoxSizer" expanded="1">\r
+                 <property name="minimum_size"></property>\r
+                 <property name="name">bSizer79</property>\r
+                 <property name="orient">wxVERTICAL</property>\r
+                 <property name="permission">none</property>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">10</property>\r
+                     <property name="flag">wxEXPAND|wxALL</property>\r
+                     <property name="proportion">1</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer81</property>\r
+                         <property name="orient">wxVERTICAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxStaticText" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="label"></property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_staticTextMessage1</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <property name="wrap">-1</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxTextCtrl" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_TEXTCTRL</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="maxlength">0</property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_textCtrl1</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style">wxTE_PROCESS_ENTER</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="value"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown">OnKeyDown</event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnText"></event>\r
+                                 <event name="OnTextEnter"></event>\r
+                                 <event name="OnTextMaxLen"></event>\r
+                                 <event name="OnTextURL"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxStaticText" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">1</property>\r
+                                 <property name="id">wxID_ANY</property>\r
+                                 <property name="label"></property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_staticTextMessage2</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <property name="wrap">-1</property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxTextCtrl" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">1</property>\r
+                                 <property name="id">wxID_TEXTCTRL</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="maxlength">0</property>\r
+                                 <property name="minimum_size"></property>\r
+                                 <property name="name">m_textCtrl2</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style">wxTE_PROCESS_ENTER</property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="value"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown">OnKeyDown</event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnText"></event>\r
+                                 <event name="OnTextEnter"></event>\r
+                                 <event name="OnTextMaxLen"></event>\r
+                                 <event name="OnTextURL"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+                 <object class="sizeritem" expanded="1">\r
+                     <property name="border">5</property>\r
+                     <property name="flag">wxEXPAND</property>\r
+                     <property name="proportion">0</property>\r
+                     <object class="wxBoxSizer" expanded="1">\r
+                         <property name="minimum_size"></property>\r
+                         <property name="name">bSizer80</property>\r
+                         <property name="orient">wxHORIZONTAL</property>\r
+                         <property name="permission">none</property>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxEXPAND</property>\r
+                             <property name="proportion">1</property>\r
+                             <object class="spacer" expanded="1">\r
+                                 <property name="height">0</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="width">0</property>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_OK</property>\r
+                                 <property name="label">OK</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonOK</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size">-1,-1</property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonOK</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                         <object class="sizeritem" expanded="1">\r
+                             <property name="border">5</property>\r
+                             <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>\r
+                             <property name="proportion">0</property>\r
+                             <object class="wxButton" expanded="1">\r
+                                 <property name="bg"></property>\r
+                                 <property name="context_help"></property>\r
+                                 <property name="default">0</property>\r
+                                 <property name="enabled">1</property>\r
+                                 <property name="fg"></property>\r
+                                 <property name="font"></property>\r
+                                 <property name="hidden">0</property>\r
+                                 <property name="id">wxID_CANCEL</property>\r
+                                 <property name="label">Cancel</property>\r
+                                 <property name="maximum_size"></property>\r
+                                 <property name="minimum_size">-1,-1</property>\r
+                                 <property name="name">m_buttonCancel</property>\r
+                                 <property name="permission">protected</property>\r
+                                 <property name="pos"></property>\r
+                                 <property name="size"></property>\r
+                                 <property name="style"></property>\r
+                                 <property name="subclass"></property>\r
+                                 <property name="tooltip"></property>\r
+                                 <property name="validator_data_type"></property>\r
+                                 <property name="validator_style">wxFILTER_NONE</property>\r
+                                 <property name="validator_type">wxDefaultValidator</property>\r
+                                 <property name="validator_variable"></property>\r
+                                 <property name="window_extra_style"></property>\r
+                                 <property name="window_name"></property>\r
+                                 <property name="window_style"></property>\r
+                                 <event name="OnButtonClick">OnButtonCancel</event>\r
+                                 <event name="OnChar"></event>\r
+                                 <event name="OnEnterWindow"></event>\r
+                                 <event name="OnEraseBackground"></event>\r
+                                 <event name="OnKeyDown"></event>\r
+                                 <event name="OnKeyUp"></event>\r
+                                 <event name="OnKillFocus"></event>\r
+                                 <event name="OnLeaveWindow"></event>\r
+                                 <event name="OnLeftDClick"></event>\r
+                                 <event name="OnLeftDown"></event>\r
+                                 <event name="OnLeftUp"></event>\r
+                                 <event name="OnMiddleDClick"></event>\r
+                                 <event name="OnMiddleDown"></event>\r
+                                 <event name="OnMiddleUp"></event>\r
+                                 <event name="OnMotion"></event>\r
+                                 <event name="OnMouseEvents"></event>\r
+                                 <event name="OnMouseWheel"></event>\r
+                                 <event name="OnPaint"></event>\r
+                                 <event name="OnRightDClick"></event>\r
+                                 <event name="OnRightDown"></event>\r
+                                 <event name="OnRightUp"></event>\r
+                                 <event name="OnSetFocus"></event>\r
+                                 <event name="OnSize"></event>\r
+                                 <event name="OnUpdateUI"></event>\r
+                             </object>\r
+                         </object>\r
+                     </object>\r
+                 </object>\r
+             </object>\r
+         </object>\r
+     </object>\r
+ </wxFormBuilder_Project>\r
diff --cc src/db.cpp
index 0000000000000000000000000000000000000000,28a8b717332280881f52814f441c19eac7804280..071231c5ddcd241a7a2479f401fca8dcc039efe4
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1023 +1,1023 @@@
 -                // Menu state
 -                if (strKey == "fGenerateBitcoins")  ssValue >> fGenerateBitcoins;
 -
+ // Copyright (c) 2009-2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ #include "headers.h"
+ void ThreadFlushWalletDB(void* parg);
+ unsigned int nWalletDBUpdated;
+ uint64 nAccountingEntryNumber = 0;
+ //
+ // CDB
+ //
+ static CCriticalSection cs_db;
+ static bool fDbEnvInit = false;
+ DbEnv dbenv(0);
+ static map<string, int> mapFileUseCount;
+ static map<string, Db*> mapDb;
+ class CDBInit
+ {
+ public:
+     CDBInit()
+     {
+     }
+     ~CDBInit()
+     {
+         if (fDbEnvInit)
+         {
+             dbenv.close(0);
+             fDbEnvInit = false;
+         }
+     }
+ }
+ instance_of_cdbinit;
+ CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)
+ {
+     int ret;
+     if (pszFile == NULL)
+         return;
+     fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w'));
+     bool fCreate = strchr(pszMode, 'c');
+     unsigned int nFlags = DB_THREAD;
+     if (fCreate)
+         nFlags |= DB_CREATE;
+     CRITICAL_BLOCK(cs_db)
+     {
+         if (!fDbEnvInit)
+         {
+             if (fShutdown)
+                 return;
+             string strDataDir = GetDataDir();
+             string strLogDir = strDataDir + "/database";
+             filesystem::create_directory(strLogDir.c_str());
+             string strErrorFile = strDataDir + "/db.log";
+             printf("dbenv.open strLogDir=%s strErrorFile=%s\n", strLogDir.c_str(), strErrorFile.c_str());
+             dbenv.set_lg_dir(strLogDir.c_str());
+             dbenv.set_lg_max(10000000);
+             dbenv.set_lk_max_locks(10000);
+             dbenv.set_lk_max_objects(10000);
+             dbenv.set_errfile(fopen(strErrorFile.c_str(), "a")); /// debug
+             dbenv.set_flags(DB_AUTO_COMMIT, 1);
+             ret = dbenv.open(strDataDir.c_str(),
+                              DB_CREATE     |
+                              DB_INIT_LOCK  |
+                              DB_INIT_LOG   |
+                              DB_INIT_MPOOL |
+                              DB_INIT_TXN   |
+                              DB_THREAD     |
+                              DB_RECOVER,
+                              S_IRUSR | S_IWUSR);
+             if (ret > 0)
+                 throw runtime_error(strprintf("CDB() : error %d opening database environment", ret));
+             fDbEnvInit = true;
+         }
+         strFile = pszFile;
+         ++mapFileUseCount[strFile];
+         pdb = mapDb[strFile];
+         if (pdb == NULL)
+         {
+             pdb = new Db(&dbenv, 0);
+             ret = pdb->open(NULL,      // Txn pointer
+                             pszFile,   // Filename
+                             "main",    // Logical db name
+                             DB_BTREE,  // Database type
+                             nFlags,    // Flags
+                             0);
+             if (ret > 0)
+             {
+                 delete pdb;
+                 pdb = NULL;
+                 CRITICAL_BLOCK(cs_db)
+                     --mapFileUseCount[strFile];
+                 strFile = "";
+                 throw runtime_error(strprintf("CDB() : can't open database file %s, error %d", pszFile, ret));
+             }
+             if (fCreate && !Exists(string("version")))
+             {
+                 bool fTmp = fReadOnly;
+                 fReadOnly = false;
+                 WriteVersion(VERSION);
+                 fReadOnly = fTmp;
+             }
+             mapDb[strFile] = pdb;
+         }
+     }
+ }
+ void CDB::Close()
+ {
+     if (!pdb)
+         return;
+     if (!vTxn.empty())
+         vTxn.front()->abort();
+     vTxn.clear();
+     pdb = NULL;
+     // Flush database activity from memory pool to disk log
+     unsigned int nMinutes = 0;
+     if (fReadOnly)
+         nMinutes = 1;
+     if (strFile == "addr.dat")
+         nMinutes = 2;
+     if (strFile == "blkindex.dat" && IsInitialBlockDownload() && nBestHeight % 500 != 0)
+         nMinutes = 1;
+     dbenv.txn_checkpoint(0, nMinutes, 0);
+     CRITICAL_BLOCK(cs_db)
+         --mapFileUseCount[strFile];
+ }
+ void CloseDb(const string& strFile)
+ {
+     CRITICAL_BLOCK(cs_db)
+     {
+         if (mapDb[strFile] != NULL)
+         {
+             // Close the database handle
+             Db* pdb = mapDb[strFile];
+             pdb->close(0);
+             delete pdb;
+             mapDb[strFile] = NULL;
+         }
+     }
+ }
+ void DBFlush(bool fShutdown)
+ {
+     // Flush log data to the actual data file
+     //  on all files that are not in use
+     printf("DBFlush(%s)%s\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started");
+     if (!fDbEnvInit)
+         return;
+     CRITICAL_BLOCK(cs_db)
+     {
+         map<string, int>::iterator mi = mapFileUseCount.begin();
+         while (mi != mapFileUseCount.end())
+         {
+             string strFile = (*mi).first;
+             int nRefCount = (*mi).second;
+             printf("%s refcount=%d\n", strFile.c_str(), nRefCount);
+             if (nRefCount == 0)
+             {
+                 // Move log data to the dat file
+                 CloseDb(strFile);
+                 dbenv.txn_checkpoint(0, 0, 0);
+                 printf("%s flush\n", strFile.c_str());
+                 dbenv.lsn_reset(strFile.c_str(), 0);
+                 mapFileUseCount.erase(mi++);
+             }
+             else
+                 mi++;
+         }
+         if (fShutdown)
+         {
+             char** listp;
+             if (mapFileUseCount.empty())
+                 dbenv.log_archive(&listp, DB_ARCH_REMOVE);
+             dbenv.close(0);
+             fDbEnvInit = false;
+         }
+     }
+ }
+ //
+ // CTxDB
+ //
+ bool CTxDB::ReadTxIndex(uint256 hash, CTxIndex& txindex)
+ {
+     assert(!fClient);
+     txindex.SetNull();
+     return Read(make_pair(string("tx"), hash), txindex);
+ }
+ bool CTxDB::UpdateTxIndex(uint256 hash, const CTxIndex& txindex)
+ {
+     assert(!fClient);
+     return Write(make_pair(string("tx"), hash), txindex);
+ }
+ bool CTxDB::AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeight)
+ {
+     assert(!fClient);
+     // Add to tx index
+     uint256 hash = tx.GetHash();
+     CTxIndex txindex(pos, tx.vout.size());
+     return Write(make_pair(string("tx"), hash), txindex);
+ }
+ bool CTxDB::EraseTxIndex(const CTransaction& tx)
+ {
+     assert(!fClient);
+     uint256 hash = tx.GetHash();
+     return Erase(make_pair(string("tx"), hash));
+ }
+ bool CTxDB::ContainsTx(uint256 hash)
+ {
+     assert(!fClient);
+     return Exists(make_pair(string("tx"), hash));
+ }
+ bool CTxDB::ReadOwnerTxes(uint160 hash160, int nMinHeight, vector<CTransaction>& vtx)
+ {
+     assert(!fClient);
+     vtx.clear();
+     // Get cursor
+     Dbc* pcursor = GetCursor();
+     if (!pcursor)
+         return false;
+     unsigned int fFlags = DB_SET_RANGE;
+     loop
+     {
+         // Read next record
+         CDataStream ssKey;
+         if (fFlags == DB_SET_RANGE)
+             ssKey << string("owner") << hash160 << CDiskTxPos(0, 0, 0);
+         CDataStream ssValue;
+         int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
+         fFlags = DB_NEXT;
+         if (ret == DB_NOTFOUND)
+             break;
+         else if (ret != 0)
+         {
+             pcursor->close();
+             return false;
+         }
+         // Unserialize
+         string strType;
+         uint160 hashItem;
+         CDiskTxPos pos;
+         ssKey >> strType >> hashItem >> pos;
+         int nItemHeight;
+         ssValue >> nItemHeight;
+         // Read transaction
+         if (strType != "owner" || hashItem != hash160)
+             break;
+         if (nItemHeight >= nMinHeight)
+         {
+             vtx.resize(vtx.size()+1);
+             if (!vtx.back().ReadFromDisk(pos))
+             {
+                 pcursor->close();
+                 return false;
+             }
+         }
+     }
+     pcursor->close();
+     return true;
+ }
+ bool CTxDB::ReadDiskTx(uint256 hash, CTransaction& tx, CTxIndex& txindex)
+ {
+     assert(!fClient);
+     tx.SetNull();
+     if (!ReadTxIndex(hash, txindex))
+         return false;
+     return (tx.ReadFromDisk(txindex.pos));
+ }
+ bool CTxDB::ReadDiskTx(uint256 hash, CTransaction& tx)
+ {
+     CTxIndex txindex;
+     return ReadDiskTx(hash, tx, txindex);
+ }
+ bool CTxDB::ReadDiskTx(COutPoint outpoint, CTransaction& tx, CTxIndex& txindex)
+ {
+     return ReadDiskTx(outpoint.hash, tx, txindex);
+ }
+ bool CTxDB::ReadDiskTx(COutPoint outpoint, CTransaction& tx)
+ {
+     CTxIndex txindex;
+     return ReadDiskTx(outpoint.hash, tx, txindex);
+ }
+ bool CTxDB::WriteBlockIndex(const CDiskBlockIndex& blockindex)
+ {
+     return Write(make_pair(string("blockindex"), blockindex.GetBlockHash()), blockindex);
+ }
+ bool CTxDB::EraseBlockIndex(uint256 hash)
+ {
+     return Erase(make_pair(string("blockindex"), hash));
+ }
+ bool CTxDB::ReadHashBestChain(uint256& hashBestChain)
+ {
+     return Read(string("hashBestChain"), hashBestChain);
+ }
+ bool CTxDB::WriteHashBestChain(uint256 hashBestChain)
+ {
+     return Write(string("hashBestChain"), hashBestChain);
+ }
+ bool CTxDB::ReadBestInvalidWork(CBigNum& bnBestInvalidWork)
+ {
+     return Read(string("bnBestInvalidWork"), bnBestInvalidWork);
+ }
+ bool CTxDB::WriteBestInvalidWork(CBigNum bnBestInvalidWork)
+ {
+     return Write(string("bnBestInvalidWork"), bnBestInvalidWork);
+ }
+ CBlockIndex* InsertBlockIndex(uint256 hash)
+ {
+     if (hash == 0)
+         return NULL;
+     // Return existing
+     map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
+     if (mi != mapBlockIndex.end())
+         return (*mi).second;
+     // Create new
+     CBlockIndex* pindexNew = new CBlockIndex();
+     if (!pindexNew)
+         throw runtime_error("LoadBlockIndex() : new CBlockIndex failed");
+     mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
+     pindexNew->phashBlock = &((*mi).first);
+     return pindexNew;
+ }
+ bool CTxDB::LoadBlockIndex()
+ {
+     // Get database cursor
+     Dbc* pcursor = GetCursor();
+     if (!pcursor)
+         return false;
+     // Load mapBlockIndex
+     unsigned int fFlags = DB_SET_RANGE;
+     loop
+     {
+         // Read next record
+         CDataStream ssKey;
+         if (fFlags == DB_SET_RANGE)
+             ssKey << make_pair(string("blockindex"), uint256(0));
+         CDataStream ssValue;
+         int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
+         fFlags = DB_NEXT;
+         if (ret == DB_NOTFOUND)
+             break;
+         else if (ret != 0)
+             return false;
+         // Unserialize
+         string strType;
+         ssKey >> strType;
+         if (strType == "blockindex")
+         {
+             CDiskBlockIndex diskindex;
+             ssValue >> diskindex;
+             // Construct block index object
+             CBlockIndex* pindexNew = InsertBlockIndex(diskindex.GetBlockHash());
+             pindexNew->pprev          = InsertBlockIndex(diskindex.hashPrev);
+             pindexNew->pnext          = InsertBlockIndex(diskindex.hashNext);
+             pindexNew->nFile          = diskindex.nFile;
+             pindexNew->nBlockPos      = diskindex.nBlockPos;
+             pindexNew->nHeight        = diskindex.nHeight;
+             pindexNew->nVersion       = diskindex.nVersion;
+             pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot;
+             pindexNew->nTime          = diskindex.nTime;
+             pindexNew->nBits          = diskindex.nBits;
+             pindexNew->nNonce         = diskindex.nNonce;
+             // Watch for genesis block
+             if (pindexGenesisBlock == NULL && diskindex.GetBlockHash() == hashGenesisBlock)
+                 pindexGenesisBlock = pindexNew;
+             if (!pindexNew->CheckIndex())
+                 return error("LoadBlockIndex() : CheckIndex failed at %d", pindexNew->nHeight);
+         }
+         else
+         {
+             break;
+         }
+     }
+     pcursor->close();
+     // Calculate bnChainWork
+     vector<pair<int, CBlockIndex*> > vSortedByHeight;
+     vSortedByHeight.reserve(mapBlockIndex.size());
+     foreach(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
+     {
+         CBlockIndex* pindex = item.second;
+         vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
+     }
+     sort(vSortedByHeight.begin(), vSortedByHeight.end());
+     foreach(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
+     {
+         CBlockIndex* pindex = item.second;
+         pindex->bnChainWork = (pindex->pprev ? pindex->pprev->bnChainWork : 0) + pindex->GetBlockWork();
+     }
+     // Load hashBestChain pointer to end of best chain
+     if (!ReadHashBestChain(hashBestChain))
+     {
+         if (pindexGenesisBlock == NULL)
+             return true;
+         return error("CTxDB::LoadBlockIndex() : hashBestChain not loaded");
+     }
+     if (!mapBlockIndex.count(hashBestChain))
+         return error("CTxDB::LoadBlockIndex() : hashBestChain not found in the block index");
+     pindexBest = mapBlockIndex[hashBestChain];
+     nBestHeight = pindexBest->nHeight;
+     bnBestChainWork = pindexBest->bnChainWork;
+     printf("LoadBlockIndex(): hashBestChain=%s  height=%d\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight);
+     // Load bnBestInvalidWork, OK if it doesn't exist
+     ReadBestInvalidWork(bnBestInvalidWork);
+     // Verify blocks in the best chain
+     CBlockIndex* pindexFork = NULL;
+     for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev)
+     {
+         if (pindex->nHeight < nBestHeight-2500 && !mapArgs.count("-checkblocks"))
+             break;
+         CBlock block;
+         if (!block.ReadFromDisk(pindex))
+             return error("LoadBlockIndex() : block.ReadFromDisk failed");
+         if (!block.CheckBlock())
+         {
+             printf("LoadBlockIndex() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str());
+             pindexFork = pindex->pprev;
+         }
+     }
+     if (pindexFork)
+     {
+         // Reorg back to the fork
+         printf("LoadBlockIndex() : *** moving best chain pointer back to block %d\n", pindexFork->nHeight);
+         CBlock block;
+         if (!block.ReadFromDisk(pindexFork))
+             return error("LoadBlockIndex() : block.ReadFromDisk failed");
+         CTxDB txdb;
+         block.SetBestChain(txdb, pindexFork);
+     }
+     return true;
+ }
+ //
+ // CAddrDB
+ //
+ bool CAddrDB::WriteAddress(const CAddress& addr)
+ {
+     return Write(make_pair(string("addr"), addr.GetKey()), addr);
+ }
+ bool CAddrDB::EraseAddress(const CAddress& addr)
+ {
+     return Erase(make_pair(string("addr"), addr.GetKey()));
+ }
+ bool CAddrDB::LoadAddresses()
+ {
+     CRITICAL_BLOCK(cs_mapAddresses)
+     {
+         // Load user provided addresses
+         CAutoFile filein = fopen((GetDataDir() + "/addr.txt").c_str(), "rt");
+         if (filein)
+         {
+             try
+             {
+                 char psz[1000];
+                 while (fgets(psz, sizeof(psz), filein))
+                 {
+                     CAddress addr(psz, NODE_NETWORK);
+                     addr.nTime = 0; // so it won't relay unless successfully connected
+                     if (addr.IsValid())
+                         AddAddress(addr);
+                 }
+             }
+             catch (...) { }
+         }
+         // Get cursor
+         Dbc* pcursor = GetCursor();
+         if (!pcursor)
+             return false;
+         loop
+         {
+             // Read next record
+             CDataStream ssKey;
+             CDataStream ssValue;
+             int ret = ReadAtCursor(pcursor, ssKey, ssValue);
+             if (ret == DB_NOTFOUND)
+                 break;
+             else if (ret != 0)
+                 return false;
+             // Unserialize
+             string strType;
+             ssKey >> strType;
+             if (strType == "addr")
+             {
+                 CAddress addr;
+                 ssValue >> addr;
+                 mapAddresses.insert(make_pair(addr.GetKey(), addr));
+             }
+         }
+         pcursor->close();
+         printf("Loaded %d addresses\n", mapAddresses.size());
+     }
+     return true;
+ }
+ bool LoadAddresses()
+ {
+     return CAddrDB("cr+").LoadAddresses();
+ }
+ //
+ // CWalletDB
+ //
+ static set<int64> setKeyPool;
+ static CCriticalSection cs_setKeyPool;
+ bool CWalletDB::ReadAccount(const string& strAccount, CAccount& account)
+ {
+     account.SetNull();
+     return Read(make_pair(string("acc"), strAccount), account);
+ }
+ bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account)
+ {
+     return Write(make_pair(string("acc"), strAccount), account);
+ }
+ bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
+ {
+     return Write(make_tuple(string("acentry"), acentry.strAccount, ++nAccountingEntryNumber), acentry);
+ }
+ int64 CWalletDB::GetAccountCreditDebit(const string& strAccount)
+ {
+     list<CAccountingEntry> entries;
+     ListAccountCreditDebit(strAccount, entries);
+     int64 nCreditDebit = 0;
+     foreach (const CAccountingEntry& entry, entries)
+         nCreditDebit += entry.nCreditDebit;
+     return nCreditDebit;
+ }
+ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& entries)
+ {
+     int64 nCreditDebit = 0;
+     bool fAllAccounts = (strAccount == "*");
+     Dbc* pcursor = GetCursor();
+     if (!pcursor)
+         throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
+     unsigned int fFlags = DB_SET_RANGE;
+     loop
+     {
+         // Read next record
+         CDataStream ssKey;
+         if (fFlags == DB_SET_RANGE)
+             ssKey << make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64(0));
+         CDataStream ssValue;
+         int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
+         fFlags = DB_NEXT;
+         if (ret == DB_NOTFOUND)
+             break;
+         else if (ret != 0)
+         {
+             pcursor->close();
+             throw runtime_error("CWalletDB::ListAccountCreditDebit() : error scanning DB");
+         }
+         // Unserialize
+         string strType;
+         ssKey >> strType;
+         if (strType != "acentry")
+             break;
+         CAccountingEntry acentry;
+         ssKey >> acentry.strAccount;
+         if (!fAllAccounts && acentry.strAccount != strAccount)
+             break;
+         ssValue >> acentry;
+         entries.push_back(acentry);
+     }
+     pcursor->close();
+ }
+ bool CWalletDB::LoadWallet()
+ {
+     vchDefaultKey.clear();
+     int nFileVersion = 0;
+     vector<uint256> vWalletUpgrade;
+     // Modify defaults
+ #ifndef __WXMSW__
+     // Tray icon sometimes disappears on 9.10 karmic koala 64-bit, leaving no way to access the program
+     fMinimizeToTray = false;
+     fMinimizeOnClose = false;
+ #endif
+     //// todo: shouldn't we catch exceptions and try to recover and continue?
+     CRITICAL_BLOCK(cs_mapWallet)
+     CRITICAL_BLOCK(cs_mapKeys)
+     {
+         // Get cursor
+         Dbc* pcursor = GetCursor();
+         if (!pcursor)
+             return false;
+         loop
+         {
+             // Read next record
+             CDataStream ssKey;
+             CDataStream ssValue;
+             int ret = ReadAtCursor(pcursor, ssKey, ssValue);
+             if (ret == DB_NOTFOUND)
+                 break;
+             else if (ret != 0)
+                 return false;
+             // Unserialize
+             // Taking advantage of the fact that pair serialization
+             // is just the two items serialized one after the other
+             string strType;
+             ssKey >> strType;
+             if (strType == "name")
+             {
+                 string strAddress;
+                 ssKey >> strAddress;
+                 ssValue >> mapAddressBook[strAddress];
+             }
+             else if (strType == "tx")
+             {
+                 uint256 hash;
+                 ssKey >> hash;
+                 CWalletTx& wtx = mapWallet[hash];
+                 ssValue >> wtx;
+                 if (wtx.GetHash() != hash)
+                     printf("Error in wallet.dat, hash mismatch\n");
+                 // Undo serialize changes in 31600
+                 if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703)
+                 {
+                     if (!ssValue.empty())
+                     {
+                         char fTmp;
+                         char fUnused;
+                         ssValue >> fTmp >> fUnused >> wtx.strFromAccount;
+                         printf("LoadWallet() upgrading tx ver=%d %d '%s' %s\n", wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount.c_str(), hash.ToString().c_str());
+                         wtx.fTimeReceivedIsTxTime = fTmp;
+                     }
+                     else
+                     {
+                         printf("LoadWallet() repairing tx ver=%d %s\n", wtx.fTimeReceivedIsTxTime, hash.ToString().c_str());
+                         wtx.fTimeReceivedIsTxTime = 0;
+                     }
+                     vWalletUpgrade.push_back(hash);
+                 }
+                 //// debug print
+                 //printf("LoadWallet  %s\n", wtx.GetHash().ToString().c_str());
+                 //printf(" %12I64d  %s  %s  %s\n",
+                 //    wtx.vout[0].nValue,
+                 //    DateTimeStrFormat("%x %H:%M:%S", wtx.GetBlockTime()).c_str(),
+                 //    wtx.hashBlock.ToString().substr(0,20).c_str(),
+                 //    wtx.mapValue["message"].c_str());
+             }
+             else if (strType == "acentry")
+             {
+                 string strAccount;
+                 ssKey >> strAccount;
+                 uint64 nNumber;
+                 ssKey >> nNumber;
+                 if (nNumber > nAccountingEntryNumber)
+                     nAccountingEntryNumber = nNumber;
+             }
+             else if (strType == "key" || strType == "wkey")
+             {
+                 vector<unsigned char> vchPubKey;
+                 ssKey >> vchPubKey;
+                 CWalletKey wkey;
+                 if (strType == "key")
+                     ssValue >> wkey.vchPrivKey;
+                 else
+                     ssValue >> wkey;
+                 mapKeys[vchPubKey] = wkey.vchPrivKey;
+                 mapPubKeys[Hash160(vchPubKey)] = vchPubKey;
+             }
+             else if (strType == "defaultkey")
+             {
+                 ssValue >> vchDefaultKey;
+             }
+             else if (strType == "pool")
+             {
+                 int64 nIndex;
+                 ssKey >> nIndex;
+                 setKeyPool.insert(nIndex);
+             }
+             else if (strType == "version")
+             {
+                 ssValue >> nFileVersion;
+                 if (nFileVersion == 10300)
+                     nFileVersion = 300;
+             }
+             else if (strType == "setting")
+             {
+                 string strKey;
+                 ssKey >> strKey;
+                 // Options
++#ifndef GUI
++                if (strKey == "fGenerateBitcoins")  ssValue >> fGenerateBitcoins;
++#endif
+                 if (strKey == "nTransactionFee")    ssValue >> nTransactionFee;
+                 if (strKey == "addrIncoming")       ssValue >> addrIncoming;
+                 if (strKey == "fLimitProcessors")   ssValue >> fLimitProcessors;
+                 if (strKey == "nLimitProcessors")   ssValue >> nLimitProcessors;
+                 if (strKey == "fMinimizeToTray")    ssValue >> fMinimizeToTray;
+                 if (strKey == "fMinimizeOnClose")   ssValue >> fMinimizeOnClose;
+                 if (strKey == "fUseProxy")          ssValue >> fUseProxy;
+                 if (strKey == "addrProxy")          ssValue >> addrProxy;
+                 if (fHaveUPnP && strKey == "fUseUPnP")           ssValue >> fUseUPnP;
+             }
+         }
+         pcursor->close();
+     }
+     foreach(uint256 hash, vWalletUpgrade)
+         WriteTx(hash, mapWallet[hash]);
+     printf("nFileVersion = %d\n", nFileVersion);
+     printf("fGenerateBitcoins = %d\n", fGenerateBitcoins);
+     printf("nTransactionFee = %"PRI64d"\n", nTransactionFee);
+     printf("addrIncoming = %s\n", addrIncoming.ToString().c_str());
+     printf("fMinimizeToTray = %d\n", fMinimizeToTray);
+     printf("fMinimizeOnClose = %d\n", fMinimizeOnClose);
+     printf("fUseProxy = %d\n", fUseProxy);
+     printf("addrProxy = %s\n", addrProxy.ToString().c_str());
+     if (fHaveUPnP)
+         printf("fUseUPnP = %d\n", fUseUPnP);
+     // Upgrade
+     if (nFileVersion < VERSION)
+     {
+         // Get rid of old debug.log file in current directory
+         if (nFileVersion <= 105 && !pszSetDataDir[0])
+             unlink("debug.log");
+         WriteVersion(VERSION);
+     }
+     return true;
+ }
+ bool LoadWallet(bool& fFirstRunRet)
+ {
+     fFirstRunRet = false;
+     if (!CWalletDB("cr+").LoadWallet())
+         return false;
+     fFirstRunRet = vchDefaultKey.empty();
+     if (mapKeys.count(vchDefaultKey))
+     {
+         // Set keyUser
+         keyUser.SetPubKey(vchDefaultKey);
+         keyUser.SetPrivKey(mapKeys[vchDefaultKey]);
+     }
+     else
+     {
+         // Create new keyUser and set as default key
+         RandAddSeedPerfmon();
+         keyUser.MakeNewKey();
+         if (!AddKey(keyUser))
+             return false;
+         if (!SetAddressBookName(PubKeyToAddress(keyUser.GetPubKey()), ""))
+             return false;
+         CWalletDB().WriteDefaultKey(keyUser.GetPubKey());
+     }
+     CreateThread(ThreadFlushWalletDB, NULL);
+     return true;
+ }
+ void ThreadFlushWalletDB(void* parg)
+ {
+     static bool fOneThread;
+     if (fOneThread)
+         return;
+     fOneThread = true;
+     if (mapArgs.count("-noflushwallet"))
+         return;
+     unsigned int nLastSeen = nWalletDBUpdated;
+     unsigned int nLastFlushed = nWalletDBUpdated;
+     int64 nLastWalletUpdate = GetTime();
+     while (!fShutdown)
+     {
+         Sleep(500);
+         if (nLastSeen != nWalletDBUpdated)
+         {
+             nLastSeen = nWalletDBUpdated;
+             nLastWalletUpdate = GetTime();
+         }
+         if (nLastFlushed != nWalletDBUpdated && GetTime() - nLastWalletUpdate >= 2)
+         {
+             TRY_CRITICAL_BLOCK(cs_db)
+             {
+                 // Don't do this if any databases are in use
+                 int nRefCount = 0;
+                 map<string, int>::iterator mi = mapFileUseCount.begin();
+                 while (mi != mapFileUseCount.end())
+                 {
+                     nRefCount += (*mi).second;
+                     mi++;
+                 }
+                 if (nRefCount == 0 && !fShutdown)
+                 {
+                     string strFile = "wallet.dat";
+                     map<string, int>::iterator mi = mapFileUseCount.find(strFile);
+                     if (mi != mapFileUseCount.end())
+                     {
+                         printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
+                         printf("Flushing wallet.dat\n");
+                         nLastFlushed = nWalletDBUpdated;
+                         int64 nStart = GetTimeMillis();
+                         // Flush wallet.dat so it's self contained
+                         CloseDb(strFile);
+                         dbenv.txn_checkpoint(0, 0, 0);
+                         dbenv.lsn_reset(strFile.c_str(), 0);
+                         mapFileUseCount.erase(mi++);
+                         printf("Flushed wallet.dat %"PRI64d"ms\n", GetTimeMillis() - nStart);
+                     }
+                 }
+             }
+         }
+     }
+ }
+ void BackupWallet(const string& strDest)
+ {
+     while (!fShutdown)
+     {
+         CRITICAL_BLOCK(cs_db)
+         {
+             const string strFile = "wallet.dat";
+             if (!mapFileUseCount.count(strFile) || mapFileUseCount[strFile] == 0)
+             {
+                 // Flush log data to the dat file
+                 CloseDb(strFile);
+                 dbenv.txn_checkpoint(0, 0, 0);
+                 dbenv.lsn_reset(strFile.c_str(), 0);
+                 mapFileUseCount.erase(strFile);
+                 // Copy wallet.dat
+                 filesystem::path pathSrc(GetDataDir() + "/" + strFile);
+                 filesystem::path pathDest(strDest);
+                 if (filesystem::is_directory(pathDest))
+                     pathDest = pathDest / strFile;
+ #if BOOST_VERSION >= 104000
+                 filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists);
+ #else
+                 filesystem::copy_file(pathSrc, pathDest);
+ #endif
+                 printf("copied wallet.dat to %s\n", pathDest.string().c_str());
+                 return;
+             }
+         }
+         Sleep(100);
+     }
+ }
+ void CWalletDB::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool)
+ {
+     nIndex = -1;
+     keypool.vchPubKey.clear();
+     CRITICAL_BLOCK(cs_main)
+     CRITICAL_BLOCK(cs_mapWallet)
+     CRITICAL_BLOCK(cs_setKeyPool)
+     {
+         // Top up key pool
+         int64 nTargetSize = max(GetArg("-keypool", 100), (int64)0);
+         while (setKeyPool.size() < nTargetSize+1)
+         {
+             int64 nEnd = 1;
+             if (!setKeyPool.empty())
+                 nEnd = *(--setKeyPool.end()) + 1;
+             if (!Write(make_pair(string("pool"), nEnd), CKeyPool(GenerateNewKey())))
+                 throw runtime_error("ReserveKeyFromKeyPool() : writing generated key failed");
+             setKeyPool.insert(nEnd);
+             printf("keypool added key %"PRI64d", size=%d\n", nEnd, setKeyPool.size());
+         }
+         // Get the oldest key
+         assert(!setKeyPool.empty());
+         nIndex = *(setKeyPool.begin());
+         setKeyPool.erase(setKeyPool.begin());
+         if (!Read(make_pair(string("pool"), nIndex), keypool))
+             throw runtime_error("ReserveKeyFromKeyPool() : read failed");
+         if (!mapKeys.count(keypool.vchPubKey))
+             throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool");
+         assert(!keypool.vchPubKey.empty());
+         printf("keypool reserve %"PRI64d"\n", nIndex);
+     }
+ }
+ void CWalletDB::KeepKey(int64 nIndex)
+ {
+     // Remove from key pool
+     CRITICAL_BLOCK(cs_main)
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         Erase(make_pair(string("pool"), nIndex));
+     }
+     printf("keypool keep %"PRI64d"\n", nIndex);
+ }
+ void CWalletDB::ReturnKey(int64 nIndex)
+ {
+     // Return to key pool
+     CRITICAL_BLOCK(cs_setKeyPool)
+         setKeyPool.insert(nIndex);
+     printf("keypool return %"PRI64d"\n", nIndex);
+ }
+ vector<unsigned char> GetKeyFromKeyPool()
+ {
+     CWalletDB walletdb;
+     int64 nIndex = 0;
+     CKeyPool keypool;
+     walletdb.ReserveKeyFromKeyPool(nIndex, keypool);
+     walletdb.KeepKey(nIndex);
+     return keypool.vchPubKey;
+ }
+ int64 GetOldestKeyPoolTime()
+ {
+     CWalletDB walletdb;
+     int64 nIndex = 0;
+     CKeyPool keypool;
+     walletdb.ReserveKeyFromKeyPool(nIndex, keypool);
+     walletdb.ReturnKey(nIndex);
+     return keypool.nTime;
+ }
diff --cc src/init.cpp
index 0000000000000000000000000000000000000000,8f721812257c10656e0c6db674d1bfdeebf21ad3..a8e93140b3b5a1591d7c3bf6fc7d36cd97f62da0
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,523 +1,523 @@@
 -    fclose(file);
+ // Copyright (c) 2009-2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ #include "headers.h"
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // Shutdown
+ //
+ void ExitTimeout(void* parg)
+ {
+ #ifdef __WXMSW__
+     Sleep(5000);
+     ExitProcess(0);
+ #endif
+ }
+ void Shutdown(void* parg)
+ {
+     static CCriticalSection cs_Shutdown;
+     static bool fTaken;
+     bool fFirstThread;
+     CRITICAL_BLOCK(cs_Shutdown)
+     {
+         fFirstThread = !fTaken;
+         fTaken = true;
+     }
+     static bool fExit;
+     if (fFirstThread)
+     {
+         fShutdown = true;
+         nTransactionsUpdated++;
+         DBFlush(false);
+         StopNode();
+         DBFlush(true);
+         boost::filesystem::remove(GetPidFile());
+         CreateThread(ExitTimeout, NULL);
+         Sleep(50);
+         printf("Bitcoin exiting\n\n");
+         fExit = true;
+         exit(0);
+     }
+     else
+     {
+         while (!fExit)
+             Sleep(500);
+         Sleep(100);
+         ExitThread(0);
+     }
+ }
+ void HandleSIGTERM(int)
+ {
+     fRequestShutdown = true;
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // Start
+ //
+ #ifndef GUI
+ int main(int argc, char* argv[])
+ {
+     bool fRet = false;
+     fRet = AppInit(argc, argv);
+     if (fRet && fDaemon)
+         return 0;
+     return 1;
+ }
+ #endif
+ bool AppInit(int argc, char* argv[])
+ {
+     bool fRet = false;
+     try
+     {
+         fRet = AppInit2(argc, argv);
+     }
+     catch (std::exception& e) {
+         PrintException(&e, "AppInit()");
+     } catch (...) {
+         PrintException(NULL, "AppInit()");
+     }
+     if (!fRet)
+         Shutdown(NULL);
+     return fRet;
+ }
+ bool AppInit2(int argc, char* argv[])
+ {
+ #ifdef _MSC_VER
+     // Turn off microsoft heap dump noise
+     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+     _CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
+ #endif
+ #if _MSC_VER >= 1400
+     // Disable confusing "helpful" text message on abort, ctrl-c
+     _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
+ #endif
+ #ifndef __WXMSW__
+     umask(077);
+ #endif
+ #ifndef __WXMSW__
+     // Clean shutdown on SIGTERM
+     struct sigaction sa;
+     sa.sa_handler = HandleSIGTERM;
+     sigemptyset(&sa.sa_mask);
+     sa.sa_flags = 0;
+     sigaction(SIGTERM, &sa, NULL);
+     sigaction(SIGINT, &sa, NULL);
+     sigaction(SIGHUP, &sa, NULL);
+ #endif
+     //
+     // Parameters
+     //
+     ParseParameters(argc, argv);
+     if (mapArgs.count("-datadir"))
+     {
+         filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
+         strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
+     }
+     ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir
+     if (mapArgs.count("-?") || mapArgs.count("--help"))
+     {
+         string beta = VERSION_IS_BETA ? _(" beta") : "";
+         string strUsage = string() +
+           _("Bitcoin version") + " " + FormatFullVersion() + "\n\n" +
+           _("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
+             "  bitcoin [options]                   \t  " + "\n" +
+             "  bitcoin [options] <command> [params]\t  " + _("Send command to -server or bitcoind\n") +
+             "  bitcoin [options] help              \t\t  " + _("List commands\n") +
+             "  bitcoin [options] help <command>    \t\t  " + _("Get help for a command\n") +
+           _("Options:\n") +
+             "  -conf=<file>     \t\t  " + _("Specify configuration file (default: bitcoin.conf)\n") +
+             "  -pid=<file>      \t\t  " + _("Specify pid file (default: bitcoind.pid)\n") +
+             "  -gen             \t\t  " + _("Generate coins\n") +
+             "  -gen=0           \t\t  " + _("Don't generate coins\n") +
+             "  -min             \t\t  " + _("Start minimized\n") +
+             "  -datadir=<dir>   \t\t  " + _("Specify data directory\n") +
+             "  -proxy=<ip:port> \t  "   + _("Connect through socks4 proxy\n") +
+             "  -addnode=<ip>    \t  "   + _("Add a node to connect to\n") +
+             "  -connect=<ip>    \t\t  " + _("Connect only to the specified node\n") +
+             "  -nolisten        \t  "   + _("Don't accept connections from outside\n") +
+ #ifdef USE_UPNP
+ #if USE_UPNP
+             "  -noupnp          \t  "   + _("Don't attempt to use UPnP to map the listening port\n") +
+ #else
+             "  -upnp            \t  "   + _("Attempt to use UPnP to map the listening port\n") +
+ #endif
+ #endif
+             "  -paytxfee=<amt>  \t  "   + _("Fee per KB to add to transactions you send\n") +
+ #ifdef GUI
+             "  -server          \t\t  " + _("Accept command line and JSON-RPC commands\n") +
+ #endif
+ #ifndef __WXMSW__
+             "  -daemon          \t\t  " + _("Run in the background as a daemon and accept commands\n") +
+ #endif
+             "  -testnet         \t\t  " + _("Use the test network\n") +
+             "  -rpcuser=<user>  \t  "   + _("Username for JSON-RPC connections\n") +
+             "  -rpcpassword=<pw>\t  "   + _("Password for JSON-RPC connections\n") +
+             "  -rpcport=<port>  \t\t  " + _("Listen for JSON-RPC connections on <port> (default: 8332)\n") +
+             "  -rpcallowip=<ip> \t\t  " + _("Allow JSON-RPC connections from specified IP address\n") +
+             "  -rpcconnect=<ip> \t  "   + _("Send commands to node running on <ip> (default: 127.0.0.1)\n") +
+             "  -keypool=<n>     \t  "   + _("Set key pool size to <n> (default: 100)\n") +
+             "  -rescan          \t  "   + _("Rescan the block chain for missing wallet transactions\n");
+ #ifdef USE_SSL
+         strUsage += string() +
+             _("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)\n") +
+             "  -rpcssl                                \t  " + _("Use OpenSSL (https) for JSON-RPC connections\n") +
+             "  -rpcsslcertificatechainfile=<file.cert>\t  " + _("Server certificate file (default: server.cert)\n") +
+             "  -rpcsslprivatekeyfile=<file.pem>       \t  " + _("Server private key (default: server.pem)\n") +
+             "  -rpcsslciphers=<ciphers>               \t  " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)\n");
+ #endif
+         strUsage += string() +
+             "  -?               \t\t  " + _("This help message\n");
+ #if defined(__WXMSW__) && defined(GUI)
+         // Tabs make the columns line up in the message box
+         wxMessageBox(strUsage, "Bitcoin", wxOK);
+ #else
+         // Remove tabs
+         strUsage.erase(std::remove(strUsage.begin(), strUsage.end(), '\t'), strUsage.end());
+         fprintf(stderr, "%s", strUsage.c_str());
+ #endif
+         return false;
+     }
+     fDebug = GetBoolArg("-debug");
+ #ifndef __WXMSW__
+     fDaemon = GetBoolArg("-daemon");
+ #else
+     fDaemon = false;
+ #endif
+     if (fDaemon)
+         fServer = true;
+     else
+         fServer = GetBoolArg("-server");
+     /* force fServer when running without GUI */
+ #ifndef GUI
+     fServer = true;
+ #endif
+     fPrintToConsole = GetBoolArg("-printtoconsole");
+     fPrintToDebugger = GetBoolArg("-printtodebugger");
+     fTestNet = GetBoolArg("-testnet");
+     fNoListen = GetBoolArg("-nolisten");
+     fLogTimestamps = GetBoolArg("-logtimestamps");
+     for (int i = 1; i < argc; i++)
+         if (!IsSwitchChar(argv[i][0]))
+             fCommandLine = true;
+     if (fCommandLine)
+     {
+         int ret = CommandLineRPC(argc, argv);
+         exit(ret);
+     }
+ #ifndef __WXMSW__
+     if (fDaemon)
+     {
+         // Daemonize
+         pid_t pid = fork();
+         if (pid < 0)
+         {
+             fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
+             return false;
+         }
+         if (pid > 0)
+         {
+             CreatePidFile(GetPidFile(), pid);
+             return true;
+         }
+         pid_t sid = setsid();
+         if (sid < 0)
+             fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
+     }
+ #endif
+     if (!fDebug && !pszSetDataDir[0])
+         ShrinkDebugFile();
+     printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
+     printf("Bitcoin version %s\n", FormatFullVersion().c_str());
+ #ifdef GUI
+     printf("OS version %s\n", ((string)wxGetOsDescription()).c_str());
+     printf("System default language is %d %s\n", g_locale.GetSystemLanguage(), ((string)g_locale.GetSysName()).c_str());
+     printf("Language file %s (%s)\n", (string("locale/") + (string)g_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)g_locale.GetLocale()).c_str());
+ #endif
+     printf("Default data directory %s\n", GetDefaultDataDir().c_str());
+     if (GetBoolArg("-loadblockindextest"))
+     {
+         CTxDB txdb("r");
+         txdb.LoadBlockIndex();
+         PrintBlockTree();
+         return false;
+     }
+     //
+     // Limit to single instance per user
+     // Required to protect the database files if we're going to keep deleting log.*
+     //
+ #if defined(__WXMSW__) && defined(GUI)
+     // wxSingleInstanceChecker doesn't work on Linux
+     wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
+     for (int i = 0; i < strMutexName.size(); i++)
+         if (!isalnum(strMutexName[i]))
+             strMutexName[i] = '.';
+     wxSingleInstanceChecker* psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
+     if (psingleinstancechecker->IsAnotherRunning())
+     {
+         printf("Existing instance found\n");
+         unsigned int nStart = GetTime();
+         loop
+         {
+             // Show the previous instance and exit
+             HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
+             if (hwndPrev)
+             {
+                 if (IsIconic(hwndPrev))
+                     ShowWindow(hwndPrev, SW_RESTORE);
+                 SetForegroundWindow(hwndPrev);
+                 return false;
+             }
+             if (GetTime() > nStart + 60)
+                 return false;
+             // Resume this instance if the other exits
+             delete psingleinstancechecker;
+             Sleep(1000);
+             psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
+             if (!psingleinstancechecker->IsAnotherRunning())
+                 break;
+         }
+     }
+ #endif
+     // Make sure only a single bitcoin process is using the data directory.
+     string strLockFile = GetDataDir() + "/.lock";
+     FILE* file = fopen(strLockFile.c_str(), "a"); // empty lock file; created if it doesn't exist.
++    if (file) fclose(file);
+     static boost::interprocess::file_lock lock(strLockFile.c_str());
+     if (!lock.try_lock())
+     {
+         wxMessageBox(strprintf(_("Cannot obtain a lock on data directory %s.  Bitcoin is probably already running."), GetDataDir().c_str()), "Bitcoin");
+         return false;
+     }
+     // Bind to the port early so we can tell if another instance is already running.
+     string strErrors;
+     if (!fNoListen)
+     {
+         if (!BindListenPort(strErrors))
+         {
+             wxMessageBox(strErrors, "Bitcoin");
+             return false;
+         }
+     }
+     //
+     // Load data files
+     //
+     if (fDaemon)
+         fprintf(stdout, "bitcoin server starting\n");
+     strErrors = "";
+     int64 nStart;
+     printf("Loading addresses...\n");
+     nStart = GetTimeMillis();
+     if (!LoadAddresses())
+         strErrors += _("Error loading addr.dat      \n");
+     printf(" addresses   %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+     printf("Loading block index...\n");
+     nStart = GetTimeMillis();
+     if (!LoadBlockIndex())
+         strErrors += _("Error loading blkindex.dat      \n");
+     printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+     printf("Loading wallet...\n");
+     nStart = GetTimeMillis();
+     bool fFirstRun;
+     if (!LoadWallet(fFirstRun))
+         strErrors += _("Error loading wallet.dat      \n");
+     printf(" wallet      %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+     CBlockIndex *pindexRescan = pindexBest;
+     if (GetBoolArg("-rescan"))
+         pindexRescan = pindexGenesisBlock;
+     else
+     {
+         CWalletDB walletdb;
+         CBlockLocator locator;
+         if (walletdb.ReadBestBlock(locator))
+             pindexRescan = locator.GetBlockIndex();
+     }
+     if (pindexBest != pindexRescan)
+     {
+         printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
+         nStart = GetTimeMillis();
+         ScanForWalletTransactions(pindexRescan);
+         printf(" rescan      %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+     }
+     printf("Done loading\n");
+         //// debug print
+         printf("mapBlockIndex.size() = %d\n",   mapBlockIndex.size());
+         printf("nBestHeight = %d\n",            nBestHeight);
+         printf("mapKeys.size() = %d\n",         mapKeys.size());
+         printf("mapPubKeys.size() = %d\n",      mapPubKeys.size());
+         printf("mapWallet.size() = %d\n",       mapWallet.size());
+         printf("mapAddressBook.size() = %d\n",  mapAddressBook.size());
+     if (!strErrors.empty())
+     {
+         wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR);
+         return false;
+     }
+     // Add wallet transactions that aren't already in a block to mapTransactions
+     ReacceptWalletTransactions();
+     //
+     // Parameters
+     //
+     if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
+     {
+         PrintBlockTree();
+         return false;
+     }
+     if (mapArgs.count("-printblock"))
+     {
+         string strMatch = mapArgs["-printblock"];
+         int nFound = 0;
+         for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
+         {
+             uint256 hash = (*mi).first;
+             if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
+             {
+                 CBlockIndex* pindex = (*mi).second;
+                 CBlock block;
+                 block.ReadFromDisk(pindex);
+                 block.BuildMerkleTree();
+                 block.print();
+                 printf("\n");
+                 nFound++;
+             }
+         }
+         if (nFound == 0)
+             printf("No blocks matching %s were found\n", strMatch.c_str());
+         return false;
+     }
+     fGenerateBitcoins = GetBoolArg("-gen");
+     if (mapArgs.count("-proxy"))
+     {
+         fUseProxy = true;
+         addrProxy = CAddress(mapArgs["-proxy"]);
+         if (!addrProxy.IsValid())
+         {
+             wxMessageBox(_("Invalid -proxy address"), "Bitcoin");
+             return false;
+         }
+     }
+     if (mapArgs.count("-addnode"))
+     {
+         foreach(string strAddr, mapMultiArgs["-addnode"])
+         {
+             CAddress addr(strAddr, NODE_NETWORK);
+             addr.nTime = 0; // so it won't relay unless successfully connected
+             if (addr.IsValid())
+                 AddAddress(addr);
+         }
+     }
+     if (mapArgs.count("-dnsseed"))
+         DNSAddressSeed();
+     if (mapArgs.count("-paytxfee"))
+     {
+         if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee))
+         {
+             wxMessageBox(_("Invalid amount for -paytxfee=<amount>"), "Bitcoin");
+             return false;
+         }
+         if (nTransactionFee > 0.25 * COIN)
+             wxMessageBox(_("Warning: -paytxfee is set very high.  This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION);
+     }
+     if (fHaveUPnP)
+     {
+ #if USE_UPNP
+     if (GetBoolArg("-noupnp"))
+         fUseUPnP = false;
+ #else
+     if (GetBoolArg("-upnp"))
+         fUseUPnP = true;
+ #endif
+     }
+     //
+     // Create the main window and start the node
+     //
+ #ifdef GUI
+     if (!fDaemon)
+         CreateMainWindow();
+ #endif
+     if (!CheckDiskSpace())
+         return false;
+     RandAddSeedPerfmon();
+     if (!CreateThread(StartNode, NULL))
+         wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
+     if (fServer)
+         CreateThread(ThreadRPCServer, NULL);
+ #if defined(__WXMSW__) && defined(GUI)
+     if (fFirstRun)
+         SetStartOnSystemStartup(true);
+ #endif
+ #ifndef GUI
+     while (1)
+         Sleep(5000);
+ #endif
+     return true;
+ }
diff --cc src/main.cpp
index 0000000000000000000000000000000000000000,4c8f20c1e4bfd3af8383de926210da05536a763a..2cdde5b42b795d833518ed8ee3d0dacab8261cd8
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,4104 +1,4028 @@@
 -    // Rather not work on nonstandard transactions
 -    if (!IsStandard())
+ // Copyright (c) 2009-2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ #include "headers.h"
+ #include "cryptopp/sha.h"
+ //
+ // Global state
+ //
+ CCriticalSection cs_main;
+ map<uint256, CTransaction> mapTransactions;
+ CCriticalSection cs_mapTransactions;
+ unsigned int nTransactionsUpdated = 0;
+ map<COutPoint, CInPoint> mapNextTx;
+ map<uint256, CBlockIndex*> mapBlockIndex;
+ uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
+ CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
+ CBlockIndex* pindexGenesisBlock = NULL;
+ int nBestHeight = -1;
+ CBigNum bnBestChainWork = 0;
+ CBigNum bnBestInvalidWork = 0;
+ uint256 hashBestChain = 0;
+ CBlockIndex* pindexBest = NULL;
+ int64 nTimeBestReceived = 0;
+ map<uint256, CBlock*> mapOrphanBlocks;
+ multimap<uint256, CBlock*> mapOrphanBlocksByPrev;
+ map<uint256, CDataStream*> mapOrphanTransactions;
+ multimap<uint256, CDataStream*> mapOrphanTransactionsByPrev;
+ map<uint256, CWalletTx> mapWallet;
+ vector<uint256> vWalletUpdated;
+ CCriticalSection cs_mapWallet;
+ map<vector<unsigned char>, CPrivKey> mapKeys;
+ map<uint160, vector<unsigned char> > mapPubKeys;
+ CCriticalSection cs_mapKeys;
+ CKey keyUser;
+ map<uint256, int> mapRequestCount;
+ CCriticalSection cs_mapRequestCount;
+ map<string, string> mapAddressBook;
+ CCriticalSection cs_mapAddressBook;
+ vector<unsigned char> vchDefaultKey;
+ double dHashesPerSec;
+ int64 nHPSTimerStart;
+ // Settings
+ int fGenerateBitcoins = false;
+ int64 nTransactionFee = 0;
+ CAddress addrIncoming;
+ int fLimitProcessors = false;
+ int nLimitProcessors = 1;
+ int fMinimizeToTray = true;
+ int fMinimizeOnClose = true;
+ #ifdef USE_UPNP
+ #if USE_UPNP
+ int fUseUPnP = true;
+ #else
+ int fUseUPnP = false;
+ #endif
+ #endif
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // mapKeys
+ //
+ bool AddKey(const CKey& key)
+ {
+     CRITICAL_BLOCK(cs_mapKeys)
+     {
+         mapKeys[key.GetPubKey()] = key.GetPrivKey();
+         mapPubKeys[Hash160(key.GetPubKey())] = key.GetPubKey();
+     }
+     return CWalletDB().WriteKey(key.GetPubKey(), key.GetPrivKey());
+ }
+ vector<unsigned char> GenerateNewKey()
+ {
+     RandAddSeedPerfmon();
+     CKey key;
+     key.MakeNewKey();
+     if (!AddKey(key))
+         throw runtime_error("GenerateNewKey() : AddKey failed");
+     return key.GetPubKey();
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // mapWallet
+ //
+ bool AddToWallet(const CWalletTx& wtxIn)
+ {
+     uint256 hash = wtxIn.GetHash();
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         // Inserts only if not already there, returns tx inserted or tx found
+         pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn));
+         CWalletTx& wtx = (*ret.first).second;
+         bool fInsertedNew = ret.second;
+         if (fInsertedNew)
+             wtx.nTimeReceived = GetAdjustedTime();
+         bool fUpdated = false;
+         if (!fInsertedNew)
+         {
+             // Merge
+             if (wtxIn.hashBlock != 0 && wtxIn.hashBlock != wtx.hashBlock)
+             {
+                 wtx.hashBlock = wtxIn.hashBlock;
+                 fUpdated = true;
+             }
+             if (wtxIn.nIndex != -1 && (wtxIn.vMerkleBranch != wtx.vMerkleBranch || wtxIn.nIndex != wtx.nIndex))
+             {
+                 wtx.vMerkleBranch = wtxIn.vMerkleBranch;
+                 wtx.nIndex = wtxIn.nIndex;
+                 fUpdated = true;
+             }
+             if (wtxIn.fFromMe && wtxIn.fFromMe != wtx.fFromMe)
+             {
+                 wtx.fFromMe = wtxIn.fFromMe;
+                 fUpdated = true;
+             }
+             fUpdated |= wtx.UpdateSpent(wtxIn.vfSpent);
+         }
+         //// debug print
+         printf("AddToWallet %s  %s%s\n", wtxIn.GetHash().ToString().substr(0,10).c_str(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : ""));
+         // Write to disk
+         if (fInsertedNew || fUpdated)
+             if (!wtx.WriteToDisk())
+                 return false;
+         // If default receiving address gets used, replace it with a new one
+         CScript scriptDefaultKey;
+         scriptDefaultKey.SetBitcoinAddress(vchDefaultKey);
+         foreach(const CTxOut& txout, wtx.vout)
+         {
+             if (txout.scriptPubKey == scriptDefaultKey)
+             {
+                 CWalletDB walletdb;
+                 vchDefaultKey = GetKeyFromKeyPool();
+                 walletdb.WriteDefaultKey(vchDefaultKey);
+                 walletdb.WriteName(PubKeyToAddress(vchDefaultKey), "");
+             }
+         }
+         // Notify UI
+         vWalletUpdated.push_back(hash);
+     }
+     // Refresh UI
+     MainFrameRepaint();
+     return true;
+ }
+ bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate = false)
+ {
+     uint256 hash = tx.GetHash();
+     bool fExisted = mapWallet.count(hash);
+     if (fExisted && !fUpdate) return false;
+     if (fExisted || tx.IsMine() || tx.IsFromMe())
+     {
+         CWalletTx wtx(tx);
+         // Get merkle branch if transaction was found in a block
+         if (pblock)
+             wtx.SetMerkleBranch(pblock);
+         return AddToWallet(wtx);
+     }
+     return false;
+ }
+ bool EraseFromWallet(uint256 hash)
+ {
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         if (mapWallet.erase(hash))
+             CWalletDB().EraseTx(hash);
+     }
+     return true;
+ }
+ void WalletUpdateSpent(const COutPoint& prevout)
+ {
+     // Anytime a signature is successfully verified, it's proof the outpoint is spent.
+     // Update the wallet spent flag if it doesn't know due to wallet.dat being
+     // restored from backup or the user making copies of wallet.dat.
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         map<uint256, CWalletTx>::iterator mi = mapWallet.find(prevout.hash);
+         if (mi != mapWallet.end())
+         {
+             CWalletTx& wtx = (*mi).second;
+             if (!wtx.IsSpent(prevout.n) && wtx.vout[prevout.n].IsMine())
+             {
+                 printf("WalletUpdateSpent found spent coin %sbc %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str());
+                 wtx.MarkSpent(prevout.n);
+                 wtx.WriteToDisk();
+                 vWalletUpdated.push_back(prevout.hash);
+             }
+         }
+     }
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // mapOrphanTransactions
+ //
+ void AddOrphanTx(const CDataStream& vMsg)
+ {
+     CTransaction tx;
+     CDataStream(vMsg) >> tx;
+     uint256 hash = tx.GetHash();
+     if (mapOrphanTransactions.count(hash))
+         return;
+     CDataStream* pvMsg = mapOrphanTransactions[hash] = new CDataStream(vMsg);
+     foreach(const CTxIn& txin, tx.vin)
+         mapOrphanTransactionsByPrev.insert(make_pair(txin.prevout.hash, pvMsg));
+ }
+ void EraseOrphanTx(uint256 hash)
+ {
+     if (!mapOrphanTransactions.count(hash))
+         return;
+     const CDataStream* pvMsg = mapOrphanTransactions[hash];
+     CTransaction tx;
+     CDataStream(*pvMsg) >> tx;
+     foreach(const CTxIn& txin, tx.vin)
+     {
+         for (multimap<uint256, CDataStream*>::iterator mi = mapOrphanTransactionsByPrev.lower_bound(txin.prevout.hash);
+              mi != mapOrphanTransactionsByPrev.upper_bound(txin.prevout.hash);)
+         {
+             if ((*mi).second == pvMsg)
+                 mapOrphanTransactionsByPrev.erase(mi++);
+             else
+                 mi++;
+         }
+     }
+     delete pvMsg;
+     mapOrphanTransactions.erase(hash);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CTransaction and CTxIndex
+ //
+ bool CTransaction::ReadFromDisk(CTxDB& txdb, COutPoint prevout, CTxIndex& txindexRet)
+ {
+     SetNull();
+     if (!txdb.ReadTxIndex(prevout.hash, txindexRet))
+         return false;
+     if (!ReadFromDisk(txindexRet.pos))
+         return false;
+     if (prevout.n >= vout.size())
+     {
+         SetNull();
+         return false;
+     }
+     return true;
+ }
+ bool CTransaction::ReadFromDisk(CTxDB& txdb, COutPoint prevout)
+ {
+     CTxIndex txindex;
+     return ReadFromDisk(txdb, prevout, txindex);
+ }
+ bool CTransaction::ReadFromDisk(COutPoint prevout)
+ {
+     CTxDB txdb("r");
+     CTxIndex txindex;
+     return ReadFromDisk(txdb, prevout, txindex);
+ }
+ bool CTxIn::IsMine() const
+ {
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         map<uint256, CWalletTx>::iterator mi = mapWallet.find(prevout.hash);
+         if (mi != mapWallet.end())
+         {
+             const CWalletTx& prev = (*mi).second;
+             if (prevout.n < prev.vout.size())
+                 if (prev.vout[prevout.n].IsMine())
+                     return true;
+         }
+     }
+     return false;
+ }
+ int64 CTxIn::GetDebit() const
+ {
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         map<uint256, CWalletTx>::iterator mi = mapWallet.find(prevout.hash);
+         if (mi != mapWallet.end())
+         {
+             const CWalletTx& prev = (*mi).second;
+             if (prevout.n < prev.vout.size())
+                 if (prev.vout[prevout.n].IsMine())
+                     return prev.vout[prevout.n].nValue;
+         }
+     }
+     return 0;
+ }
+ int64 CWalletTx::GetTxTime() const
+ {
+     if (!fTimeReceivedIsTxTime && hashBlock != 0)
+     {
+         // If we did not receive the transaction directly, we rely on the block's
+         // time to figure out when it happened.  We use the median over a range
+         // of blocks to try to filter out inaccurate block times.
+         map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
+         if (mi != mapBlockIndex.end())
+         {
+             CBlockIndex* pindex = (*mi).second;
+             if (pindex)
+                 return pindex->GetMedianTime();
+         }
+     }
+     return nTimeReceived;
+ }
+ int CWalletTx::GetRequestCount() const
+ {
+     // Returns -1 if it wasn't being tracked
+     int nRequests = -1;
+     CRITICAL_BLOCK(cs_mapRequestCount)
+     {
+         if (IsCoinBase())
+         {
+             // Generated block
+             if (hashBlock != 0)
+             {
+                 map<uint256, int>::iterator mi = mapRequestCount.find(hashBlock);
+                 if (mi != mapRequestCount.end())
+                     nRequests = (*mi).second;
+             }
+         }
+         else
+         {
+             // Did anyone request this transaction?
+             map<uint256, int>::iterator mi = mapRequestCount.find(GetHash());
+             if (mi != mapRequestCount.end())
+             {
+                 nRequests = (*mi).second;
+                 // How about the block it's in?
+                 if (nRequests == 0 && hashBlock != 0)
+                 {
+                     map<uint256, int>::iterator mi = mapRequestCount.find(hashBlock);
+                     if (mi != mapRequestCount.end())
+                         nRequests = (*mi).second;
+                     else
+                         nRequests = 1; // If it's in someone else's block it must have got out
+                 }
+             }
+         }
+     }
+     return nRequests;
+ }
+ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, list<pair<string, int64> >& listReceived,
+                            list<pair<string, int64> >& listSent, int64& nFee, string& strSentAccount) const
+ {
+     nGeneratedImmature = nGeneratedMature = nFee = 0;
+     listReceived.clear();
+     listSent.clear();
+     strSentAccount = strFromAccount;
+     if (IsCoinBase())
+     {
+         if (GetBlocksToMaturity() > 0)
+             nGeneratedImmature = CTransaction::GetCredit();
+         else
+             nGeneratedMature = GetCredit();
+         return;
+     }
+     // Compute fee:
+     int64 nDebit = GetDebit();
+     if (nDebit > 0) // debit>0 means we signed/sent this transaction
+     {
+         int64 nValueOut = GetValueOut();
+         nFee = nDebit - nValueOut;
+     }
+     // Sent/received.  Standard client will never generate a send-to-multiple-recipients,
+     // but non-standard clients might (so return a list of address/amount pairs)
+     foreach(const CTxOut& txout, vout)
+     {
+         string address;
+         uint160 hash160;
+         vector<unsigned char> vchPubKey;
+         if (ExtractHash160(txout.scriptPubKey, hash160))
+             address = Hash160ToAddress(hash160);
+         else if (ExtractPubKey(txout.scriptPubKey, false, vchPubKey))
+             address = PubKeyToAddress(vchPubKey);
+         else
+         {
+             printf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n",
+                    this->GetHash().ToString().c_str());
+             address = " unknown ";
+         }
+         // Don't report 'change' txouts
+         if (nDebit > 0 && txout.IsChange())
+             continue;
+         if (nDebit > 0)
+             listSent.push_back(make_pair(address, txout.nValue));
+         if (txout.IsMine())
+             listReceived.push_back(make_pair(address, txout.nValue));
+     }
+ }
+ void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived, 
+                                   int64& nSent, int64& nFee) const
+ {
+     nGenerated = nReceived = nSent = nFee = 0;
+     int64 allGeneratedImmature, allGeneratedMature, allFee;
+     allGeneratedImmature = allGeneratedMature = allFee = 0;
+     string strSentAccount;
+     list<pair<string, int64> > listReceived;
+     list<pair<string, int64> > listSent;
+     GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount);
+     if (strAccount == "")
+         nGenerated = allGeneratedMature;
+     if (strAccount == strSentAccount)
+     {
+         foreach(const PAIRTYPE(string,int64)& s, listSent)
+             nSent += s.second;
+         nFee = allFee;
+     }
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         foreach(const PAIRTYPE(string,int64)& r, listReceived)
+         {
+             if (mapAddressBook.count(r.first))
+             {
+                 if (mapAddressBook[r.first] == strAccount)
+                 {
+                     nReceived += r.second;
+                 }
+             }
+             else if (strAccount.empty())
+             {
+                 nReceived += r.second;
+             }
+         }
+     }
+ }
+ int CMerkleTx::SetMerkleBranch(const CBlock* pblock)
+ {
+     if (fClient)
+     {
+         if (hashBlock == 0)
+             return 0;
+     }
+     else
+     {
+         CBlock blockTmp;
+         if (pblock == NULL)
+         {
+             // Load the block this tx is in
+             CTxIndex txindex;
+             if (!CTxDB("r").ReadTxIndex(GetHash(), txindex))
+                 return 0;
+             if (!blockTmp.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos))
+                 return 0;
+             pblock = &blockTmp;
+         }
+         // Update the tx's hashBlock
+         hashBlock = pblock->GetHash();
+         // Locate the transaction
+         for (nIndex = 0; nIndex < pblock->vtx.size(); nIndex++)
+             if (pblock->vtx[nIndex] == *(CTransaction*)this)
+                 break;
+         if (nIndex == pblock->vtx.size())
+         {
+             vMerkleBranch.clear();
+             nIndex = -1;
+             printf("ERROR: SetMerkleBranch() : couldn't find tx in block\n");
+             return 0;
+         }
+         // Fill in merkle branch
+         vMerkleBranch = pblock->GetMerkleBranch(nIndex);
+     }
+     // Is the tx in a block that's in the main chain
+     map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
+     if (mi == mapBlockIndex.end())
+         return 0;
+     CBlockIndex* pindex = (*mi).second;
+     if (!pindex || !pindex->IsInMainChain())
+         return 0;
+     return pindexBest->nHeight - pindex->nHeight + 1;
+ }
+ void CWalletTx::AddSupportingTransactions(CTxDB& txdb)
+ {
+     vtxPrev.clear();
+     const int COPY_DEPTH = 3;
+     if (SetMerkleBranch() < COPY_DEPTH)
+     {
+         vector<uint256> vWorkQueue;
+         foreach(const CTxIn& txin, vin)
+             vWorkQueue.push_back(txin.prevout.hash);
+         // This critsect is OK because txdb is already open
+         CRITICAL_BLOCK(cs_mapWallet)
+         {
+             map<uint256, const CMerkleTx*> mapWalletPrev;
+             set<uint256> setAlreadyDone;
+             for (int i = 0; i < vWorkQueue.size(); i++)
+             {
+                 uint256 hash = vWorkQueue[i];
+                 if (setAlreadyDone.count(hash))
+                     continue;
+                 setAlreadyDone.insert(hash);
+                 CMerkleTx tx;
+                 if (mapWallet.count(hash))
+                 {
+                     tx = mapWallet[hash];
+                     foreach(const CMerkleTx& txWalletPrev, mapWallet[hash].vtxPrev)
+                         mapWalletPrev[txWalletPrev.GetHash()] = &txWalletPrev;
+                 }
+                 else if (mapWalletPrev.count(hash))
+                 {
+                     tx = *mapWalletPrev[hash];
+                 }
+                 else if (!fClient && txdb.ReadDiskTx(hash, tx))
+                 {
+                     ;
+                 }
+                 else
+                 {
+                     printf("ERROR: AddSupportingTransactions() : unsupported transaction\n");
+                     continue;
+                 }
+                 int nDepth = tx.SetMerkleBranch();
+                 vtxPrev.push_back(tx);
+                 if (nDepth < COPY_DEPTH)
+                     foreach(const CTxIn& txin, tx.vin)
+                         vWorkQueue.push_back(txin.prevout.hash);
+             }
+         }
+     }
+     reverse(vtxPrev.begin(), vtxPrev.end());
+ }
+ bool CTransaction::CheckTransaction() const
+ {
+     // Basic checks that don't depend on any context
+     if (vin.empty() || vout.empty())
+         return error("CTransaction::CheckTransaction() : vin or vout empty");
+     // Size limits
+     if (::GetSerializeSize(*this, SER_NETWORK) > MAX_BLOCK_SIZE)
+         return error("CTransaction::CheckTransaction() : size limits failed");
+     // Check for negative or overflow output values
+     int64 nValueOut = 0;
+     foreach(const CTxOut& txout, vout)
+     {
+         if (txout.nValue < 0)
+             return error("CTransaction::CheckTransaction() : txout.nValue negative");
+         if (txout.nValue > MAX_MONEY)
+             return error("CTransaction::CheckTransaction() : txout.nValue too high");
+         nValueOut += txout.nValue;
+         if (!MoneyRange(nValueOut))
+             return error("CTransaction::CheckTransaction() : txout total out of range");
+     }
+     if (IsCoinBase())
+     {
+         if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)
+             return error("CTransaction::CheckTransaction() : coinbase script size");
+     }
+     else
+     {
+         foreach(const CTxIn& txin, vin)
+             if (txin.prevout.IsNull())
+                 return error("CTransaction::CheckTransaction() : prevout is null");
+     }
+     return true;
+ }
+ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMissingInputs)
+ {
+     if (pfMissingInputs)
+         *pfMissingInputs = false;
+     if (!CheckTransaction())
+         return error("AcceptToMemoryPool() : CheckTransaction failed");
+     // Coinbase is only valid in a block, not as a loose transaction
+     if (IsCoinBase())
+         return error("AcceptToMemoryPool() : coinbase as individual tx");
+     // To help v0.1.5 clients who would see it as a negative number
+     if ((int64)nLockTime > INT_MAX)
+         return error("AcceptToMemoryPool() : not accepting nLockTime beyond 2038 yet");
+     // Safety limits
+     unsigned int nSize = ::GetSerializeSize(*this, SER_NETWORK);
+     // Checking ECDSA signatures is a CPU bottleneck, so to avoid denial-of-service
+     // attacks disallow transactions with more than one SigOp per 34 bytes.
+     // 34 bytes because a TxOut is:
+     //   20-byte address + 8 byte bitcoin amount + 5 bytes of ops + 1 byte script length
+     if (GetSigOpCount() > nSize / 34 || nSize < 100)
+         return error("AcceptToMemoryPool() : nonstandard transaction");
 -#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE)
 -void CallCPUID(int in, int& aret, int& cret)
 -{
 -    int a, c;
 -    asm (
 -        "mov %2, %%eax; " // in into eax
 -        "cpuid;"
 -        "mov %%eax, %0;" // eax into a
 -        "mov %%ecx, %1;" // ecx into c
 -        :"=r"(a),"=r"(c) /* output */
 -        :"r"(in) /* input */
 -        :"%eax","%ebx","%ecx","%edx" /* clobbered register */
 -    );
 -    aret = a;
 -    cret = c;
 -}
 -
 -bool Detect128BitSSE2()
 -{
 -    int a, c, nBrand;
 -    CallCPUID(0, a, nBrand);
 -    bool fIntel = (nBrand == 0x6c65746e); // ntel
 -    bool fAMD = (nBrand == 0x444d4163); // cAMD
 -
 -    struct
 -    {
 -        unsigned int nStepping : 4;
 -        unsigned int nModel : 4;
 -        unsigned int nFamily : 4;
 -        unsigned int nProcessorType : 2;
 -        unsigned int nUnused : 2;
 -        unsigned int nExtendedModel : 4;
 -        unsigned int nExtendedFamily : 8;
 -    }
 -    cpu;
 -    CallCPUID(1, a, c);
 -    memcpy(&cpu, &a, sizeof(cpu));
 -    int nFamily = cpu.nExtendedFamily + cpu.nFamily;
 -    int nModel = cpu.nExtendedModel*16 + cpu.nModel;
 -
 -    // We need Intel Nehalem or AMD K10 or better for 128bit SSE2
 -    // Nehalem = i3/i5/i7 and some Xeon
 -    // K10 = Opterons with 4 or more cores, Phenom, Phenom II, Athlon II
 -    //  Intel Core i5  family 6, model 26 or 30
 -    //  Intel Core i7  family 6, model 26 or 30
 -    //  Intel Core i3  family 6, model 37
 -    //  AMD Phenom    family 16, model 10
 -    bool fUseSSE2 = ((fIntel && nFamily * 10000 + nModel >=  60026) ||
 -                     (fAMD   && nFamily * 10000 + nModel >= 160010));
 -
 -    // AMD reports a lower model number in 64-bit mode
 -    if (fAMD && sizeof(void*) > 4 && nFamily * 10000 + nModel >= 160000)
 -        fUseSSE2 = true;
 -
 -    static bool fPrinted;
 -    if (!fPrinted)
 -    {
 -        fPrinted = true;
 -        printf("CPUID %08x family %d, model %d, stepping %d, fUseSSE2=%d\n", nBrand, nFamily, nModel, cpu.nStepping, fUseSSE2);
 -    }
 -    return fUseSSE2;
 -}
 -#else
 -bool Detect128BitSSE2() { return false; }
 -#endif
++    // Rather not work on nonstandard transactions (unless -testnet)
++    if (!fTestNet && !IsStandard())
+         return error("AcceptToMemoryPool() : nonstandard transaction type");
+     // Do we already have it?
+     uint256 hash = GetHash();
+     CRITICAL_BLOCK(cs_mapTransactions)
+         if (mapTransactions.count(hash))
+             return false;
+     if (fCheckInputs)
+         if (txdb.ContainsTx(hash))
+             return false;
+     // Check for conflicts with in-memory transactions
+     CTransaction* ptxOld = NULL;
+     for (int i = 0; i < vin.size(); i++)
+     {
+         COutPoint outpoint = vin[i].prevout;
+         if (mapNextTx.count(outpoint))
+         {
+             // Disable replacement feature for now
+             return false;
+             // Allow replacing with a newer version of the same transaction
+             if (i != 0)
+                 return false;
+             ptxOld = mapNextTx[outpoint].ptx;
+             if (ptxOld->IsFinal())
+                 return false;
+             if (!IsNewerThan(*ptxOld))
+                 return false;
+             for (int i = 0; i < vin.size(); i++)
+             {
+                 COutPoint outpoint = vin[i].prevout;
+                 if (!mapNextTx.count(outpoint) || mapNextTx[outpoint].ptx != ptxOld)
+                     return false;
+             }
+             break;
+         }
+     }
+     if (fCheckInputs)
+     {
+         // Check against previous transactions
+         map<uint256, CTxIndex> mapUnused;
+         int64 nFees = 0;
+         if (!ConnectInputs(txdb, mapUnused, CDiskTxPos(1,1,1), pindexBest, nFees, false, false))
+         {
+             if (pfMissingInputs)
+                 *pfMissingInputs = true;
+             return error("AcceptToMemoryPool() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str());
+         }
+         // Don't accept it if it can't get into a block
+         if (nFees < GetMinFee(1000))
+             return error("AcceptToMemoryPool() : not enough fees");
+         // Continuously rate-limit free transactions
+         // This mitigates 'penny-flooding' -- sending thousands of free transactions just to
+         // be annoying or make other's transactions take longer to confirm.
+         if (nFees < CENT)
+         {
+             static CCriticalSection cs;
+             static double dFreeCount;
+             static int64 nLastTime;
+             int64 nNow = GetTime();
+             CRITICAL_BLOCK(cs)
+             {
+                 // Use an exponentially decaying ~10-minute window:
+                 dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime));
+                 nLastTime = nNow;
+                 // -limitfreerelay unit is thousand-bytes-per-minute
+                 // At default rate it would take over a month to fill 1GB
+                 if (dFreeCount > GetArg("-limitfreerelay", 15)*10*1000 && !IsFromMe())
+                     return error("AcceptToMemoryPool() : free transaction rejected by rate limiter");
+                 if (fDebug)
+                     printf("Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
+                 dFreeCount += nSize;
+             }
+         }
+     }
+     // Store transaction in memory
+     CRITICAL_BLOCK(cs_mapTransactions)
+     {
+         if (ptxOld)
+         {
+             printf("AcceptToMemoryPool() : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str());
+             ptxOld->RemoveFromMemoryPool();
+         }
+         AddToMemoryPoolUnchecked();
+     }
+     ///// are we sure this is ok when loading transactions or restoring block txes
+     // If updated, erase old tx from wallet
+     if (ptxOld)
+         EraseFromWallet(ptxOld->GetHash());
+     printf("AcceptToMemoryPool(): accepted %s\n", hash.ToString().substr(0,10).c_str());
+     return true;
+ }
+ bool CTransaction::AddToMemoryPoolUnchecked()
+ {
+     // Add to memory pool without checking anything.  Don't call this directly,
+     // call AcceptToMemoryPool to properly check the transaction first.
+     CRITICAL_BLOCK(cs_mapTransactions)
+     {
+         uint256 hash = GetHash();
+         mapTransactions[hash] = *this;
+         for (int i = 0; i < vin.size(); i++)
+             mapNextTx[vin[i].prevout] = CInPoint(&mapTransactions[hash], i);
+         nTransactionsUpdated++;
+     }
+     return true;
+ }
+ bool CTransaction::RemoveFromMemoryPool()
+ {
+     // Remove transaction from memory pool
+     CRITICAL_BLOCK(cs_mapTransactions)
+     {
+         foreach(const CTxIn& txin, vin)
+             mapNextTx.erase(txin.prevout);
+         mapTransactions.erase(GetHash());
+         nTransactionsUpdated++;
+     }
+     return true;
+ }
+ int CMerkleTx::GetDepthInMainChain(int& nHeightRet) const
+ {
+     if (hashBlock == 0 || nIndex == -1)
+         return 0;
+     // Find the block it claims to be in
+     map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
+     if (mi == mapBlockIndex.end())
+         return 0;
+     CBlockIndex* pindex = (*mi).second;
+     if (!pindex || !pindex->IsInMainChain())
+         return 0;
+     // Make sure the merkle branch connects to this block
+     if (!fMerkleVerified)
+     {
+         if (CBlock::CheckMerkleBranch(GetHash(), vMerkleBranch, nIndex) != pindex->hashMerkleRoot)
+             return 0;
+         fMerkleVerified = true;
+     }
+     nHeightRet = pindex->nHeight;
+     return pindexBest->nHeight - pindex->nHeight + 1;
+ }
+ int CMerkleTx::GetBlocksToMaturity() const
+ {
+     if (!IsCoinBase())
+         return 0;
+     return max(0, (COINBASE_MATURITY+20) - GetDepthInMainChain());
+ }
+ bool CMerkleTx::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs)
+ {
+     if (fClient)
+     {
+         if (!IsInMainChain() && !ClientConnectInputs())
+             return false;
+         return CTransaction::AcceptToMemoryPool(txdb, false);
+     }
+     else
+     {
+         return CTransaction::AcceptToMemoryPool(txdb, fCheckInputs);
+     }
+ }
+ bool CWalletTx::AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs)
+ {
+     CRITICAL_BLOCK(cs_mapTransactions)
+     {
+         // Add previous supporting transactions first
+         foreach(CMerkleTx& tx, vtxPrev)
+         {
+             if (!tx.IsCoinBase())
+             {
+                 uint256 hash = tx.GetHash();
+                 if (!mapTransactions.count(hash) && !txdb.ContainsTx(hash))
+                     tx.AcceptToMemoryPool(txdb, fCheckInputs);
+             }
+         }
+         return AcceptToMemoryPool(txdb, fCheckInputs);
+     }
+     return false;
+ }
+ int ScanForWalletTransactions(CBlockIndex* pindexStart)
+ {
+     int ret = 0;
+     CBlockIndex* pindex = pindexStart;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         while (pindex)
+         {
+             CBlock block;
+             block.ReadFromDisk(pindex, true);
+             foreach(CTransaction& tx, block.vtx)
+             {
+                 if (AddToWalletIfInvolvingMe(tx, &block))
+                     ret++;
+             }
+             pindex = pindex->pnext;
+         }
+     }
+     return ret;
+ }
+ void ReacceptWalletTransactions()
+ {
+     CTxDB txdb("r");
+     bool fRepeat = true;
+     while (fRepeat) CRITICAL_BLOCK(cs_mapWallet)
+     {
+         fRepeat = false;
+         vector<CDiskTxPos> vMissingTx;
+         foreach(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet)
+         {
+             CWalletTx& wtx = item.second;
+             if (wtx.IsCoinBase() && wtx.IsSpent(0))
+                 continue;
+             CTxIndex txindex;
+             bool fUpdated = false;
+             if (txdb.ReadTxIndex(wtx.GetHash(), txindex))
+             {
+                 // Update fSpent if a tx got spent somewhere else by a copy of wallet.dat
+                 if (txindex.vSpent.size() != wtx.vout.size())
+                 {
+                     printf("ERROR: ReacceptWalletTransactions() : txindex.vSpent.size() %d != wtx.vout.size() %d\n", txindex.vSpent.size(), wtx.vout.size());
+                     continue;
+                 }
+                 for (int i = 0; i < txindex.vSpent.size(); i++)
+                 {
+                     if (wtx.IsSpent(i))
+                         continue;
+                     if (!txindex.vSpent[i].IsNull() && wtx.vout[i].IsMine())
+                     {
+                         wtx.MarkSpent(i);
+                         fUpdated = true;
+                         vMissingTx.push_back(txindex.vSpent[i]);
+                     }
+                 }
+                 if (fUpdated)
+                 {
+                     printf("ReacceptWalletTransactions found spent coin %sbc %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str());
+                     wtx.MarkDirty();
+                     wtx.WriteToDisk();
+                 }
+             }
+             else
+             {
+                 // Reaccept any txes of ours that aren't already in a block
+                 if (!wtx.IsCoinBase())
+                     wtx.AcceptWalletTransaction(txdb, false);
+             }
+         }
+         if (!vMissingTx.empty())
+         {
+             // TODO: optimize this to scan just part of the block chain?
+             if (ScanForWalletTransactions(pindexGenesisBlock))
+                 fRepeat = true;  // Found missing transactions: re-do Reaccept.
+         }
+     }
+ }
+ void CWalletTx::RelayWalletTransaction(CTxDB& txdb)
+ {
+     foreach(const CMerkleTx& tx, vtxPrev)
+     {
+         if (!tx.IsCoinBase())
+         {
+             uint256 hash = tx.GetHash();
+             if (!txdb.ContainsTx(hash))
+                 RelayMessage(CInv(MSG_TX, hash), (CTransaction)tx);
+         }
+     }
+     if (!IsCoinBase())
+     {
+         uint256 hash = GetHash();
+         if (!txdb.ContainsTx(hash))
+         {
+             printf("Relaying wtx %s\n", hash.ToString().substr(0,10).c_str());
+             RelayMessage(CInv(MSG_TX, hash), (CTransaction)*this);
+         }
+     }
+ }
+ void ResendWalletTransactions()
+ {
+     // Do this infrequently and randomly to avoid giving away
+     // that these are our transactions.
+     static int64 nNextTime;
+     if (GetTime() < nNextTime)
+         return;
+     bool fFirst = (nNextTime == 0);
+     nNextTime = GetTime() + GetRand(30 * 60);
+     if (fFirst)
+         return;
+     // Only do it if there's been a new block since last time
+     static int64 nLastTime;
+     if (nTimeBestReceived < nLastTime)
+         return;
+     nLastTime = GetTime();
+     // Rebroadcast any of our txes that aren't in a block yet
+     printf("ResendWalletTransactions()\n");
+     CTxDB txdb("r");
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         // Sort them in chronological order
+         multimap<unsigned int, CWalletTx*> mapSorted;
+         foreach(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet)
+         {
+             CWalletTx& wtx = item.second;
+             // Don't rebroadcast until it's had plenty of time that
+             // it should have gotten in already by now.
+             if (nTimeBestReceived - (int64)wtx.nTimeReceived > 5 * 60)
+                 mapSorted.insert(make_pair(wtx.nTimeReceived, &wtx));
+         }
+         foreach(PAIRTYPE(const unsigned int, CWalletTx*)& item, mapSorted)
+         {
+             CWalletTx& wtx = *item.second;
+             wtx.RelayWalletTransaction(txdb);
+         }
+     }
+ }
+ int CTxIndex::GetDepthInMainChain() const
+ {
+     // Read block header
+     CBlock block;
+     if (!block.ReadFromDisk(pos.nFile, pos.nBlockPos, false))
+         return 0;
+     // Find the block in the index
+     map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(block.GetHash());
+     if (mi == mapBlockIndex.end())
+         return 0;
+     CBlockIndex* pindex = (*mi).second;
+     if (!pindex || !pindex->IsInMainChain())
+         return 0;
+     return 1 + nBestHeight - pindex->nHeight;
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CBlock and CBlockIndex
+ //
+ bool CBlock::ReadFromDisk(const CBlockIndex* pindex, bool fReadTransactions)
+ {
+     if (!fReadTransactions)
+     {
+         *this = pindex->GetBlockHeader();
+         return true;
+     }
+     if (!ReadFromDisk(pindex->nFile, pindex->nBlockPos, fReadTransactions))
+         return false;
+     if (GetHash() != pindex->GetBlockHash())
+         return error("CBlock::ReadFromDisk() : GetHash() doesn't match index");
+     return true;
+ }
+ uint256 GetOrphanRoot(const CBlock* pblock)
+ {
+     // Work back to the first block in the orphan chain
+     while (mapOrphanBlocks.count(pblock->hashPrevBlock))
+         pblock = mapOrphanBlocks[pblock->hashPrevBlock];
+     return pblock->GetHash();
+ }
+ int64 GetBlockValue(int nHeight, int64 nFees)
+ {
+     int64 nSubsidy = 50 * COIN;
+     // Subsidy is cut in half every 4 years
+     nSubsidy >>= (nHeight / 210000);
+     return nSubsidy + nFees;
+ }
+ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast)
+ {
+     const int64 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
+     const int64 nTargetSpacing = 10 * 60;
+     const int64 nInterval = nTargetTimespan / nTargetSpacing;
+     // Genesis block
+     if (pindexLast == NULL)
+         return bnProofOfWorkLimit.GetCompact();
+     // Only change once per interval
+     if ((pindexLast->nHeight+1) % nInterval != 0)
+         return pindexLast->nBits;
+     // Go back by what we want to be 14 days worth of blocks
+     const CBlockIndex* pindexFirst = pindexLast;
+     for (int i = 0; pindexFirst && i < nInterval-1; i++)
+         pindexFirst = pindexFirst->pprev;
+     assert(pindexFirst);
+     // Limit adjustment step
+     int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
+     printf("  nActualTimespan = %"PRI64d"  before bounds\n", nActualTimespan);
+     if (nActualTimespan < nTargetTimespan/4)
+         nActualTimespan = nTargetTimespan/4;
+     if (nActualTimespan > nTargetTimespan*4)
+         nActualTimespan = nTargetTimespan*4;
+     // Retarget
+     CBigNum bnNew;
+     bnNew.SetCompact(pindexLast->nBits);
+     bnNew *= nActualTimespan;
+     bnNew /= nTargetTimespan;
+     if (bnNew > bnProofOfWorkLimit)
+         bnNew = bnProofOfWorkLimit;
+     /// debug print
+     printf("GetNextWorkRequired RETARGET\n");
+     printf("nTargetTimespan = %"PRI64d"    nActualTimespan = %"PRI64d"\n", nTargetTimespan, nActualTimespan);
+     printf("Before: %08x  %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
+     printf("After:  %08x  %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
+     return bnNew.GetCompact();
+ }
+ bool CheckProofOfWork(uint256 hash, unsigned int nBits)
+ {
+     CBigNum bnTarget;
+     bnTarget.SetCompact(nBits);
+     // Check range
+     if (bnTarget <= 0 || bnTarget > bnProofOfWorkLimit)
+         return error("CheckProofOfWork() : nBits below minimum work");
+     // Check proof of work matches claimed amount
+     if (hash > bnTarget.getuint256())
+         return error("CheckProofOfWork() : hash doesn't match nBits");
+     return true;
+ }
+ bool IsInitialBlockDownload()
+ {
+     if (pindexBest == NULL || (!fTestNet && nBestHeight < 118000))
+         return true;
+     static int64 nLastUpdate;
+     static CBlockIndex* pindexLastBest;
+     if (pindexBest != pindexLastBest)
+     {
+         pindexLastBest = pindexBest;
+         nLastUpdate = GetTime();
+     }
+     return (GetTime() - nLastUpdate < 10 &&
+             pindexBest->GetBlockTime() < GetTime() - 24 * 60 * 60);
+ }
+ void InvalidChainFound(CBlockIndex* pindexNew)
+ {
+     if (pindexNew->bnChainWork > bnBestInvalidWork)
+     {
+         bnBestInvalidWork = pindexNew->bnChainWork;
+         CTxDB().WriteBestInvalidWork(bnBestInvalidWork);
+         MainFrameRepaint();
+     }
+     printf("InvalidChainFound: invalid block=%s  height=%d  work=%s\n", pindexNew->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->nHeight, pindexNew->bnChainWork.ToString().c_str());
+     printf("InvalidChainFound:  current best=%s  height=%d  work=%s\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str());
+     if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6)
+         printf("InvalidChainFound: WARNING: Displayed transactions may not be correct!  You may need to upgrade, or other nodes may need to upgrade.\n");
+ }
+ bool CTransaction::DisconnectInputs(CTxDB& txdb)
+ {
+     // Relinquish previous transactions' spent pointers
+     if (!IsCoinBase())
+     {
+         foreach(const CTxIn& txin, vin)
+         {
+             COutPoint prevout = txin.prevout;
+             // Get prev txindex from disk
+             CTxIndex txindex;
+             if (!txdb.ReadTxIndex(prevout.hash, txindex))
+                 return error("DisconnectInputs() : ReadTxIndex failed");
+             if (prevout.n >= txindex.vSpent.size())
+                 return error("DisconnectInputs() : prevout.n out of range");
+             // Mark outpoint as not spent
+             txindex.vSpent[prevout.n].SetNull();
+             // Write back
+             if (!txdb.UpdateTxIndex(prevout.hash, txindex))
+                 return error("DisconnectInputs() : UpdateTxIndex failed");
+         }
+     }
+     // Remove transaction from index
+     if (!txdb.EraseTxIndex(*this))
+         return error("DisconnectInputs() : EraseTxPos failed");
+     return true;
+ }
+ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPool, CDiskTxPos posThisTx,
+                                  CBlockIndex* pindexBlock, int64& nFees, bool fBlock, bool fMiner, int64 nMinFee)
+ {
+     // Take over previous transactions' spent pointers
+     if (!IsCoinBase())
+     {
+         int64 nValueIn = 0;
+         for (int i = 0; i < vin.size(); i++)
+         {
+             COutPoint prevout = vin[i].prevout;
+             // Read txindex
+             CTxIndex txindex;
+             bool fFound = true;
+             if (fMiner && mapTestPool.count(prevout.hash))
+             {
+                 // Get txindex from current proposed changes
+                 txindex = mapTestPool[prevout.hash];
+             }
+             else
+             {
+                 // Read txindex from txdb
+                 fFound = txdb.ReadTxIndex(prevout.hash, txindex);
+             }
+             if (!fFound && (fBlock || fMiner))
+                 return fMiner ? false : error("ConnectInputs() : %s prev tx %s index entry not found", GetHash().ToString().substr(0,10).c_str(),  prevout.hash.ToString().substr(0,10).c_str());
+             // Read txPrev
+             CTransaction txPrev;
+             if (!fFound || txindex.pos == CDiskTxPos(1,1,1))
+             {
+                 // Get prev tx from single transactions in memory
+                 CRITICAL_BLOCK(cs_mapTransactions)
+                 {
+                     if (!mapTransactions.count(prevout.hash))
+                         return error("ConnectInputs() : %s mapTransactions prev not found %s", GetHash().ToString().substr(0,10).c_str(),  prevout.hash.ToString().substr(0,10).c_str());
+                     txPrev = mapTransactions[prevout.hash];
+                 }
+                 if (!fFound)
+                     txindex.vSpent.resize(txPrev.vout.size());
+             }
+             else
+             {
+                 // Get prev tx from disk
+                 if (!txPrev.ReadFromDisk(txindex.pos))
+                     return error("ConnectInputs() : %s ReadFromDisk prev tx %s failed", GetHash().ToString().substr(0,10).c_str(),  prevout.hash.ToString().substr(0,10).c_str());
+             }
+             if (prevout.n >= txPrev.vout.size() || prevout.n >= txindex.vSpent.size())
+                 return error("ConnectInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str());
+             // If prev is coinbase, check that it's matured
+             if (txPrev.IsCoinBase())
+                 for (CBlockIndex* pindex = pindexBlock; pindex && pindexBlock->nHeight - pindex->nHeight < COINBASE_MATURITY; pindex = pindex->pprev)
+                     if (pindex->nBlockPos == txindex.pos.nBlockPos && pindex->nFile == txindex.pos.nFile)
+                         return error("ConnectInputs() : tried to spend coinbase at depth %d", pindexBlock->nHeight - pindex->nHeight);
+             // Verify signature
+             if (!VerifySignature(txPrev, *this, i))
+                 return error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str());
+             // Check for conflicts
+             if (!txindex.vSpent[prevout.n].IsNull())
+                 return fMiner ? false : error("ConnectInputs() : %s prev tx already used at %s", GetHash().ToString().substr(0,10).c_str(), txindex.vSpent[prevout.n].ToString().c_str());
+             // Check for negative or overflow input values
+             nValueIn += txPrev.vout[prevout.n].nValue;
+             if (!MoneyRange(txPrev.vout[prevout.n].nValue) || !MoneyRange(nValueIn))
+                 return error("ConnectInputs() : txin values out of range");
+             // Mark outpoints as spent
+             txindex.vSpent[prevout.n] = posThisTx;
+             // Write back
+             if (fBlock)
+             {
+                 if (!txdb.UpdateTxIndex(prevout.hash, txindex))
+                     return error("ConnectInputs() : UpdateTxIndex failed");
+             }
+             else if (fMiner)
+             {
+                 mapTestPool[prevout.hash] = txindex;
+             }
+         }
+         if (nValueIn < GetValueOut())
+             return error("ConnectInputs() : %s value in < value out", GetHash().ToString().substr(0,10).c_str());
+         // Tally transaction fees
+         int64 nTxFee = nValueIn - GetValueOut();
+         if (nTxFee < 0)
+             return error("ConnectInputs() : %s nTxFee < 0", GetHash().ToString().substr(0,10).c_str());
+         if (nTxFee < nMinFee)
+             return false;
+         nFees += nTxFee;
+         if (!MoneyRange(nFees))
+             return error("ConnectInputs() : nFees out of range");
+     }
+     if (fBlock)
+     {
+         // Add transaction to disk index
+         if (!txdb.AddTxIndex(*this, posThisTx, pindexBlock->nHeight))
+             return error("ConnectInputs() : AddTxPos failed");
+     }
+     else if (fMiner)
+     {
+         // Add transaction to test pool
+         mapTestPool[GetHash()] = CTxIndex(CDiskTxPos(1,1,1), vout.size());
+     }
+     return true;
+ }
+ bool CTransaction::ClientConnectInputs()
+ {
+     if (IsCoinBase())
+         return false;
+     // Take over previous transactions' spent pointers
+     CRITICAL_BLOCK(cs_mapTransactions)
+     {
+         int64 nValueIn = 0;
+         for (int i = 0; i < vin.size(); i++)
+         {
+             // Get prev tx from single transactions in memory
+             COutPoint prevout = vin[i].prevout;
+             if (!mapTransactions.count(prevout.hash))
+                 return false;
+             CTransaction& txPrev = mapTransactions[prevout.hash];
+             if (prevout.n >= txPrev.vout.size())
+                 return false;
+             // Verify signature
+             if (!VerifySignature(txPrev, *this, i))
+                 return error("ConnectInputs() : VerifySignature failed");
+             ///// this is redundant with the mapNextTx stuff, not sure which I want to get rid of
+             ///// this has to go away now that posNext is gone
+             // // Check for conflicts
+             // if (!txPrev.vout[prevout.n].posNext.IsNull())
+             //     return error("ConnectInputs() : prev tx already used");
+             //
+             // // Flag outpoints as used
+             // txPrev.vout[prevout.n].posNext = posThisTx;
+             nValueIn += txPrev.vout[prevout.n].nValue;
+             if (!MoneyRange(txPrev.vout[prevout.n].nValue) || !MoneyRange(nValueIn))
+                 return error("ClientConnectInputs() : txin values out of range");
+         }
+         if (GetValueOut() > nValueIn)
+             return false;
+     }
+     return true;
+ }
+ bool CBlock::DisconnectBlock(CTxDB& txdb, CBlockIndex* pindex)
+ {
+     // Disconnect in reverse order
+     for (int i = vtx.size()-1; i >= 0; i--)
+         if (!vtx[i].DisconnectInputs(txdb))
+             return false;
+     // Update block index on disk without changing it in memory.
+     // The memory index structure will be changed after the db commits.
+     if (pindex->pprev)
+     {
+         CDiskBlockIndex blockindexPrev(pindex->pprev);
+         blockindexPrev.hashNext = 0;
+         if (!txdb.WriteBlockIndex(blockindexPrev))
+             return error("DisconnectBlock() : WriteBlockIndex failed");
+     }
+     return true;
+ }
+ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex)
+ {
+     // Check it again in case a previous version let a bad block in
+     if (!CheckBlock())
+         return false;
+     //// issue here: it doesn't know the version
+     unsigned int nTxPos = pindex->nBlockPos + ::GetSerializeSize(CBlock(), SER_DISK) - 1 + GetSizeOfCompactSize(vtx.size());
+     map<uint256, CTxIndex> mapUnused;
+     int64 nFees = 0;
+     foreach(CTransaction& tx, vtx)
+     {
+         CDiskTxPos posThisTx(pindex->nFile, pindex->nBlockPos, nTxPos);
+         nTxPos += ::GetSerializeSize(tx, SER_DISK);
+         if (!tx.ConnectInputs(txdb, mapUnused, posThisTx, pindex, nFees, true, false))
+             return false;
+     }
+     if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
+         return false;
+     // Update block index on disk without changing it in memory.
+     // The memory index structure will be changed after the db commits.
+     if (pindex->pprev)
+     {
+         CDiskBlockIndex blockindexPrev(pindex->pprev);
+         blockindexPrev.hashNext = pindex->GetBlockHash();
+         if (!txdb.WriteBlockIndex(blockindexPrev))
+             return error("ConnectBlock() : WriteBlockIndex failed");
+     }
+     // Watch for transactions paying to me
+     foreach(CTransaction& tx, vtx)
+         AddToWalletIfInvolvingMe(tx, this, true);
+     return true;
+ }
+ bool Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
+ {
+     printf("REORGANIZE\n");
+     // Find the fork
+     CBlockIndex* pfork = pindexBest;
+     CBlockIndex* plonger = pindexNew;
+     while (pfork != plonger)
+     {
+         while (plonger->nHeight > pfork->nHeight)
+             if (!(plonger = plonger->pprev))
+                 return error("Reorganize() : plonger->pprev is null");
+         if (pfork == plonger)
+             break;
+         if (!(pfork = pfork->pprev))
+             return error("Reorganize() : pfork->pprev is null");
+     }
+     // List of what to disconnect
+     vector<CBlockIndex*> vDisconnect;
+     for (CBlockIndex* pindex = pindexBest; pindex != pfork; pindex = pindex->pprev)
+         vDisconnect.push_back(pindex);
+     // List of what to connect
+     vector<CBlockIndex*> vConnect;
+     for (CBlockIndex* pindex = pindexNew; pindex != pfork; pindex = pindex->pprev)
+         vConnect.push_back(pindex);
+     reverse(vConnect.begin(), vConnect.end());
+     // Disconnect shorter branch
+     vector<CTransaction> vResurrect;
+     foreach(CBlockIndex* pindex, vDisconnect)
+     {
+         CBlock block;
+         if (!block.ReadFromDisk(pindex))
+             return error("Reorganize() : ReadFromDisk for disconnect failed");
+         if (!block.DisconnectBlock(txdb, pindex))
+             return error("Reorganize() : DisconnectBlock failed");
+         // Queue memory transactions to resurrect
+         foreach(const CTransaction& tx, block.vtx)
+             if (!tx.IsCoinBase())
+                 vResurrect.push_back(tx);
+     }
+     // Connect longer branch
+     vector<CTransaction> vDelete;
+     for (int i = 0; i < vConnect.size(); i++)
+     {
+         CBlockIndex* pindex = vConnect[i];
+         CBlock block;
+         if (!block.ReadFromDisk(pindex))
+             return error("Reorganize() : ReadFromDisk for connect failed");
+         if (!block.ConnectBlock(txdb, pindex))
+         {
+             // Invalid block
+             txdb.TxnAbort();
+             return error("Reorganize() : ConnectBlock failed");
+         }
+         // Queue memory transactions to delete
+         foreach(const CTransaction& tx, block.vtx)
+             vDelete.push_back(tx);
+     }
+     if (!txdb.WriteHashBestChain(pindexNew->GetBlockHash()))
+         return error("Reorganize() : WriteHashBestChain failed");
+     // Make sure it's successfully written to disk before changing memory structure
+     if (!txdb.TxnCommit())
+         return error("Reorganize() : TxnCommit failed");
+     // Disconnect shorter branch
+     foreach(CBlockIndex* pindex, vDisconnect)
+         if (pindex->pprev)
+             pindex->pprev->pnext = NULL;
+     // Connect longer branch
+     foreach(CBlockIndex* pindex, vConnect)
+         if (pindex->pprev)
+             pindex->pprev->pnext = pindex;
+     // Resurrect memory transactions that were in the disconnected branch
+     foreach(CTransaction& tx, vResurrect)
+         tx.AcceptToMemoryPool(txdb, false);
+     // Delete redundant memory transactions that are in the connected branch
+     foreach(CTransaction& tx, vDelete)
+         tx.RemoveFromMemoryPool();
+     return true;
+ }
+ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew)
+ {
+     uint256 hash = GetHash();
+     txdb.TxnBegin();
+     if (pindexGenesisBlock == NULL && hash == hashGenesisBlock)
+     {
+         txdb.WriteHashBestChain(hash);
+         if (!txdb.TxnCommit())
+             return error("SetBestChain() : TxnCommit failed");
+         pindexGenesisBlock = pindexNew;
+     }
+     else if (hashPrevBlock == hashBestChain)
+     {
+         // Adding to current best branch
+         if (!ConnectBlock(txdb, pindexNew) || !txdb.WriteHashBestChain(hash))
+         {
+             txdb.TxnAbort();
+             InvalidChainFound(pindexNew);
+             return error("SetBestChain() : ConnectBlock failed");
+         }
+         if (!txdb.TxnCommit())
+             return error("SetBestChain() : TxnCommit failed");
+         // Add to current best branch
+         pindexNew->pprev->pnext = pindexNew;
+         // Delete redundant memory transactions
+         foreach(CTransaction& tx, vtx)
+             tx.RemoveFromMemoryPool();
+     }
+     else
+     {
+         // New best branch
+         if (!Reorganize(txdb, pindexNew))
+         {
+             txdb.TxnAbort();
+             InvalidChainFound(pindexNew);
+             return error("SetBestChain() : Reorganize failed");
+         }
+     }
+     // Update best block in wallet (so we can detect restored wallets)
+     if (!IsInitialBlockDownload())
+     {
+         CWalletDB walletdb;
+         const CBlockLocator locator(pindexNew);
+         if (!walletdb.WriteBestBlock(locator))
+             return error("SetBestChain() : WriteWalletBest failed");
+     }
+     // New best block
+     hashBestChain = hash;
+     pindexBest = pindexNew;
+     nBestHeight = pindexBest->nHeight;
+     bnBestChainWork = pindexNew->bnChainWork;
+     nTimeBestReceived = GetTime();
+     nTransactionsUpdated++;
+     printf("SetBestChain: new best=%s  height=%d  work=%s\n", hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str());
+     return true;
+ }
+ bool CBlock::AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos)
+ {
+     // Check for duplicate
+     uint256 hash = GetHash();
+     if (mapBlockIndex.count(hash))
+         return error("AddToBlockIndex() : %s already exists", hash.ToString().substr(0,20).c_str());
+     // Construct new block index object
+     CBlockIndex* pindexNew = new CBlockIndex(nFile, nBlockPos, *this);
+     if (!pindexNew)
+         return error("AddToBlockIndex() : new CBlockIndex failed");
+     map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
+     pindexNew->phashBlock = &((*mi).first);
+     map<uint256, CBlockIndex*>::iterator miPrev = mapBlockIndex.find(hashPrevBlock);
+     if (miPrev != mapBlockIndex.end())
+     {
+         pindexNew->pprev = (*miPrev).second;
+         pindexNew->nHeight = pindexNew->pprev->nHeight + 1;
+     }
+     pindexNew->bnChainWork = (pindexNew->pprev ? pindexNew->pprev->bnChainWork : 0) + pindexNew->GetBlockWork();
+     CTxDB txdb;
+     txdb.TxnBegin();
+     txdb.WriteBlockIndex(CDiskBlockIndex(pindexNew));
+     if (!txdb.TxnCommit())
+         return false;
+     // New best
+     if (pindexNew->bnChainWork > bnBestChainWork)
+         if (!SetBestChain(txdb, pindexNew))
+             return false;
+     txdb.Close();
+     if (pindexNew == pindexBest)
+     {
+         // Notify UI to display prev block's coinbase if it was ours
+         static uint256 hashPrevBestCoinBase;
+         CRITICAL_BLOCK(cs_mapWallet)
+             vWalletUpdated.push_back(hashPrevBestCoinBase);
+         hashPrevBestCoinBase = vtx[0].GetHash();
+     }
+     MainFrameRepaint();
+     return true;
+ }
+ bool CBlock::CheckBlock() const
+ {
+     // These are checks that are independent of context
+     // that can be verified before saving an orphan block.
+     // Size limits
+     if (vtx.empty() || vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(*this, SER_NETWORK) > MAX_BLOCK_SIZE)
+         return error("CheckBlock() : size limits failed");
+     // Check proof of work matches claimed amount
+     if (!CheckProofOfWork(GetHash(), nBits))
+         return error("CheckBlock() : proof of work failed");
+     // Check timestamp
+     if (GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60)
+         return error("CheckBlock() : block timestamp too far in the future");
+     // First transaction must be coinbase, the rest must not be
+     if (vtx.empty() || !vtx[0].IsCoinBase())
+         return error("CheckBlock() : first tx is not coinbase");
+     for (int i = 1; i < vtx.size(); i++)
+         if (vtx[i].IsCoinBase())
+             return error("CheckBlock() : more than one coinbase");
+     // Check transactions
+     foreach(const CTransaction& tx, vtx)
+         if (!tx.CheckTransaction())
+             return error("CheckBlock() : CheckTransaction failed");
+     // Check that it's not full of nonstandard transactions
+     if (GetSigOpCount() > MAX_BLOCK_SIGOPS)
+         return error("CheckBlock() : too many nonstandard transactions");
+     // Check merkleroot
+     if (hashMerkleRoot != BuildMerkleTree())
+         return error("CheckBlock() : hashMerkleRoot mismatch");
+     return true;
+ }
+ bool CBlock::AcceptBlock()
+ {
+     // Check for duplicate
+     uint256 hash = GetHash();
+     if (mapBlockIndex.count(hash))
+         return error("AcceptBlock() : block already in mapBlockIndex");
+     // Get prev block index
+     map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashPrevBlock);
+     if (mi == mapBlockIndex.end())
+         return error("AcceptBlock() : prev block not found");
+     CBlockIndex* pindexPrev = (*mi).second;
+     int nHeight = pindexPrev->nHeight+1;
+     // Check proof of work
+     if (nBits != GetNextWorkRequired(pindexPrev))
+         return error("AcceptBlock() : incorrect proof of work");
+     // Check timestamp against prev
+     if (GetBlockTime() <= pindexPrev->GetMedianTimePast())
+         return error("AcceptBlock() : block's timestamp is too early");
+     // Check that all transactions are finalized
+     foreach(const CTransaction& tx, vtx)
+         if (!tx.IsFinal(nHeight, GetBlockTime()))
+             return error("AcceptBlock() : contains a non-final transaction");
+     // Check that the block chain matches the known block chain up to a checkpoint
+     if (!fTestNet)
+         if ((nHeight ==  11111 && hash != uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) ||
+             (nHeight ==  33333 && hash != uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) ||
+             (nHeight ==  68555 && hash != uint256("0x00000000001e1b4903550a0b96e9a9405c8a95f387162e4944e8d9fbe501cd6a")) ||
+             (nHeight ==  70567 && hash != uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) ||
+             (nHeight ==  74000 && hash != uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) ||
+             (nHeight == 105000 && hash != uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) ||
+             (nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")))
+             return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight);
+     // Write block to history file
+     if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK)))
+         return error("AcceptBlock() : out of disk space");
+     unsigned int nFile = -1;
+     unsigned int nBlockPos = 0;
+     if (!WriteToDisk(nFile, nBlockPos))
+         return error("AcceptBlock() : WriteToDisk failed");
+     if (!AddToBlockIndex(nFile, nBlockPos))
+         return error("AcceptBlock() : AddToBlockIndex failed");
+     // Relay inventory, but don't relay old inventory during initial block download
+     if (hashBestChain == hash)
+         CRITICAL_BLOCK(cs_vNodes)
+             foreach(CNode* pnode, vNodes)
+                 if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 118000))
+                     pnode->PushInventory(CInv(MSG_BLOCK, hash));
+     return true;
+ }
+ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
+ {
+     // Check for duplicate
+     uint256 hash = pblock->GetHash();
+     if (mapBlockIndex.count(hash))
+         return error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString().substr(0,20).c_str());
+     if (mapOrphanBlocks.count(hash))
+         return error("ProcessBlock() : already have block (orphan) %s", hash.ToString().substr(0,20).c_str());
+     // Preliminary checks
+     if (!pblock->CheckBlock())
+         return error("ProcessBlock() : CheckBlock FAILED");
+     // If don't already have its previous block, shunt it off to holding area until we get it
+     if (!mapBlockIndex.count(pblock->hashPrevBlock))
+     {
+         printf("ProcessBlock: ORPHAN BLOCK, prev=%s\n", pblock->hashPrevBlock.ToString().substr(0,20).c_str());
+         CBlock* pblock2 = new CBlock(*pblock);
+         mapOrphanBlocks.insert(make_pair(hash, pblock2));
+         mapOrphanBlocksByPrev.insert(make_pair(pblock2->hashPrevBlock, pblock2));
+         // Ask this guy to fill in what we're missing
+         if (pfrom)
+             pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(pblock2));
+         return true;
+     }
+     // Store to disk
+     if (!pblock->AcceptBlock())
+         return error("ProcessBlock() : AcceptBlock FAILED");
+     // Recursively process any orphan blocks that depended on this one
+     vector<uint256> vWorkQueue;
+     vWorkQueue.push_back(hash);
+     for (int i = 0; i < vWorkQueue.size(); i++)
+     {
+         uint256 hashPrev = vWorkQueue[i];
+         for (multimap<uint256, CBlock*>::iterator mi = mapOrphanBlocksByPrev.lower_bound(hashPrev);
+              mi != mapOrphanBlocksByPrev.upper_bound(hashPrev);
+              ++mi)
+         {
+             CBlock* pblockOrphan = (*mi).second;
+             if (pblockOrphan->AcceptBlock())
+                 vWorkQueue.push_back(pblockOrphan->GetHash());
+             mapOrphanBlocks.erase(pblockOrphan->GetHash());
+             delete pblockOrphan;
+         }
+         mapOrphanBlocksByPrev.erase(hashPrev);
+     }
+     printf("ProcessBlock: ACCEPTED\n");
+     return true;
+ }
+ template<typename Stream>
+ bool ScanMessageStart(Stream& s)
+ {
+     // Scan ahead to the next pchMessageStart, which should normally be immediately
+     // at the file pointer.  Leaves file pointer at end of pchMessageStart.
+     s.clear(0);
+     short prevmask = s.exceptions(0);
+     const char* p = BEGIN(pchMessageStart);
+     try
+     {
+         loop
+         {
+             char c;
+             s.read(&c, 1);
+             if (s.fail())
+             {
+                 s.clear(0);
+                 s.exceptions(prevmask);
+                 return false;
+             }
+             if (*p != c)
+                 p = BEGIN(pchMessageStart);
+             if (*p == c)
+             {
+                 if (++p == END(pchMessageStart))
+                 {
+                     s.clear(0);
+                     s.exceptions(prevmask);
+                     return true;
+                 }
+             }
+         }
+     }
+     catch (...)
+     {
+         s.clear(0);
+         s.exceptions(prevmask);
+         return false;
+     }
+ }
+ bool CheckDiskSpace(uint64 nAdditionalBytes)
+ {
+     uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
+     // Check for 15MB because database could create another 10MB log file at any time
+     if (nFreeBytesAvailable < (uint64)15000000 + nAdditionalBytes)
+     {
+         fShutdown = true;
+         string strMessage = _("Warning: Disk space is low  ");
+         strMiscWarning = strMessage;
+         printf("*** %s\n", strMessage.c_str());
+         ThreadSafeMessageBox(strMessage, "Bitcoin", wxOK | wxICON_EXCLAMATION);
+         CreateThread(Shutdown, NULL);
+         return false;
+     }
+     return true;
+ }
+ FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode)
+ {
+     if (nFile == -1)
+         return NULL;
+     FILE* file = fopen(strprintf("%s/blk%04d.dat", GetDataDir().c_str(), nFile).c_str(), pszMode);
+     if (!file)
+         return NULL;
+     if (nBlockPos != 0 && !strchr(pszMode, 'a') && !strchr(pszMode, 'w'))
+     {
+         if (fseek(file, nBlockPos, SEEK_SET) != 0)
+         {
+             fclose(file);
+             return NULL;
+         }
+     }
+     return file;
+ }
+ static unsigned int nCurrentBlockFile = 1;
+ FILE* AppendBlockFile(unsigned int& nFileRet)
+ {
+     nFileRet = 0;
+     loop
+     {
+         FILE* file = OpenBlockFile(nCurrentBlockFile, 0, "ab");
+         if (!file)
+             return NULL;
+         if (fseek(file, 0, SEEK_END) != 0)
+             return NULL;
+         // FAT32 filesize max 4GB, fseek and ftell max 2GB, so we must stay under 2GB
+         if (ftell(file) < 0x7F000000 - MAX_SIZE)
+         {
+             nFileRet = nCurrentBlockFile;
+             return file;
+         }
+         fclose(file);
+         nCurrentBlockFile++;
+     }
+ }
+ bool LoadBlockIndex(bool fAllowNew)
+ {
+     if (fTestNet)
+     {
+         hashGenesisBlock = uint256("0x00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008");
+         bnProofOfWorkLimit = CBigNum(~uint256(0) >> 28);
+         pchMessageStart[0] = 0xfa;
+         pchMessageStart[1] = 0xbf;
+         pchMessageStart[2] = 0xb5;
+         pchMessageStart[3] = 0xda;
+     }
+     //
+     // Load block index
+     //
+     CTxDB txdb("cr");
+     if (!txdb.LoadBlockIndex())
+         return false;
+     txdb.Close();
+     //
+     // Init with genesis block
+     //
+     if (mapBlockIndex.empty())
+     {
+         if (!fAllowNew)
+             return false;
+         // Genesis Block:
+         // CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
+         //   CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
+         //     CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
+         //     CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
+         //   vMerkleTree: 4a5e1e
+         // Genesis block
+         const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
+         CTransaction txNew;
+         txNew.vin.resize(1);
+         txNew.vout.resize(1);
+         txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+         txNew.vout[0].nValue = 50 * COIN;
+         txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
+         CBlock block;
+         block.vtx.push_back(txNew);
+         block.hashPrevBlock = 0;
+         block.hashMerkleRoot = block.BuildMerkleTree();
+         block.nVersion = 1;
+         block.nTime    = 1231006505;
+         block.nBits    = 0x1d00ffff;
+         block.nNonce   = 2083236893;
+         if (fTestNet)
+         {
+             block.nTime    = 1296688602;
+             block.nBits    = 0x1d07fff8;
+             block.nNonce   = 384568319;
+         }
+         //// debug print
+         printf("%s\n", block.GetHash().ToString().c_str());
+         printf("%s\n", hashGenesisBlock.ToString().c_str());
+         printf("%s\n", block.hashMerkleRoot.ToString().c_str());
+         assert(block.hashMerkleRoot == uint256("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
+         block.print();
+         assert(block.GetHash() == hashGenesisBlock);
+         // Start new block file
+         unsigned int nFile;
+         unsigned int nBlockPos;
+         if (!block.WriteToDisk(nFile, nBlockPos))
+             return error("LoadBlockIndex() : writing genesis block to disk failed");
+         if (!block.AddToBlockIndex(nFile, nBlockPos))
+             return error("LoadBlockIndex() : genesis block not accepted");
+     }
+     return true;
+ }
+ void PrintBlockTree()
+ {
+     // precompute tree structure
+     map<CBlockIndex*, vector<CBlockIndex*> > mapNext;
+     for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
+     {
+         CBlockIndex* pindex = (*mi).second;
+         mapNext[pindex->pprev].push_back(pindex);
+         // test
+         //while (rand() % 3 == 0)
+         //    mapNext[pindex->pprev].push_back(pindex);
+     }
+     vector<pair<int, CBlockIndex*> > vStack;
+     vStack.push_back(make_pair(0, pindexGenesisBlock));
+     int nPrevCol = 0;
+     while (!vStack.empty())
+     {
+         int nCol = vStack.back().first;
+         CBlockIndex* pindex = vStack.back().second;
+         vStack.pop_back();
+         // print split or gap
+         if (nCol > nPrevCol)
+         {
+             for (int i = 0; i < nCol-1; i++)
+                 printf("| ");
+             printf("|\\\n");
+         }
+         else if (nCol < nPrevCol)
+         {
+             for (int i = 0; i < nCol; i++)
+                 printf("| ");
+             printf("|\n");
+         }
+         nPrevCol = nCol;
+         // print columns
+         for (int i = 0; i < nCol; i++)
+             printf("| ");
+         // print item
+         CBlock block;
+         block.ReadFromDisk(pindex);
+         printf("%d (%u,%u) %s  %s  tx %d",
+             pindex->nHeight,
+             pindex->nFile,
+             pindex->nBlockPos,
+             block.GetHash().ToString().substr(0,20).c_str(),
+             DateTimeStrFormat("%x %H:%M:%S", block.GetBlockTime()).c_str(),
+             block.vtx.size());
+         CRITICAL_BLOCK(cs_mapWallet)
+         {
+             if (mapWallet.count(block.vtx[0].GetHash()))
+             {
+                 CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()];
+                 printf("    mine:  %d  %d  %d", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit());
+             }
+         }
+         printf("\n");
+         // put the main timechain first
+         vector<CBlockIndex*>& vNext = mapNext[pindex];
+         for (int i = 0; i < vNext.size(); i++)
+         {
+             if (vNext[i]->pnext)
+             {
+                 swap(vNext[0], vNext[i]);
+                 break;
+             }
+         }
+         // iterate children
+         for (int i = 0; i < vNext.size(); i++)
+             vStack.push_back(make_pair(nCol+i, vNext[i]));
+     }
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CAlert
+ //
+ map<uint256, CAlert> mapAlerts;
+ CCriticalSection cs_mapAlerts;
+ string GetWarnings(string strFor)
+ {
+     int nPriority = 0;
+     string strStatusBar;
+     string strRPC;
+     if (GetBoolArg("-testsafemode"))
+         strRPC = "test";
+     // Misc warnings like out of disk space and clock is wrong
+     if (strMiscWarning != "")
+     {
+         nPriority = 1000;
+         strStatusBar = strMiscWarning;
+     }
+     // Longer invalid proof-of-work chain
+     if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6)
+     {
+         nPriority = 2000;
+         strStatusBar = strRPC = "WARNING: Displayed transactions may not be correct!  You may need to upgrade, or other nodes may need to upgrade.";
+     }
+     // Alerts
+     CRITICAL_BLOCK(cs_mapAlerts)
+     {
+         foreach(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
+         {
+             const CAlert& alert = item.second;
+             if (alert.AppliesToMe() && alert.nPriority > nPriority)
+             {
+                 nPriority = alert.nPriority;
+                 strStatusBar = alert.strStatusBar;
+             }
+         }
+     }
+     if (strFor == "statusbar")
+         return strStatusBar;
+     else if (strFor == "rpc")
+         return strRPC;
+     assert(("GetWarnings() : invalid parameter", false));
+     return "error";
+ }
+ bool CAlert::ProcessAlert()
+ {
+     if (!CheckSignature())
+         return false;
+     if (!IsInEffect())
+         return false;
+     CRITICAL_BLOCK(cs_mapAlerts)
+     {
+         // Cancel previous alerts
+         for (map<uint256, CAlert>::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();)
+         {
+             const CAlert& alert = (*mi).second;
+             if (Cancels(alert))
+             {
+                 printf("cancelling alert %d\n", alert.nID);
+                 mapAlerts.erase(mi++);
+             }
+             else if (!alert.IsInEffect())
+             {
+                 printf("expiring alert %d\n", alert.nID);
+                 mapAlerts.erase(mi++);
+             }
+             else
+                 mi++;
+         }
+         // Check if this alert has been cancelled
+         foreach(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
+         {
+             const CAlert& alert = item.second;
+             if (alert.Cancels(*this))
+             {
+                 printf("alert already cancelled by %d\n", alert.nID);
+                 return false;
+             }
+         }
+         // Add to mapAlerts
+         mapAlerts.insert(make_pair(GetHash(), *this));
+     }
+     printf("accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe());
+     MainFrameRepaint();
+     return true;
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // Messages
+ //
+ bool AlreadyHave(CTxDB& txdb, const CInv& inv)
+ {
+     switch (inv.type)
+     {
+     case MSG_TX:    return mapTransactions.count(inv.hash) || mapOrphanTransactions.count(inv.hash) || txdb.ContainsTx(inv.hash);
+     case MSG_BLOCK: return mapBlockIndex.count(inv.hash) || mapOrphanBlocks.count(inv.hash);
+     }
+     // Don't know what it is, just say we already got one
+     return true;
+ }
+ // The message start string is designed to be unlikely to occur in normal data.
+ // The characters are rarely used upper ascii, not valid as UTF-8, and produce
+ // a large 4-byte int at any alignment.
+ char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };
+ bool ProcessMessages(CNode* pfrom)
+ {
+     CDataStream& vRecv = pfrom->vRecv;
+     if (vRecv.empty())
+         return true;
+     //if (fDebug)
+     //    printf("ProcessMessages(%u bytes)\n", vRecv.size());
+     //
+     // Message format
+     //  (4) message start
+     //  (12) command
+     //  (4) size
+     //  (4) checksum
+     //  (x) data
+     //
+     loop
+     {
+         // Scan for message start
+         CDataStream::iterator pstart = search(vRecv.begin(), vRecv.end(), BEGIN(pchMessageStart), END(pchMessageStart));
+         int nHeaderSize = vRecv.GetSerializeSize(CMessageHeader());
+         if (vRecv.end() - pstart < nHeaderSize)
+         {
+             if (vRecv.size() > nHeaderSize)
+             {
+                 printf("\n\nPROCESSMESSAGE MESSAGESTART NOT FOUND\n\n");
+                 vRecv.erase(vRecv.begin(), vRecv.end() - nHeaderSize);
+             }
+             break;
+         }
+         if (pstart - vRecv.begin() > 0)
+             printf("\n\nPROCESSMESSAGE SKIPPED %d BYTES\n\n", pstart - vRecv.begin());
+         vRecv.erase(vRecv.begin(), pstart);
+         // Read header
+         vector<char> vHeaderSave(vRecv.begin(), vRecv.begin() + nHeaderSize);
+         CMessageHeader hdr;
+         vRecv >> hdr;
+         if (!hdr.IsValid())
+         {
+             printf("\n\nPROCESSMESSAGE: ERRORS IN HEADER %s\n\n\n", hdr.GetCommand().c_str());
+             continue;
+         }
+         string strCommand = hdr.GetCommand();
+         // Message size
+         unsigned int nMessageSize = hdr.nMessageSize;
+         if (nMessageSize > MAX_SIZE)
+         {
+             printf("ProcessMessage(%s, %u bytes) : nMessageSize > MAX_SIZE\n", strCommand.c_str(), nMessageSize);
+             continue;
+         }
+         if (nMessageSize > vRecv.size())
+         {
+             // Rewind and wait for rest of message
+             vRecv.insert(vRecv.begin(), vHeaderSave.begin(), vHeaderSave.end());
+             break;
+         }
+         // Checksum
+         if (vRecv.GetVersion() >= 209)
+         {
+             uint256 hash = Hash(vRecv.begin(), vRecv.begin() + nMessageSize);
+             unsigned int nChecksum = 0;
+             memcpy(&nChecksum, &hash, sizeof(nChecksum));
+             if (nChecksum != hdr.nChecksum)
+             {
+                 printf("ProcessMessage(%s, %u bytes) : CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n",
+                        strCommand.c_str(), nMessageSize, nChecksum, hdr.nChecksum);
+                 continue;
+             }
+         }
+         // Copy message to its own buffer
+         CDataStream vMsg(vRecv.begin(), vRecv.begin() + nMessageSize, vRecv.nType, vRecv.nVersion);
+         vRecv.ignore(nMessageSize);
+         // Process message
+         bool fRet = false;
+         try
+         {
+             CRITICAL_BLOCK(cs_main)
+                 fRet = ProcessMessage(pfrom, strCommand, vMsg);
+             if (fShutdown)
+                 return true;
+         }
+         catch (std::ios_base::failure& e)
+         {
+             if (strstr(e.what(), "end of data"))
+             {
+                 // Allow exceptions from underlength message on vRecv
+                 printf("ProcessMessage(%s, %u bytes) : Exception '%s' caught, normally caused by a message being shorter than its stated length\n", strCommand.c_str(), nMessageSize, e.what());
+             }
+             else if (strstr(e.what(), "size too large"))
+             {
+                 // Allow exceptions from overlong size
+                 printf("ProcessMessage(%s, %u bytes) : Exception '%s' caught\n", strCommand.c_str(), nMessageSize, e.what());
+             }
+             else
+             {
+                 PrintExceptionContinue(&e, "ProcessMessage()");
+             }
+         }
+         catch (std::exception& e) {
+             PrintExceptionContinue(&e, "ProcessMessage()");
+         } catch (...) {
+             PrintExceptionContinue(NULL, "ProcessMessage()");
+         }
+         if (!fRet)
+             printf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand.c_str(), nMessageSize);
+     }
+     vRecv.Compact();
+     return true;
+ }
+ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
+ {
+     static map<unsigned int, vector<unsigned char> > mapReuseKey;
+     RandAddSeedPerfmon();
+     if (fDebug)
+         printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
+     printf("received: %s (%d bytes)\n", strCommand.c_str(), vRecv.size());
+     if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
+     {
+         printf("dropmessagestest DROPPING RECV MESSAGE\n");
+         return true;
+     }
+     if (strCommand == "version")
+     {
+         // Each connection can only send one version message
+         if (pfrom->nVersion != 0)
+             return false;
+         int64 nTime;
+         CAddress addrMe;
+         CAddress addrFrom;
+         uint64 nNonce = 1;
+         vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
+         if (pfrom->nVersion == 10300)
+             pfrom->nVersion = 300;
+         if (pfrom->nVersion >= 106 && !vRecv.empty())
+             vRecv >> addrFrom >> nNonce;
+         if (pfrom->nVersion >= 106 && !vRecv.empty())
+             vRecv >> pfrom->strSubVer;
+         if (pfrom->nVersion >= 209 && !vRecv.empty())
+             vRecv >> pfrom->nStartingHeight;
+         if (pfrom->nVersion == 0)
+             return false;
+         // Disconnect if we connected to ourself
+         if (nNonce == nLocalHostNonce && nNonce > 1)
+         {
+             printf("connected to self at %s, disconnecting\n", pfrom->addr.ToString().c_str());
+             pfrom->fDisconnect = true;
+             return true;
+         }
+         // Be shy and don't send version until we hear
+         if (pfrom->fInbound)
+             pfrom->PushVersion();
+         pfrom->fClient = !(pfrom->nServices & NODE_NETWORK);
+         AddTimeData(pfrom->addr.ip, nTime);
+         // Change version
+         if (pfrom->nVersion >= 209)
+             pfrom->PushMessage("verack");
+         pfrom->vSend.SetVersion(min(pfrom->nVersion, VERSION));
+         if (pfrom->nVersion < 209)
+             pfrom->vRecv.SetVersion(min(pfrom->nVersion, VERSION));
+         if (!pfrom->fInbound)
+         {
+             // Advertise our address
+             if (addrLocalHost.IsRoutable() && !fUseProxy)
+             {
+                 CAddress addr(addrLocalHost);
+                 addr.nTime = GetAdjustedTime();
+                 pfrom->PushAddress(addr);
+             }
+             // Get recent addresses
+             if (pfrom->nVersion >= 31402 || mapAddresses.size() < 1000)
+             {
+                 pfrom->PushMessage("getaddr");
+                 pfrom->fGetAddr = true;
+             }
+         }
+         // Ask the first connected node for block updates
+         static int nAskedForBlocks;
+         if (!pfrom->fClient && (nAskedForBlocks < 1 || vNodes.size() <= 1))
+         {
+             nAskedForBlocks++;
+             pfrom->PushGetBlocks(pindexBest, uint256(0));
+         }
+         // Relay alerts
+         CRITICAL_BLOCK(cs_mapAlerts)
+             foreach(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
+                 item.second.RelayTo(pfrom);
+         pfrom->fSuccessfullyConnected = true;
+         printf("version message: version %d, blocks=%d\n", pfrom->nVersion, pfrom->nStartingHeight);
+     }
+     else if (pfrom->nVersion == 0)
+     {
+         // Must have a version message before anything else
+         return false;
+     }
+     else if (strCommand == "verack")
+     {
+         pfrom->vRecv.SetVersion(min(pfrom->nVersion, VERSION));
+     }
+     else if (strCommand == "addr")
+     {
+         vector<CAddress> vAddr;
+         vRecv >> vAddr;
+         // Don't want addr from older versions unless seeding
+         if (pfrom->nVersion < 209)
+             return true;
+         if (pfrom->nVersion < 31402 && mapAddresses.size() > 1000)
+             return true;
+         if (vAddr.size() > 1000)
+             return error("message addr size() = %d", vAddr.size());
+         // Store the new addresses
+         int64 nNow = GetAdjustedTime();
+         int64 nSince = nNow - 10 * 60;
+         foreach(CAddress& addr, vAddr)
+         {
+             if (fShutdown)
+                 return true;
+             // ignore IPv6 for now, since it isn't implemented anyway
+             if (!addr.IsIPv4())
+                 continue;
+             if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
+                 addr.nTime = nNow - 5 * 24 * 60 * 60;
+             AddAddress(addr, 2 * 60 * 60);
+             pfrom->AddAddressKnown(addr);
+             if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable())
+             {
+                 // Relay to a limited number of other nodes
+                 CRITICAL_BLOCK(cs_vNodes)
+                 {
+                     // Use deterministic randomness to send to the same nodes for 24 hours
+                     // at a time so the setAddrKnowns of the chosen nodes prevent repeats
+                     static uint256 hashSalt;
+                     if (hashSalt == 0)
+                         RAND_bytes((unsigned char*)&hashSalt, sizeof(hashSalt));
+                     uint256 hashRand = hashSalt ^ (((int64)addr.ip)<<32) ^ ((GetTime()+addr.ip)/(24*60*60));
+                     hashRand = Hash(BEGIN(hashRand), END(hashRand));
+                     multimap<uint256, CNode*> mapMix;
+                     foreach(CNode* pnode, vNodes)
+                     {
+                         if (pnode->nVersion < 31402)
+                             continue;
+                         unsigned int nPointer;
+                         memcpy(&nPointer, &pnode, sizeof(nPointer));
+                         uint256 hashKey = hashRand ^ nPointer;
+                         hashKey = Hash(BEGIN(hashKey), END(hashKey));
+                         mapMix.insert(make_pair(hashKey, pnode));
+                     }
+                     int nRelayNodes = 2;
+                     for (multimap<uint256, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi)
+                         ((*mi).second)->PushAddress(addr);
+                 }
+             }
+         }
+         if (vAddr.size() < 1000)
+             pfrom->fGetAddr = false;
+     }
+     else if (strCommand == "inv")
+     {
+         vector<CInv> vInv;
+         vRecv >> vInv;
+         if (vInv.size() > 50000)
+             return error("message inv size() = %d", vInv.size());
+         CTxDB txdb("r");
+         foreach(const CInv& inv, vInv)
+         {
+             if (fShutdown)
+                 return true;
+             pfrom->AddInventoryKnown(inv);
+             bool fAlreadyHave = AlreadyHave(txdb, inv);
+             printf("  got inventory: %s  %s\n", inv.ToString().c_str(), fAlreadyHave ? "have" : "new");
+             if (!fAlreadyHave)
+                 pfrom->AskFor(inv);
+             else if (inv.type == MSG_BLOCK && mapOrphanBlocks.count(inv.hash))
+                 pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(mapOrphanBlocks[inv.hash]));
+             // Track requests for our stuff
+             CRITICAL_BLOCK(cs_mapRequestCount)
+             {
+                 map<uint256, int>::iterator mi = mapRequestCount.find(inv.hash);
+                 if (mi != mapRequestCount.end())
+                     (*mi).second++;
+             }
+         }
+     }
+     else if (strCommand == "getdata")
+     {
+         vector<CInv> vInv;
+         vRecv >> vInv;
+         if (vInv.size() > 50000)
+             return error("message getdata size() = %d", vInv.size());
+         foreach(const CInv& inv, vInv)
+         {
+             if (fShutdown)
+                 return true;
+             printf("received getdata for: %s\n", inv.ToString().c_str());
+             if (inv.type == MSG_BLOCK)
+             {
+                 // Send block from disk
+                 map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(inv.hash);
+                 if (mi != mapBlockIndex.end())
+                 {
+                     CBlock block;
+                     block.ReadFromDisk((*mi).second);
+                     pfrom->PushMessage("block", block);
+                     // Trigger them to send a getblocks request for the next batch of inventory
+                     if (inv.hash == pfrom->hashContinue)
+                     {
+                         // Bypass PushInventory, this must send even if redundant,
+                         // and we want it right after the last block so they don't
+                         // wait for other stuff first.
+                         vector<CInv> vInv;
+                         vInv.push_back(CInv(MSG_BLOCK, hashBestChain));
+                         pfrom->PushMessage("inv", vInv);
+                         pfrom->hashContinue = 0;
+                     }
+                 }
+             }
+             else if (inv.IsKnownType())
+             {
+                 // Send stream from relay memory
+                 CRITICAL_BLOCK(cs_mapRelay)
+                 {
+                     map<CInv, CDataStream>::iterator mi = mapRelay.find(inv);
+                     if (mi != mapRelay.end())
+                         pfrom->PushMessage(inv.GetCommand(), (*mi).second);
+                 }
+             }
+             // Track requests for our stuff
+             CRITICAL_BLOCK(cs_mapRequestCount)
+             {
+                 map<uint256, int>::iterator mi = mapRequestCount.find(inv.hash);
+                 if (mi != mapRequestCount.end())
+                     (*mi).second++;
+             }
+         }
+     }
+     else if (strCommand == "getblocks")
+     {
+         CBlockLocator locator;
+         uint256 hashStop;
+         vRecv >> locator >> hashStop;
+         // Find the last block the caller has in the main chain
+         CBlockIndex* pindex = locator.GetBlockIndex();
+         // Send the rest of the chain
+         if (pindex)
+             pindex = pindex->pnext;
+         int nLimit = 500 + locator.GetDistanceBack();
+         printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str(), nLimit);
+         for (; pindex; pindex = pindex->pnext)
+         {
+             if (pindex->GetBlockHash() == hashStop)
+             {
+                 printf("  getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str());
+                 break;
+             }
+             pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash()));
+             if (--nLimit <= 0)
+             {
+                 // When this block is requested, we'll send an inv that'll make them
+                 // getblocks the next batch of inventory.
+                 printf("  getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str());
+                 pfrom->hashContinue = pindex->GetBlockHash();
+                 break;
+             }
+         }
+     }
+     else if (strCommand == "getheaders")
+     {
+         CBlockLocator locator;
+         uint256 hashStop;
+         vRecv >> locator >> hashStop;
+         CBlockIndex* pindex = NULL;
+         if (locator.IsNull())
+         {
+             // If locator is null, return the hashStop block
+             map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashStop);
+             if (mi == mapBlockIndex.end())
+                 return true;
+             pindex = (*mi).second;
+         }
+         else
+         {
+             // Find the last block the caller has in the main chain
+             pindex = locator.GetBlockIndex();
+             if (pindex)
+                 pindex = pindex->pnext;
+         }
+         vector<CBlock> vHeaders;
+         int nLimit = 2000 + locator.GetDistanceBack();
+         printf("getheaders %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str(), nLimit);
+         for (; pindex; pindex = pindex->pnext)
+         {
+             vHeaders.push_back(pindex->GetBlockHeader());
+             if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
+                 break;
+         }
+         pfrom->PushMessage("headers", vHeaders);
+     }
+     else if (strCommand == "tx")
+     {
+         vector<uint256> vWorkQueue;
+         CDataStream vMsg(vRecv);
+         CTransaction tx;
+         vRecv >> tx;
+         CInv inv(MSG_TX, tx.GetHash());
+         pfrom->AddInventoryKnown(inv);
+         bool fMissingInputs = false;
+         if (tx.AcceptToMemoryPool(true, &fMissingInputs))
+         {
+             AddToWalletIfInvolvingMe(tx, NULL, true);
+             RelayMessage(inv, vMsg);
+             mapAlreadyAskedFor.erase(inv);
+             vWorkQueue.push_back(inv.hash);
+             // Recursively process any orphan transactions that depended on this one
+             for (int i = 0; i < vWorkQueue.size(); i++)
+             {
+                 uint256 hashPrev = vWorkQueue[i];
+                 for (multimap<uint256, CDataStream*>::iterator mi = mapOrphanTransactionsByPrev.lower_bound(hashPrev);
+                      mi != mapOrphanTransactionsByPrev.upper_bound(hashPrev);
+                      ++mi)
+                 {
+                     const CDataStream& vMsg = *((*mi).second);
+                     CTransaction tx;
+                     CDataStream(vMsg) >> tx;
+                     CInv inv(MSG_TX, tx.GetHash());
+                     if (tx.AcceptToMemoryPool(true))
+                     {
+                         printf("   accepted orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str());
+                         AddToWalletIfInvolvingMe(tx, NULL, true);
+                         RelayMessage(inv, vMsg);
+                         mapAlreadyAskedFor.erase(inv);
+                         vWorkQueue.push_back(inv.hash);
+                     }
+                 }
+             }
+             foreach(uint256 hash, vWorkQueue)
+                 EraseOrphanTx(hash);
+         }
+         else if (fMissingInputs)
+         {
+             printf("storing orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str());
+             AddOrphanTx(vMsg);
+         }
+     }
+     else if (strCommand == "block")
+     {
+         CBlock block;
+         vRecv >> block;
+         printf("received block %s\n", block.GetHash().ToString().substr(0,20).c_str());
+         // block.print();
+         CInv inv(MSG_BLOCK, block.GetHash());
+         pfrom->AddInventoryKnown(inv);
+         if (ProcessBlock(pfrom, &block))
+             mapAlreadyAskedFor.erase(inv);
+     }
+     else if (strCommand == "getaddr")
+     {
+         // Nodes rebroadcast an addr every 24 hours
+         pfrom->vAddrToSend.clear();
+         int64 nSince = GetAdjustedTime() - 3 * 60 * 60; // in the last 3 hours
+         CRITICAL_BLOCK(cs_mapAddresses)
+         {
+             unsigned int nCount = 0;
+             foreach(const PAIRTYPE(vector<unsigned char>, CAddress)& item, mapAddresses)
+             {
+                 const CAddress& addr = item.second;
+                 if (addr.nTime > nSince)
+                     nCount++;
+             }
+             foreach(const PAIRTYPE(vector<unsigned char>, CAddress)& item, mapAddresses)
+             {
+                 const CAddress& addr = item.second;
+                 if (addr.nTime > nSince && GetRand(nCount) < 2500)
+                     pfrom->PushAddress(addr);
+             }
+         }
+     }
+     else if (strCommand == "checkorder")
+     {
+         uint256 hashReply;
+         vRecv >> hashReply;
+         if (!GetBoolArg("-allowreceivebyip"))
+         {
+             pfrom->PushMessage("reply", hashReply, (int)2, string(""));
+             return true;
+         }
+         CWalletTx order;
+         vRecv >> order;
+         /// we have a chance to check the order here
+         // Keep giving the same key to the same ip until they use it
+         if (!mapReuseKey.count(pfrom->addr.ip))
+             mapReuseKey[pfrom->addr.ip] = GetKeyFromKeyPool();
+         // Send back approval of order and pubkey to use
+         CScript scriptPubKey;
+         scriptPubKey << mapReuseKey[pfrom->addr.ip] << OP_CHECKSIG;
+         pfrom->PushMessage("reply", hashReply, (int)0, scriptPubKey);
+     }
+     else if (strCommand == "submitorder")
+     {
+         uint256 hashReply;
+         vRecv >> hashReply;
+         if (!GetBoolArg("-allowreceivebyip"))
+         {
+             pfrom->PushMessage("reply", hashReply, (int)2);
+             return true;
+         }
+         CWalletTx wtxNew;
+         vRecv >> wtxNew;
+         wtxNew.fFromMe = false;
+         // Broadcast
+         if (!wtxNew.AcceptWalletTransaction())
+         {
+             pfrom->PushMessage("reply", hashReply, (int)1);
+             return error("submitorder AcceptWalletTransaction() failed, returning error 1");
+         }
+         wtxNew.fTimeReceivedIsTxTime = true;
+         AddToWallet(wtxNew);
+         wtxNew.RelayWalletTransaction();
+         mapReuseKey.erase(pfrom->addr.ip);
+         // Send back confirmation
+         pfrom->PushMessage("reply", hashReply, (int)0);
+     }
+     else if (strCommand == "reply")
+     {
+         uint256 hashReply;
+         vRecv >> hashReply;
+         CRequestTracker tracker;
+         CRITICAL_BLOCK(pfrom->cs_mapRequests)
+         {
+             map<uint256, CRequestTracker>::iterator mi = pfrom->mapRequests.find(hashReply);
+             if (mi != pfrom->mapRequests.end())
+             {
+                 tracker = (*mi).second;
+                 pfrom->mapRequests.erase(mi);
+             }
+         }
+         if (!tracker.IsNull())
+             tracker.fn(tracker.param1, vRecv);
+     }
+     else if (strCommand == "ping")
+     {
+     }
+     else if (strCommand == "alert")
+     {
+         CAlert alert;
+         vRecv >> alert;
+         if (alert.ProcessAlert())
+         {
+             // Relay
+             pfrom->setKnown.insert(alert.GetHash());
+             CRITICAL_BLOCK(cs_vNodes)
+                 foreach(CNode* pnode, vNodes)
+                     alert.RelayTo(pnode);
+         }
+     }
+     else
+     {
+         // Ignore unknown commands for extensibility
+     }
+     // Update the last seen time for this node's address
+     if (pfrom->fNetworkNode)
+         if (strCommand == "version" || strCommand == "addr" || strCommand == "inv" || strCommand == "getdata" || strCommand == "ping")
+             AddressCurrentlyConnected(pfrom->addr);
+     return true;
+ }
+ bool SendMessages(CNode* pto, bool fSendTrickle)
+ {
+     CRITICAL_BLOCK(cs_main)
+     {
+         // Don't send anything until we get their version message
+         if (pto->nVersion == 0)
+             return true;
+         // Keep-alive ping
+         if (pto->nLastSend && GetTime() - pto->nLastSend > 30 * 60 && pto->vSend.empty())
+             pto->PushMessage("ping");
+         // Resend wallet transactions that haven't gotten in a block yet
+         ResendWalletTransactions();
+         // Address refresh broadcast
+         static int64 nLastRebroadcast;
+         if (GetTime() - nLastRebroadcast > 24 * 60 * 60)
+         {
+             nLastRebroadcast = GetTime();
+             CRITICAL_BLOCK(cs_vNodes)
+             {
+                 foreach(CNode* pnode, vNodes)
+                 {
+                     // Periodically clear setAddrKnown to allow refresh broadcasts
+                     pnode->setAddrKnown.clear();
+                     // Rebroadcast our address
+                     if (addrLocalHost.IsRoutable() && !fUseProxy)
+                     {
+                         CAddress addr(addrLocalHost);
+                         addr.nTime = GetAdjustedTime();
+                         pnode->PushAddress(addr);
+                     }
+                 }
+             }
+         }
+         // Clear out old addresses periodically so it's not too much work at once
+         static int64 nLastClear;
+         if (nLastClear == 0)
+             nLastClear = GetTime();
+         if (GetTime() - nLastClear > 10 * 60 && vNodes.size() >= 3)
+         {
+             nLastClear = GetTime();
+             CRITICAL_BLOCK(cs_mapAddresses)
+             {
+                 CAddrDB addrdb;
+                 int64 nSince = GetAdjustedTime() - 14 * 24 * 60 * 60;
+                 for (map<vector<unsigned char>, CAddress>::iterator mi = mapAddresses.begin();
+                      mi != mapAddresses.end();)
+                 {
+                     const CAddress& addr = (*mi).second;
+                     if (addr.nTime < nSince)
+                     {
+                         if (mapAddresses.size() < 1000 || GetTime() > nLastClear + 20)
+                             break;
+                         addrdb.EraseAddress(addr);
+                         mapAddresses.erase(mi++);
+                     }
+                     else
+                         mi++;
+                 }
+             }
+         }
+         //
+         // Message: addr
+         //
+         if (fSendTrickle)
+         {
+             vector<CAddress> vAddr;
+             vAddr.reserve(pto->vAddrToSend.size());
+             foreach(const CAddress& addr, pto->vAddrToSend)
+             {
+                 // returns true if wasn't already contained in the set
+                 if (pto->setAddrKnown.insert(addr).second)
+                 {
+                     vAddr.push_back(addr);
+                     // receiver rejects addr messages larger than 1000
+                     if (vAddr.size() >= 1000)
+                     {
+                         pto->PushMessage("addr", vAddr);
+                         vAddr.clear();
+                     }
+                 }
+             }
+             pto->vAddrToSend.clear();
+             if (!vAddr.empty())
+                 pto->PushMessage("addr", vAddr);
+         }
+         //
+         // Message: inventory
+         //
+         vector<CInv> vInv;
+         vector<CInv> vInvWait;
+         CRITICAL_BLOCK(pto->cs_inventory)
+         {
+             vInv.reserve(pto->vInventoryToSend.size());
+             vInvWait.reserve(pto->vInventoryToSend.size());
+             foreach(const CInv& inv, pto->vInventoryToSend)
+             {
+                 if (pto->setInventoryKnown.count(inv))
+                     continue;
+                 // trickle out tx inv to protect privacy
+                 if (inv.type == MSG_TX && !fSendTrickle)
+                 {
+                     // 1/4 of tx invs blast to all immediately
+                     static uint256 hashSalt;
+                     if (hashSalt == 0)
+                         RAND_bytes((unsigned char*)&hashSalt, sizeof(hashSalt));
+                     uint256 hashRand = inv.hash ^ hashSalt;
+                     hashRand = Hash(BEGIN(hashRand), END(hashRand));
+                     bool fTrickleWait = ((hashRand & 3) != 0);
+                     // always trickle our own transactions
+                     if (!fTrickleWait)
+                     {
+                         TRY_CRITICAL_BLOCK(cs_mapWallet)
+                         {
+                             map<uint256, CWalletTx>::iterator mi = mapWallet.find(inv.hash);
+                             if (mi != mapWallet.end())
+                             {
+                                 CWalletTx& wtx = (*mi).second;
+                                 if (wtx.fFromMe)
+                                     fTrickleWait = true;
+                             }
+                         }
+                     }
+                     if (fTrickleWait)
+                     {
+                         vInvWait.push_back(inv);
+                         continue;
+                     }
+                 }
+                 // returns true if wasn't already contained in the set
+                 if (pto->setInventoryKnown.insert(inv).second)
+                 {
+                     vInv.push_back(inv);
+                     if (vInv.size() >= 1000)
+                     {
+                         pto->PushMessage("inv", vInv);
+                         vInv.clear();
+                     }
+                 }
+             }
+             pto->vInventoryToSend = vInvWait;
+         }
+         if (!vInv.empty())
+             pto->PushMessage("inv", vInv);
+         //
+         // Message: getdata
+         //
+         vector<CInv> vGetData;
+         int64 nNow = GetTime() * 1000000;
+         CTxDB txdb("r");
+         while (!pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow)
+         {
+             const CInv& inv = (*pto->mapAskFor.begin()).second;
+             if (!AlreadyHave(txdb, inv))
+             {
+                 printf("sending getdata: %s\n", inv.ToString().c_str());
+                 vGetData.push_back(inv);
+                 if (vGetData.size() >= 1000)
+                 {
+                     pto->PushMessage("getdata", vGetData);
+                     vGetData.clear();
+                 }
+             }
+             pto->mapAskFor.erase(pto->mapAskFor.begin());
+         }
+         if (!vGetData.empty())
+             pto->PushMessage("getdata", vGetData);
+     }
+     return true;
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // BitcoinMiner
+ //
+ void GenerateBitcoins(bool fGenerate)
+ {
+     if (fGenerateBitcoins != fGenerate)
+     {
+         fGenerateBitcoins = fGenerate;
+         CWalletDB().WriteSetting("fGenerateBitcoins", fGenerateBitcoins);
+         MainFrameRepaint();
+     }
+     if (fGenerateBitcoins)
+     {
+         int nProcessors = boost::thread::hardware_concurrency();
+         printf("%d processors\n", nProcessors);
+         if (nProcessors < 1)
+             nProcessors = 1;
+         if (fLimitProcessors && nProcessors > nLimitProcessors)
+             nProcessors = nLimitProcessors;
+         int nAddThreads = nProcessors - vnThreadsRunning[3];
+         printf("Starting %d BitcoinMiner threads\n", nAddThreads);
+         for (int i = 0; i < nAddThreads; i++)
+         {
+             if (!CreateThread(ThreadBitcoinMiner, NULL))
+                 printf("Error: CreateThread(ThreadBitcoinMiner) failed\n");
+             Sleep(10);
+         }
+     }
+ }
+ void ThreadBitcoinMiner(void* parg)
+ {
+     try
+     {
+         vnThreadsRunning[3]++;
+         BitcoinMiner();
+         vnThreadsRunning[3]--;
+     }
+     catch (std::exception& e) {
+         vnThreadsRunning[3]--;
+         PrintException(&e, "ThreadBitcoinMiner()");
+     } catch (...) {
+         vnThreadsRunning[3]--;
+         PrintException(NULL, "ThreadBitcoinMiner()");
+     }
+     UIThreadCall(boost::bind(CalledSetStatusBar, "", 0));
+     nHPSTimerStart = 0;
+     if (vnThreadsRunning[3] == 0)
+         dHashesPerSec = 0;
+     printf("ThreadBitcoinMiner exiting, %d threads remaining\n", vnThreadsRunning[3]);
+ }
 -extern unsigned int ScanHash_4WaySSE2(char* pmidstate, char* pblock, char* phash1, char* phash, unsigned int& nHashesDone);
 -
 -
+ int FormatHashBlocks(void* pbuffer, unsigned int len)
+ {
+     unsigned char* pdata = (unsigned char*)pbuffer;
+     unsigned int blocks = 1 + ((len + 8) / 64);
+     unsigned char* pend = pdata + 64 * blocks;
+     memset(pdata + len, 0, 64 * blocks - len);
+     pdata[len] = 0x80;
+     unsigned int bits = len * 8;
+     pend[-1] = (bits >> 0) & 0xff;
+     pend[-2] = (bits >> 8) & 0xff;
+     pend[-3] = (bits >> 16) & 0xff;
+     pend[-4] = (bits >> 24) & 0xff;
+     return blocks;
+ }
+ using CryptoPP::ByteReverse;
+ static const unsigned int pSHA256InitState[8] =
+ {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
+ inline void SHA256Transform(void* pstate, void* pinput, const void* pinit)
+ {
+     memcpy(pstate, pinit, 32);
+     CryptoPP::SHA256::Transform((CryptoPP::word32*)pstate, (CryptoPP::word32*)pinput);
+ }
+ //
+ // ScanHash scans nonces looking for a hash with at least some zero bits.
+ // It operates on big endian data.  Caller does the byte reversing.
+ // All input buffers are 16-byte aligned.  nNonce is usually preserved
+ // between calls, but periodically or if nNonce is 0xffff0000 or above,
+ // the block is rebuilt and nNonce starts over at zero.
+ //
+ unsigned int ScanHash_CryptoPP(char* pmidstate, char* pdata, char* phash1, char* phash, unsigned int& nHashesDone)
+ {
+     unsigned int& nNonce = *(unsigned int*)(pdata + 12);
+     for (;;)
+     {
+         // Crypto++ SHA-256
+         // Hash pdata using pmidstate as the starting state into
+         // preformatted buffer phash1, then hash phash1 into phash
+         nNonce++;
+         SHA256Transform(phash1, pdata, pmidstate);
+         SHA256Transform(phash, phash1, pSHA256InitState);
+         // Return the nonce if the hash has at least some zero bits,
+         // caller will check if it has enough to reach the target
+         if (((unsigned short*)phash)[14] == 0)
+             return nNonce;
+         // If nothing found after trying for a while, return -1
+         if ((nNonce & 0xffff) == 0)
+         {
+             nHashesDone = 0xffff+1;
+             return -1;
+         }
+     }
+ }
 -    bool f4WaySSE2 = Detect128BitSSE2();
 -    if (mapArgs.count("-4way"))
 -        f4WaySSE2 = GetBoolArg("-4way");
+ class COrphan
+ {
+ public:
+     CTransaction* ptx;
+     set<uint256> setDependsOn;
+     double dPriority;
+     COrphan(CTransaction* ptxIn)
+     {
+         ptx = ptxIn;
+         dPriority = 0;
+     }
+     void print() const
+     {
+         printf("COrphan(hash=%s, dPriority=%.1f)\n", ptx->GetHash().ToString().substr(0,10).c_str(), dPriority);
+         foreach(uint256 hash, setDependsOn)
+             printf("   setDependsOn %s\n", hash.ToString().substr(0,10).c_str());
+     }
+ };
+ CBlock* CreateNewBlock(CReserveKey& reservekey)
+ {
+     CBlockIndex* pindexPrev = pindexBest;
+     // Create new block
+     auto_ptr<CBlock> pblock(new CBlock());
+     if (!pblock.get())
+         return NULL;
+     // Create coinbase tx
+     CTransaction txNew;
+     txNew.vin.resize(1);
+     txNew.vin[0].prevout.SetNull();
+     txNew.vout.resize(1);
+     txNew.vout[0].scriptPubKey << reservekey.GetReservedKey() << OP_CHECKSIG;
+     // Add our coinbase tx as first transaction
+     pblock->vtx.push_back(txNew);
+     // Collect memory pool transactions into the block
+     int64 nFees = 0;
+     CRITICAL_BLOCK(cs_main)
+     CRITICAL_BLOCK(cs_mapTransactions)
+     {
+         CTxDB txdb("r");
+         // Priority order to process transactions
+         list<COrphan> vOrphan; // list memory doesn't move
+         map<uint256, vector<COrphan*> > mapDependers;
+         multimap<double, CTransaction*> mapPriority;
+         for (map<uint256, CTransaction>::iterator mi = mapTransactions.begin(); mi != mapTransactions.end(); ++mi)
+         {
+             CTransaction& tx = (*mi).second;
+             if (tx.IsCoinBase() || !tx.IsFinal())
+                 continue;
+             COrphan* porphan = NULL;
+             double dPriority = 0;
+             foreach(const CTxIn& txin, tx.vin)
+             {
+                 // Read prev transaction
+                 CTransaction txPrev;
+                 CTxIndex txindex;
+                 if (!txPrev.ReadFromDisk(txdb, txin.prevout, txindex))
+                 {
+                     // Has to wait for dependencies
+                     if (!porphan)
+                     {
+                         // Use list for automatic deletion
+                         vOrphan.push_back(COrphan(&tx));
+                         porphan = &vOrphan.back();
+                     }
+                     mapDependers[txin.prevout.hash].push_back(porphan);
+                     porphan->setDependsOn.insert(txin.prevout.hash);
+                     continue;
+                 }
+                 int64 nValueIn = txPrev.vout[txin.prevout.n].nValue;
+                 // Read block header
+                 int nConf = txindex.GetDepthInMainChain();
+                 dPriority += (double)nValueIn * nConf;
+                 if (fDebug && GetBoolArg("-printpriority"))
+                     printf("priority     nValueIn=%-12I64d nConf=%-5d dPriority=%-20.1f\n", nValueIn, nConf, dPriority);
+             }
+             // Priority is sum(valuein * age) / txsize
+             dPriority /= ::GetSerializeSize(tx, SER_NETWORK);
+             if (porphan)
+                 porphan->dPriority = dPriority;
+             else
+                 mapPriority.insert(make_pair(-dPriority, &(*mi).second));
+             if (fDebug && GetBoolArg("-printpriority"))
+             {
+                 printf("priority %-20.1f %s\n%s", dPriority, tx.GetHash().ToString().substr(0,10).c_str(), tx.ToString().c_str());
+                 if (porphan)
+                     porphan->print();
+                 printf("\n");
+             }
+         }
+         // Collect transactions into block
+         map<uint256, CTxIndex> mapTestPool;
+         uint64 nBlockSize = 1000;
+         int nBlockSigOps = 100;
+         while (!mapPriority.empty())
+         {
+             // Take highest priority transaction off priority queue
+             double dPriority = -(*mapPriority.begin()).first;
+             CTransaction& tx = *(*mapPriority.begin()).second;
+             mapPriority.erase(mapPriority.begin());
+             // Size limits
+             unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK);
+             if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE_GEN)
+                 continue;
+             int nTxSigOps = tx.GetSigOpCount();
+             if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
+                 continue;
+             // Transaction fee required depends on block size
+             bool fAllowFree = (nBlockSize + nTxSize < 4000 || CTransaction::AllowFree(dPriority));
+             int64 nMinFee = tx.GetMinFee(nBlockSize, fAllowFree);
+             // Connecting shouldn't fail due to dependency on other memory pool transactions
+             // because we're already processing them in order of dependency
+             map<uint256, CTxIndex> mapTestPoolTmp(mapTestPool);
+             if (!tx.ConnectInputs(txdb, mapTestPoolTmp, CDiskTxPos(1,1,1), pindexPrev, nFees, false, true, nMinFee))
+                 continue;
+             swap(mapTestPool, mapTestPoolTmp);
+             // Added
+             pblock->vtx.push_back(tx);
+             nBlockSize += nTxSize;
+             nBlockSigOps += nTxSigOps;
+             // Add transactions that depend on this one to the priority queue
+             uint256 hash = tx.GetHash();
+             if (mapDependers.count(hash))
+             {
+                 foreach(COrphan* porphan, mapDependers[hash])
+                 {
+                     if (!porphan->setDependsOn.empty())
+                     {
+                         porphan->setDependsOn.erase(hash);
+                         if (porphan->setDependsOn.empty())
+                             mapPriority.insert(make_pair(-porphan->dPriority, porphan->ptx));
+                     }
+                 }
+             }
+         }
+     }
+     pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
+     // Fill in header
+     pblock->hashPrevBlock  = pindexPrev->GetBlockHash();
+     pblock->hashMerkleRoot = pblock->BuildMerkleTree();
+     pblock->nTime          = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
+     pblock->nBits          = GetNextWorkRequired(pindexPrev);
+     pblock->nNonce         = 0;
+     return pblock.release();
+ }
+ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime)
+ {
+     // Update nExtraNonce
+     int64 nNow = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
+     if (++nExtraNonce >= 0x7f && nNow > nPrevTime+1)
+     {
+         nExtraNonce = 1;
+         nPrevTime = nNow;
+     }
+     pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce);
+     pblock->hashMerkleRoot = pblock->BuildMerkleTree();
+ }
+ void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1)
+ {
+     //
+     // Prebuild hash buffers
+     //
+     struct
+     {
+         struct unnamed2
+         {
+             int nVersion;
+             uint256 hashPrevBlock;
+             uint256 hashMerkleRoot;
+             unsigned int nTime;
+             unsigned int nBits;
+             unsigned int nNonce;
+         }
+         block;
+         unsigned char pchPadding0[64];
+         uint256 hash1;
+         unsigned char pchPadding1[64];
+     }
+     tmp;
+     memset(&tmp, 0, sizeof(tmp));
+     tmp.block.nVersion       = pblock->nVersion;
+     tmp.block.hashPrevBlock  = pblock->hashPrevBlock;
+     tmp.block.hashMerkleRoot = pblock->hashMerkleRoot;
+     tmp.block.nTime          = pblock->nTime;
+     tmp.block.nBits          = pblock->nBits;
+     tmp.block.nNonce         = pblock->nNonce;
+     FormatHashBlocks(&tmp.block, sizeof(tmp.block));
+     FormatHashBlocks(&tmp.hash1, sizeof(tmp.hash1));
+     // Byte swap all the input buffer
+     for (int i = 0; i < sizeof(tmp)/4; i++)
+         ((unsigned int*)&tmp)[i] = ByteReverse(((unsigned int*)&tmp)[i]);
+     // Precalc the first half of the first hash, which stays constant
+     SHA256Transform(pmidstate, &tmp.block, pSHA256InitState);
+     memcpy(pdata, &tmp.block, 128);
+     memcpy(phash1, &tmp.hash1, 64);
+ }
+ bool CheckWork(CBlock* pblock, CReserveKey& reservekey)
+ {
+     uint256 hash = pblock->GetHash();
+     uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
+     if (hash > hashTarget)
+         return false;
+     //// debug print
+     printf("BitcoinMiner:\n");
+     printf("proof-of-work found  \n  hash: %s  \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());
+     pblock->print();
+     printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
+     printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str());
+     // Found a solution
+     CRITICAL_BLOCK(cs_main)
+     {
+         if (pblock->hashPrevBlock != hashBestChain)
+             return error("BitcoinMiner : generated block is stale");
+         // Remove key from key pool
+         reservekey.KeepKey();
+         // Track how many getdata requests this block gets
+         CRITICAL_BLOCK(cs_mapRequestCount)
+             mapRequestCount[pblock->GetHash()] = 0;
+         // Process this block the same as if we had received it from another node
+         if (!ProcessBlock(NULL, pblock))
+             return error("BitcoinMiner : ProcessBlock, block not accepted");
+     }
+     Sleep(2000);
+     return true;
+ }
+ void BitcoinMiner()
+ {
+     printf("BitcoinMiner started\n");
+     SetThreadPriority(THREAD_PRIORITY_LOWEST);
 -#ifdef FOURWAYSSE2
 -            if (f4WaySSE2)
 -                // tcatm's 4-way 128-bit SSE2 SHA-256
 -                nNonceFound = ScanHash_4WaySSE2(pmidstate, pdata + 64, phash1, (char*)&hash, nHashesDone);
 -            else
 -#endif
 -                // Crypto++ SHA-256
 -                nNonceFound = ScanHash_CryptoPP(pmidstate, pdata + 64, phash1, (char*)&hash, nHashesDone);
+     // Each thread has its own key and counter
+     CReserveKey reservekey;
+     unsigned int nExtraNonce = 0;
+     int64 nPrevTime = 0;
+     while (fGenerateBitcoins)
+     {
+         if (AffinityBugWorkaround(ThreadBitcoinMiner))
+             return;
+         if (fShutdown)
+             return;
+         while (vNodes.empty() || IsInitialBlockDownload())
+         {
+             Sleep(1000);
+             if (fShutdown)
+                 return;
+             if (!fGenerateBitcoins)
+                 return;
+         }
+         //
+         // Create new block
+         //
+         unsigned int nTransactionsUpdatedLast = nTransactionsUpdated;
+         CBlockIndex* pindexPrev = pindexBest;
+         auto_ptr<CBlock> pblock(CreateNewBlock(reservekey));
+         if (!pblock.get())
+             return;
+         IncrementExtraNonce(pblock.get(), pindexPrev, nExtraNonce, nPrevTime);
+         printf("Running BitcoinMiner with %d transactions in block\n", pblock->vtx.size());
+         //
+         // Prebuild hash buffers
+         //
+         char pmidstatebuf[32+16]; char* pmidstate = alignup<16>(pmidstatebuf);
+         char pdatabuf[128+16];    char* pdata     = alignup<16>(pdatabuf);
+         char phash1buf[64+16];    char* phash1    = alignup<16>(phash1buf);
+         FormatHashBuffers(pblock.get(), pmidstate, pdata, phash1);
+         unsigned int& nBlockTime = *(unsigned int*)(pdata + 64 + 4);
+         unsigned int& nBlockNonce = *(unsigned int*)(pdata + 64 + 12);
+         //
+         // Search
+         //
+         int64 nStart = GetTime();
+         uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
+         uint256 hashbuf[2];
+         uint256& hash = *alignup<16>(hashbuf);
+         loop
+         {
+             unsigned int nHashesDone = 0;
+             unsigned int nNonceFound;
++            // Crypto++ SHA-256
++            nNonceFound = ScanHash_CryptoPP(pmidstate, pdata + 64, phash1,
++                                            (char*)&hash, nHashesDone);
+             // Check if something found
+             if (nNonceFound != -1)
+             {
+                 for (int i = 0; i < sizeof(hash)/4; i++)
+                     ((unsigned int*)&hash)[i] = ByteReverse(((unsigned int*)&hash)[i]);
+                 if (hash <= hashTarget)
+                 {
+                     // Found a solution
+                     pblock->nNonce = ByteReverse(nNonceFound);
+                     assert(hash == pblock->GetHash());
+                     SetThreadPriority(THREAD_PRIORITY_NORMAL);
+                     CheckWork(pblock.get(), reservekey);
+                     SetThreadPriority(THREAD_PRIORITY_LOWEST);
+                     break;
+                 }
+             }
+             // Meter hashes/sec
+             static int64 nHashCounter;
+             if (nHPSTimerStart == 0)
+             {
+                 nHPSTimerStart = GetTimeMillis();
+                 nHashCounter = 0;
+             }
+             else
+                 nHashCounter += nHashesDone;
+             if (GetTimeMillis() - nHPSTimerStart > 4000)
+             {
+                 static CCriticalSection cs;
+                 CRITICAL_BLOCK(cs)
+                 {
+                     if (GetTimeMillis() - nHPSTimerStart > 4000)
+                     {
+                         dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nHPSTimerStart);
+                         nHPSTimerStart = GetTimeMillis();
+                         nHashCounter = 0;
+                         string strStatus = strprintf("    %.0f khash/s", dHashesPerSec/1000.0);
+                         UIThreadCall(boost::bind(CalledSetStatusBar, strStatus, 0));
+                         static int64 nLogTime;
+                         if (GetTime() - nLogTime > 30 * 60)
+                         {
+                             nLogTime = GetTime();
+                             printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
+                             printf("hashmeter %3d CPUs %6.0f khash/s\n", vnThreadsRunning[3], dHashesPerSec/1000.0);
+                         }
+                     }
+                 }
+             }
+             // Check for stop or if block needs to be rebuilt
+             if (fShutdown)
+                 return;
+             if (!fGenerateBitcoins)
+                 return;
+             if (fLimitProcessors && vnThreadsRunning[3] > nLimitProcessors)
+                 return;
+             if (vNodes.empty())
+                 break;
+             if (nBlockNonce >= 0xffff0000)
+                 break;
+             if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
+                 break;
+             if (pindexPrev != pindexBest)
+                 break;
+             // Update nTime every few seconds
+             pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
+             nBlockTime = ByteReverse(pblock->nTime);
+         }
+     }
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // Actions
+ //
+ int64 GetBalance()
+ {
+     int64 nStart = GetTimeMillis();
+     int64 nTotal = 0;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             CWalletTx* pcoin = &(*it).second;
+             if (!pcoin->IsFinal() || !pcoin->IsConfirmed())
+                 continue;
+             nTotal += pcoin->GetAvailableCredit();
+         }
+     }
+     //printf("GetBalance() %"PRI64d"ms\n", GetTimeMillis() - nStart);
+     return nTotal;
+ }
+ bool SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfTheirs, set<pair<CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet)
+ {
+     setCoinsRet.clear();
+     nValueRet = 0;
+     // List of values less than target
+     pair<int64, pair<CWalletTx*,unsigned int> > coinLowestLarger;
+     coinLowestLarger.first = INT64_MAX;
+     coinLowestLarger.second.first = NULL;
+     vector<pair<int64, pair<CWalletTx*,unsigned int> > > vValue;
+     int64 nTotalLower = 0;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+        vector<CWalletTx*> vCoins;
+        vCoins.reserve(mapWallet.size());
+        for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+            vCoins.push_back(&(*it).second);
+        random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt);
+        foreach(CWalletTx* pcoin, vCoins)
+        {
+             if (!pcoin->IsFinal() || !pcoin->IsConfirmed())
+                 continue;
+             if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0)
+                 continue;
+             int nDepth = pcoin->GetDepthInMainChain();
+             if (nDepth < (pcoin->IsFromMe() ? nConfMine : nConfTheirs))
+                 continue;
+             for (int i = 0; i < pcoin->vout.size(); i++)
+             {
+                 if (pcoin->IsSpent(i) || !pcoin->vout[i].IsMine())
+                     continue;
+                 int64 n = pcoin->vout[i].nValue;
+                 if (n <= 0)
+                     continue;
+                 pair<int64,pair<CWalletTx*,unsigned int> > coin = make_pair(n,make_pair(pcoin,i));
+                 if (n == nTargetValue)
+                 {
+                     setCoinsRet.insert(coin.second);
+                     nValueRet += coin.first;
+                     return true;
+                 }
+                 else if (n < nTargetValue + CENT)
+                 {
+                     vValue.push_back(coin);
+                     nTotalLower += n;
+                 }
+                 else if (n < coinLowestLarger.first)
+                 {
+                     coinLowestLarger = coin;
+                 }
+             }
+         }
+     }
+     if (nTotalLower == nTargetValue || nTotalLower == nTargetValue + CENT)
+     {
+         for (int i = 0; i < vValue.size(); ++i)
+         {
+             setCoinsRet.insert(vValue[i].second);
+             nValueRet += vValue[i].first;
+         }
+         return true;
+     }
+     if (nTotalLower < nTargetValue + (coinLowestLarger.second.first ? CENT : 0))
+     {
+         if (coinLowestLarger.second.first == NULL)
+             return false;
+         setCoinsRet.insert(coinLowestLarger.second);
+         nValueRet += coinLowestLarger.first;
+         return true;
+     }
+     if (nTotalLower >= nTargetValue + CENT)
+         nTargetValue += CENT;
+     // Solve subset sum by stochastic approximation
+     sort(vValue.rbegin(), vValue.rend());
+     vector<char> vfIncluded;
+     vector<char> vfBest(vValue.size(), true);
+     int64 nBest = nTotalLower;
+     for (int nRep = 0; nRep < 1000 && nBest != nTargetValue; nRep++)
+     {
+         vfIncluded.assign(vValue.size(), false);
+         int64 nTotal = 0;
+         bool fReachedTarget = false;
+         for (int nPass = 0; nPass < 2 && !fReachedTarget; nPass++)
+         {
+             for (int i = 0; i < vValue.size(); i++)
+             {
+                 if (nPass == 0 ? rand() % 2 : !vfIncluded[i])
+                 {
+                     nTotal += vValue[i].first;
+                     vfIncluded[i] = true;
+                     if (nTotal >= nTargetValue)
+                     {
+                         fReachedTarget = true;
+                         if (nTotal < nBest)
+                         {
+                             nBest = nTotal;
+                             vfBest = vfIncluded;
+                         }
+                         nTotal -= vValue[i].first;
+                         vfIncluded[i] = false;
+                     }
+                 }
+             }
+         }
+     }
+     // If the next larger is still closer, return it
+     if (coinLowestLarger.second.first && coinLowestLarger.first - nTargetValue <= nBest - nTargetValue)
+     {
+         setCoinsRet.insert(coinLowestLarger.second);
+         nValueRet += coinLowestLarger.first;
+     }
+     else {
+         for (int i = 0; i < vValue.size(); i++)
+             if (vfBest[i])
+             {
+                 setCoinsRet.insert(vValue[i].second);
+                 nValueRet += vValue[i].first;
+             }
+         //// debug print
+         printf("SelectCoins() best subset: ");
+         for (int i = 0; i < vValue.size(); i++)
+             if (vfBest[i])
+                 printf("%s ", FormatMoney(vValue[i].first).c_str());
+         printf("total %s\n", FormatMoney(nBest).c_str());
+     }
+     return true;
+ }
+ bool SelectCoins(int64 nTargetValue, set<pair<CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet)
+ {
+     return (SelectCoinsMinConf(nTargetValue, 1, 6, setCoinsRet, nValueRet) ||
+             SelectCoinsMinConf(nTargetValue, 1, 1, setCoinsRet, nValueRet) ||
+             SelectCoinsMinConf(nTargetValue, 0, 1, setCoinsRet, nValueRet));
+ }
+ bool CreateTransaction(const vector<pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet)
+ {
+     int64 nValue = 0;
+     foreach (const PAIRTYPE(CScript, int64)& s, vecSend)
+     {
+         if (nValue < 0)
+             return false;
+         nValue += s.second;
+     }
+     if (vecSend.empty() || nValue < 0)
+         return false;
+     CRITICAL_BLOCK(cs_main)
+     {
+         // txdb must be opened before the mapWallet lock
+         CTxDB txdb("r");
+         CRITICAL_BLOCK(cs_mapWallet)
+         {
+             nFeeRet = nTransactionFee;
+             loop
+             {
+                 wtxNew.vin.clear();
+                 wtxNew.vout.clear();
+                 wtxNew.fFromMe = true;
+                 int64 nTotalValue = nValue + nFeeRet;
+                 double dPriority = 0;
+                 // vouts to the payees
+                 foreach (const PAIRTYPE(CScript, int64)& s, vecSend)
+                     wtxNew.vout.push_back(CTxOut(s.second, s.first));
+                 // Choose coins to use
+                 set<pair<CWalletTx*,unsigned int> > setCoins;
+                 int64 nValueIn = 0;
+                 if (!SelectCoins(nTotalValue, setCoins, nValueIn))
+                     return false;
+                 foreach(PAIRTYPE(CWalletTx*, unsigned int) pcoin, setCoins)
+                 {
+                     int64 nCredit = pcoin.first->vout[pcoin.second].nValue;
+                     dPriority += (double)nCredit * pcoin.first->GetDepthInMainChain();
+                 }
+                 // Fill a vout back to self with any change
+                 int64 nChange = nValueIn - nTotalValue;
+                 if (nChange >= CENT)
+                 {
+                     // Note: We use a new key here to keep it from being obvious which side is the change.
+                     //  The drawback is that by not reusing a previous key, the change may be lost if a
+                     //  backup is restored, if the backup doesn't have the new private key for the change.
+                     //  If we reused the old key, it would be possible to add code to look for and
+                     //  rediscover unknown transactions that were written with keys of ours to recover
+                     //  post-backup change.
+                     // Reserve a new key pair from key pool
+                     vector<unsigned char> vchPubKey = reservekey.GetReservedKey();
+                     assert(mapKeys.count(vchPubKey));
+                     // Fill a vout to ourself, using same address type as the payment
+                     CScript scriptChange;
+                     if (vecSend[0].first.GetBitcoinAddressHash160() != 0)
+                         scriptChange.SetBitcoinAddress(vchPubKey);
+                     else
+                         scriptChange << vchPubKey << OP_CHECKSIG;
+                     // Insert change txn at random position:
+                     vector<CTxOut>::iterator position = wtxNew.vout.begin()+GetRandInt(wtxNew.vout.size());
+                     wtxNew.vout.insert(position, CTxOut(nChange, scriptChange));
+                 }
+                 else
+                     reservekey.ReturnKey();
+                 // Fill vin
+                 foreach(const PAIRTYPE(CWalletTx*,unsigned int)& coin, setCoins)
+                     wtxNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second));
+                 // Sign
+                 int nIn = 0;
+                 foreach(const PAIRTYPE(CWalletTx*,unsigned int)& coin, setCoins)
+                     if (!SignSignature(*coin.first, wtxNew, nIn++))
+                         return false;
+                 // Limit size
+                 unsigned int nBytes = ::GetSerializeSize(*(CTransaction*)&wtxNew, SER_NETWORK);
+                 if (nBytes >= MAX_BLOCK_SIZE_GEN/5)
+                     return false;
+                 dPriority /= nBytes;
+                 // Check that enough fee is included
+                 int64 nPayFee = nTransactionFee * (1 + (int64)nBytes / 1000);
+                 bool fAllowFree = CTransaction::AllowFree(dPriority);
+                 int64 nMinFee = wtxNew.GetMinFee(1, fAllowFree);
+                 if (nFeeRet < max(nPayFee, nMinFee))
+                 {
+                     nFeeRet = max(nPayFee, nMinFee);
+                     continue;
+                 }
+                 // Fill vtxPrev by copying from previous transactions vtxPrev
+                 wtxNew.AddSupportingTransactions(txdb);
+                 wtxNew.fTimeReceivedIsTxTime = true;
+                 break;
+             }
+         }
+     }
+     return true;
+ }
+ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet)
+ {
+     vector< pair<CScript, int64> > vecSend;
+     vecSend.push_back(make_pair(scriptPubKey, nValue));
+     return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet);
+ }
+ // Call after CreateTransaction unless you want to abort
+ bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
+ {
+     CRITICAL_BLOCK(cs_main)
+     {
+         printf("CommitTransaction:\n%s", wtxNew.ToString().c_str());
+         CRITICAL_BLOCK(cs_mapWallet)
+         {
+             // This is only to keep the database open to defeat the auto-flush for the
+             // duration of this scope.  This is the only place where this optimization
+             // maybe makes sense; please don't do it anywhere else.
+             CWalletDB walletdb("r");
+             // Take key pair from key pool so it won't be used again
+             reservekey.KeepKey();
+             // Add tx to wallet, because if it has change it's also ours,
+             // otherwise just for transaction history.
+             AddToWallet(wtxNew);
+             // Mark old coins as spent
+             set<CWalletTx*> setCoins;
+             foreach(const CTxIn& txin, wtxNew.vin)
+             {
+                 CWalletTx &pcoin = mapWallet[txin.prevout.hash];
+                 pcoin.MarkSpent(txin.prevout.n);
+                 pcoin.WriteToDisk();
+                 vWalletUpdated.push_back(pcoin.GetHash());
+             }
+         }
+         // Track how many getdata requests our transaction gets
+         CRITICAL_BLOCK(cs_mapRequestCount)
+             mapRequestCount[wtxNew.GetHash()] = 0;
+         // Broadcast
+         if (!wtxNew.AcceptToMemoryPool())
+         {
+             // This must not fail. The transaction has already been signed and recorded.
+             printf("CommitTransaction() : Error: Transaction not valid");
+             return false;
+         }
+         wtxNew.RelayWalletTransaction();
+     }
+     MainFrameRepaint();
+     return true;
+ }
+ // requires cs_main lock
+ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee)
+ {
+     CReserveKey reservekey;
+     int64 nFeeRequired;
+     if (!CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired))
+     {
+         string strError;
+         if (nValue + nFeeRequired > GetBalance())
+             strError = strprintf(_("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds  "), FormatMoney(nFeeRequired).c_str());
+         else
+             strError = _("Error: Transaction creation failed  ");
+         printf("SendMoney() : %s", strError.c_str());
+         return strError;
+     }
+     if (fAskFee && !ThreadSafeAskFee(nFeeRequired, _("Sending..."), NULL))
+         return "ABORTED";
+     if (!CommitTransaction(wtxNew, reservekey))
+         return _("Error: The transaction was rejected.  This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
+     MainFrameRepaint();
+     return "";
+ }
+ // requires cs_main lock
+ string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee)
+ {
+     // Check amount
+     if (nValue <= 0)
+         return _("Invalid amount");
+     if (nValue + nTransactionFee > GetBalance())
+         return _("Insufficient funds");
+     // Parse bitcoin address
+     CScript scriptPubKey;
+     if (!scriptPubKey.SetBitcoinAddress(strAddress))
+         return _("Invalid bitcoin address");
+     return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee);
+ }
diff --cc src/main.h
index 0000000000000000000000000000000000000000,355ef5313fced5df8b96e83a1563ca0237007039..8ff105124eaf59c926e06a591680bfa57e0ba5a6
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,2050 +1,2050 @@@
 -                return true;
+ // Copyright (c) 2009-2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ class COutPoint;
+ class CInPoint;
+ class CDiskTxPos;
+ class CCoinBase;
+ class CTxIn;
+ class CTxOut;
+ class CTransaction;
+ class CBlock;
+ class CBlockIndex;
+ class CWalletTx;
+ class CKeyItem;
+ static const unsigned int MAX_BLOCK_SIZE = 1000000;
+ static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
+ static const int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
+ static const int64 COIN = 100000000;
+ static const int64 CENT = 1000000;
+ static const int64 MAX_MONEY = 21000000 * COIN;
+ inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+ static const int COINBASE_MATURITY = 100;
+ #ifdef USE_UPNP
+ static const int fHaveUPnP = true;
+ #else
+ static const int fHaveUPnP = false;
+ #endif
+ extern CCriticalSection cs_main;
+ extern map<uint256, CBlockIndex*> mapBlockIndex;
+ extern uint256 hashGenesisBlock;
+ extern CBigNum bnProofOfWorkLimit;
+ extern CBlockIndex* pindexGenesisBlock;
+ extern int nBestHeight;
+ extern CBigNum bnBestChainWork;
+ extern CBigNum bnBestInvalidWork;
+ extern uint256 hashBestChain;
+ extern CBlockIndex* pindexBest;
+ extern unsigned int nTransactionsUpdated;
+ extern map<uint256, int> mapRequestCount;
+ extern CCriticalSection cs_mapRequestCount;
+ extern map<string, string> mapAddressBook;
+ extern CCriticalSection cs_mapAddressBook;
+ extern vector<unsigned char> vchDefaultKey;
+ extern double dHashesPerSec;
+ extern int64 nHPSTimerStart;
+ // Settings
+ extern int fGenerateBitcoins;
+ extern int64 nTransactionFee;
+ extern CAddress addrIncoming;
+ extern int fLimitProcessors;
+ extern int nLimitProcessors;
+ extern int fMinimizeToTray;
+ extern int fMinimizeOnClose;
+ extern int fUseUPnP;
+ bool CheckDiskSpace(uint64 nAdditionalBytes=0);
+ FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
+ FILE* AppendBlockFile(unsigned int& nFileRet);
+ bool AddKey(const CKey& key);
+ vector<unsigned char> GenerateNewKey();
+ bool AddToWallet(const CWalletTx& wtxIn);
+ void WalletUpdateSpent(const COutPoint& prevout);
+ int ScanForWalletTransactions(CBlockIndex* pindexStart);
+ void ReacceptWalletTransactions();
+ bool LoadBlockIndex(bool fAllowNew=true);
+ void PrintBlockTree();
+ bool ProcessMessages(CNode* pfrom);
+ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv);
+ bool SendMessages(CNode* pto, bool fSendTrickle);
+ int64 GetBalance();
+ bool CreateTransaction(const vector<pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
+ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
+ bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
+ bool BroadcastTransaction(CWalletTx& wtxNew);
+ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
+ string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
+ void GenerateBitcoins(bool fGenerate);
+ void ThreadBitcoinMiner(void* parg);
+ CBlock* CreateNewBlock(CReserveKey& reservekey);
+ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime);
+ void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1);
+ bool CheckWork(CBlock* pblock, CReserveKey& reservekey);
+ void BitcoinMiner();
+ bool CheckProofOfWork(uint256 hash, unsigned int nBits);
+ bool IsInitialBlockDownload();
+ string GetWarnings(string strFor);
+ class CDiskTxPos
+ {
+ public:
+     unsigned int nFile;
+     unsigned int nBlockPos;
+     unsigned int nTxPos;
+     CDiskTxPos()
+     {
+         SetNull();
+     }
+     CDiskTxPos(unsigned int nFileIn, unsigned int nBlockPosIn, unsigned int nTxPosIn)
+     {
+         nFile = nFileIn;
+         nBlockPos = nBlockPosIn;
+         nTxPos = nTxPosIn;
+     }
+     IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
+     void SetNull() { nFile = -1; nBlockPos = 0; nTxPos = 0; }
+     bool IsNull() const { return (nFile == -1); }
+     friend bool operator==(const CDiskTxPos& a, const CDiskTxPos& b)
+     {
+         return (a.nFile     == b.nFile &&
+                 a.nBlockPos == b.nBlockPos &&
+                 a.nTxPos    == b.nTxPos);
+     }
+     friend bool operator!=(const CDiskTxPos& a, const CDiskTxPos& b)
+     {
+         return !(a == b);
+     }
+     string ToString() const
+     {
+         if (IsNull())
+             return strprintf("null");
+         else
+             return strprintf("(nFile=%d, nBlockPos=%d, nTxPos=%d)", nFile, nBlockPos, nTxPos);
+     }
+     void print() const
+     {
+         printf("%s", ToString().c_str());
+     }
+ };
+ class CInPoint
+ {
+ public:
+     CTransaction* ptx;
+     unsigned int n;
+     CInPoint() { SetNull(); }
+     CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; }
+     void SetNull() { ptx = NULL; n = -1; }
+     bool IsNull() const { return (ptx == NULL && n == -1); }
+ };
+ class COutPoint
+ {
+ public:
+     uint256 hash;
+     unsigned int n;
+     COutPoint() { SetNull(); }
+     COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; }
+     IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
+     void SetNull() { hash = 0; n = -1; }
+     bool IsNull() const { return (hash == 0 && n == -1); }
+     friend bool operator<(const COutPoint& a, const COutPoint& b)
+     {
+         return (a.hash < b.hash || (a.hash == b.hash && a.n < b.n));
+     }
+     friend bool operator==(const COutPoint& a, const COutPoint& b)
+     {
+         return (a.hash == b.hash && a.n == b.n);
+     }
+     friend bool operator!=(const COutPoint& a, const COutPoint& b)
+     {
+         return !(a == b);
+     }
+     string ToString() const
+     {
+         return strprintf("COutPoint(%s, %d)", hash.ToString().substr(0,10).c_str(), n);
+     }
+     void print() const
+     {
+         printf("%s\n", ToString().c_str());
+     }
+ };
+ //
+ // An input of a transaction.  It contains the location of the previous
+ // transaction's output that it claims and a signature that matches the
+ // output's public key.
+ //
+ class CTxIn
+ {
+ public:
+     COutPoint prevout;
+     CScript scriptSig;
+     unsigned int nSequence;
+     CTxIn()
+     {
+         nSequence = UINT_MAX;
+     }
+     explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=UINT_MAX)
+     {
+         prevout = prevoutIn;
+         scriptSig = scriptSigIn;
+         nSequence = nSequenceIn;
+     }
+     CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=UINT_MAX)
+     {
+         prevout = COutPoint(hashPrevTx, nOut);
+         scriptSig = scriptSigIn;
+         nSequence = nSequenceIn;
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         READWRITE(prevout);
+         READWRITE(scriptSig);
+         READWRITE(nSequence);
+     )
+     bool IsFinal() const
+     {
+         return (nSequence == UINT_MAX);
+     }
+     friend bool operator==(const CTxIn& a, const CTxIn& b)
+     {
+         return (a.prevout   == b.prevout &&
+                 a.scriptSig == b.scriptSig &&
+                 a.nSequence == b.nSequence);
+     }
+     friend bool operator!=(const CTxIn& a, const CTxIn& b)
+     {
+         return !(a == b);
+     }
+     string ToString() const
+     {
+         string str;
+         str += strprintf("CTxIn(");
+         str += prevout.ToString();
+         if (prevout.IsNull())
+             str += strprintf(", coinbase %s", HexStr(scriptSig).c_str());
+         else
+             str += strprintf(", scriptSig=%s", scriptSig.ToString().substr(0,24).c_str());
+         if (nSequence != UINT_MAX)
+             str += strprintf(", nSequence=%u", nSequence);
+         str += ")";
+         return str;
+     }
+     void print() const
+     {
+         printf("%s\n", ToString().c_str());
+     }
+     bool IsMine() const;
+     int64 GetDebit() const;
+ };
+ //
+ // An output of a transaction.  It contains the public key that the next input
+ // must be able to sign with to claim it.
+ //
+ class CTxOut
+ {
+ public:
+     int64 nValue;
+     CScript scriptPubKey;
+     CTxOut()
+     {
+         SetNull();
+     }
+     CTxOut(int64 nValueIn, CScript scriptPubKeyIn)
+     {
+         nValue = nValueIn;
+         scriptPubKey = scriptPubKeyIn;
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         READWRITE(nValue);
+         READWRITE(scriptPubKey);
+     )
+     void SetNull()
+     {
+         nValue = -1;
+         scriptPubKey.clear();
+     }
+     bool IsNull()
+     {
+         return (nValue == -1);
+     }
+     uint256 GetHash() const
+     {
+         return SerializeHash(*this);
+     }
+     bool IsMine() const
+     {
+         return ::IsMine(scriptPubKey);
+     }
+     int64 GetCredit() const
+     {
+         if (!MoneyRange(nValue))
+             throw runtime_error("CTxOut::GetCredit() : value out of range");
+         return (IsMine() ? nValue : 0);
+     }
+     bool IsChange() const
+     {
+         // On a debit transaction, a txout that's mine but isn't in the address book is change
+         vector<unsigned char> vchPubKey;
+         if (ExtractPubKey(scriptPubKey, true, vchPubKey))
+             CRITICAL_BLOCK(cs_mapAddressBook)
+                 if (!mapAddressBook.count(PubKeyToAddress(vchPubKey)))
+                     return true;
+         return false;
+     }
+     int64 GetChange() const
+     {
+         if (!MoneyRange(nValue))
+             throw runtime_error("CTxOut::GetChange() : value out of range");
+         return (IsChange() ? nValue : 0);
+     }
+     friend bool operator==(const CTxOut& a, const CTxOut& b)
+     {
+         return (a.nValue       == b.nValue &&
+                 a.scriptPubKey == b.scriptPubKey);
+     }
+     friend bool operator!=(const CTxOut& a, const CTxOut& b)
+     {
+         return !(a == b);
+     }
+     string ToString() const
+     {
+         if (scriptPubKey.size() < 6)
+             return "CTxOut(error)";
+         return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str());
+     }
+     void print() const
+     {
+         printf("%s\n", ToString().c_str());
+     }
+ };
+ //
+ // The basic transaction that is broadcasted on the network and contained in
+ // blocks.  A transaction can contain multiple inputs and outputs.
+ //
+ class CTransaction
+ {
+ public:
+     int nVersion;
+     vector<CTxIn> vin;
+     vector<CTxOut> vout;
+     unsigned int nLockTime;
+     CTransaction()
+     {
+         SetNull();
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         READWRITE(this->nVersion);
+         nVersion = this->nVersion;
+         READWRITE(vin);
+         READWRITE(vout);
+         READWRITE(nLockTime);
+     )
+     void SetNull()
+     {
+         nVersion = 1;
+         vin.clear();
+         vout.clear();
+         nLockTime = 0;
+     }
+     bool IsNull() const
+     {
+         return (vin.empty() && vout.empty());
+     }
+     uint256 GetHash() const
+     {
+         return SerializeHash(*this);
+     }
+     bool IsFinal(int nBlockHeight=0, int64 nBlockTime=0) const
+     {
+         // Time based nLockTime implemented in 0.1.6
+         if (nLockTime == 0)
+             return true;
+         if (nBlockHeight == 0)
+             nBlockHeight = nBestHeight;
+         if (nBlockTime == 0)
+             nBlockTime = GetAdjustedTime();
+         if ((int64)nLockTime < (nLockTime < 500000000 ? (int64)nBlockHeight : nBlockTime))
+             return true;
+         foreach(const CTxIn& txin, vin)
+             if (!txin.IsFinal())
+                 return false;
+         return true;
+     }
+     bool IsNewerThan(const CTransaction& old) const
+     {
+         if (vin.size() != old.vin.size())
+             return false;
+         for (int i = 0; i < vin.size(); i++)
+             if (vin[i].prevout != old.vin[i].prevout)
+                 return false;
+         bool fNewer = false;
+         unsigned int nLowest = UINT_MAX;
+         for (int i = 0; i < vin.size(); i++)
+         {
+             if (vin[i].nSequence != old.vin[i].nSequence)
+             {
+                 if (vin[i].nSequence <= nLowest)
+                 {
+                     fNewer = false;
+                     nLowest = vin[i].nSequence;
+                 }
+                 if (old.vin[i].nSequence < nLowest)
+                 {
+                     fNewer = true;
+                     nLowest = old.vin[i].nSequence;
+                 }
+             }
+         }
+         return fNewer;
+     }
+     bool IsCoinBase() const
+     {
+         return (vin.size() == 1 && vin[0].prevout.IsNull());
+     }
+     int GetSigOpCount() const
+     {
+         int n = 0;
+         foreach(const CTxIn& txin, vin)
+             n += txin.scriptSig.GetSigOpCount();
+         foreach(const CTxOut& txout, vout)
+             n += txout.scriptPubKey.GetSigOpCount();
+         return n;
+     }
+     bool IsStandard() const
+     {
+         foreach(const CTxIn& txin, vin)
+             if (!txin.scriptSig.IsPushOnly())
+                 return error("nonstandard txin: %s", txin.scriptSig.ToString().c_str());
+         foreach(const CTxOut& txout, vout)
+             if (!::IsStandard(txout.scriptPubKey))
+                 return error("nonstandard txout: %s", txout.scriptPubKey.ToString().c_str());
+         return true;
+     }
+     bool IsMine() const
+     {
+         foreach(const CTxOut& txout, vout)
+             if (txout.IsMine())
+                 return true;
+         return false;
+     }
+     bool IsFromMe() const
+     {
+         return (GetDebit() > 0);
+     }
+     int64 GetDebit() const
+     {
+         int64 nDebit = 0;
+         foreach(const CTxIn& txin, vin)
+         {
+             nDebit += txin.GetDebit();
+             if (!MoneyRange(nDebit))
+                 throw runtime_error("CTransaction::GetDebit() : value out of range");
+         }
+         return nDebit;
+     }
+     int64 GetCredit() const
+     {
+         int64 nCredit = 0;
+         foreach(const CTxOut& txout, vout)
+         {
+             nCredit += txout.GetCredit();
+             if (!MoneyRange(nCredit))
+                 throw runtime_error("CTransaction::GetCredit() : value out of range");
+         }
+         return nCredit;
+     }
+     int64 GetChange() const
+     {
+         if (IsCoinBase())
+             return 0;
+         int64 nChange = 0;
+         foreach(const CTxOut& txout, vout)
+         {
+             nChange += txout.GetChange();
+             if (!MoneyRange(nChange))
+                 throw runtime_error("CTransaction::GetChange() : value out of range");
+         }
+         return nChange;
+     }
+     int64 GetValueOut() const
+     {
+         int64 nValueOut = 0;
+         foreach(const CTxOut& txout, vout)
+         {
+             nValueOut += txout.nValue;
+             if (!MoneyRange(txout.nValue) || !MoneyRange(nValueOut))
+                 throw runtime_error("CTransaction::GetValueOut() : value out of range");
+         }
+         return nValueOut;
+     }
+     static bool AllowFree(double dPriority)
+     {
+         // Large (in bytes) low-priority (new, small-coin) transactions
+         // need a fee.
+         return dPriority > COIN * 144 / 250;
+     }
+     int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=true) const
+     {
+         // Base fee is 1 cent per kilobyte
+         unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
+         unsigned int nNewBlockSize = nBlockSize + nBytes;
+         int64 nMinFee = (1 + (int64)nBytes / 1000) * CENT;
+         if (fAllowFree)
+         {
+             if (nBlockSize == 1)
+             {
+                 // Transactions under 10K are free
+                 // (about 4500bc if made of 50bc inputs)
+                 if (nBytes < 10000)
+                     nMinFee = 0;
+             }
+             else
+             {
+                 // Free transaction area
+                 if (nNewBlockSize < 27000)
+                     nMinFee = 0;
+             }
+         }
+         // To limit dust spam, require a 0.01 fee if any output is less than 0.01
+         if (nMinFee < CENT)
+             foreach(const CTxOut& txout, vout)
+                 if (txout.nValue < CENT)
+                     nMinFee = CENT;
+         // Raise the price as the block approaches full
+         if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
+         {
+             if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN)
+                 return MAX_MONEY;
+             nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize);
+         }
+         if (!MoneyRange(nMinFee))
+             nMinFee = MAX_MONEY;
+         return nMinFee;
+     }
+     bool ReadFromDisk(CDiskTxPos pos, FILE** pfileRet=NULL)
+     {
+         CAutoFile filein = OpenBlockFile(pos.nFile, 0, pfileRet ? "rb+" : "rb");
+         if (!filein)
+             return error("CTransaction::ReadFromDisk() : OpenBlockFile failed");
+         // Read transaction
+         if (fseek(filein, pos.nTxPos, SEEK_SET) != 0)
+             return error("CTransaction::ReadFromDisk() : fseek failed");
+         filein >> *this;
+         // Return file pointer
+         if (pfileRet)
+         {
+             if (fseek(filein, pos.nTxPos, SEEK_SET) != 0)
+                 return error("CTransaction::ReadFromDisk() : second fseek failed");
+             *pfileRet = filein.release();
+         }
+         return true;
+     }
+     friend bool operator==(const CTransaction& a, const CTransaction& b)
+     {
+         return (a.nVersion  == b.nVersion &&
+                 a.vin       == b.vin &&
+                 a.vout      == b.vout &&
+                 a.nLockTime == b.nLockTime);
+     }
+     friend bool operator!=(const CTransaction& a, const CTransaction& b)
+     {
+         return !(a == b);
+     }
+     string ToString() const
+     {
+         string str;
+         str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%d, vout.size=%d, nLockTime=%d)\n",
+             GetHash().ToString().substr(0,10).c_str(),
+             nVersion,
+             vin.size(),
+             vout.size(),
+             nLockTime);
+         for (int i = 0; i < vin.size(); i++)
+             str += "    " + vin[i].ToString() + "\n";
+         for (int i = 0; i < vout.size(); i++)
+             str += "    " + vout[i].ToString() + "\n";
+         return str;
+     }
+     void print() const
+     {
+         printf("%s", ToString().c_str());
+     }
+     bool ReadFromDisk(CTxDB& txdb, COutPoint prevout, CTxIndex& txindexRet);
+     bool ReadFromDisk(CTxDB& txdb, COutPoint prevout);
+     bool ReadFromDisk(COutPoint prevout);
+     bool DisconnectInputs(CTxDB& txdb);
+     bool ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPool, CDiskTxPos posThisTx,
+                        CBlockIndex* pindexBlock, int64& nFees, bool fBlock, bool fMiner, int64 nMinFee=0);
+     bool ClientConnectInputs();
+     bool CheckTransaction() const;
+     bool AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs=true, bool* pfMissingInputs=NULL);
+     bool AcceptToMemoryPool(bool fCheckInputs=true, bool* pfMissingInputs=NULL)
+     {
+         CTxDB txdb("r");
+         return AcceptToMemoryPool(txdb, fCheckInputs, pfMissingInputs);
+     }
+ protected:
+     bool AddToMemoryPoolUnchecked();
+ public:
+     bool RemoveFromMemoryPool();
+ };
+ //
+ // A transaction with a merkle branch linking it to the block chain
+ //
+ class CMerkleTx : public CTransaction
+ {
+ public:
+     uint256 hashBlock;
+     vector<uint256> vMerkleBranch;
+     int nIndex;
+     // memory only
+     mutable char fMerkleVerified;
+     CMerkleTx()
+     {
+         Init();
+     }
+     CMerkleTx(const CTransaction& txIn) : CTransaction(txIn)
+     {
+         Init();
+     }
+     void Init()
+     {
+         hashBlock = 0;
+         nIndex = -1;
+         fMerkleVerified = false;
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         nSerSize += SerReadWrite(s, *(CTransaction*)this, nType, nVersion, ser_action);
+         nVersion = this->nVersion;
+         READWRITE(hashBlock);
+         READWRITE(vMerkleBranch);
+         READWRITE(nIndex);
+     )
+     int SetMerkleBranch(const CBlock* pblock=NULL);
+     int GetDepthInMainChain(int& nHeightRet) const;
+     int GetDepthInMainChain() const { int nHeight; return GetDepthInMainChain(nHeight); }
+     bool IsInMainChain() const { return GetDepthInMainChain() > 0; }
+     int GetBlocksToMaturity() const;
+     bool AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs=true);
+     bool AcceptToMemoryPool() { CTxDB txdb("r"); return AcceptToMemoryPool(txdb); }
+ };
+ //
+ // A transaction with a bunch of additional info that only the owner cares
+ // about.  It includes any unrecorded transactions needed to link it back
+ // to the block chain.
+ //
+ class CWalletTx : public CMerkleTx
+ {
+ public:
+     vector<CMerkleTx> vtxPrev;
+     map<string, string> mapValue;
+     vector<pair<string, string> > vOrderForm;
+     unsigned int fTimeReceivedIsTxTime;
+     unsigned int nTimeReceived;  // time received by this node
+     char fFromMe;
+     string strFromAccount;
+     vector<char> vfSpent;
+     // memory only
+     mutable char fDebitCached;
+     mutable char fCreditCached;
+     mutable char fAvailableCreditCached;
+     mutable char fChangeCached;
+     mutable int64 nDebitCached;
+     mutable int64 nCreditCached;
+     mutable int64 nAvailableCreditCached;
+     mutable int64 nChangeCached;
+     // memory only UI hints
+     mutable unsigned int nTimeDisplayed;
+     mutable int nLinesDisplayed;
+     mutable char fConfirmedDisplayed;
+     CWalletTx()
+     {
+         Init();
+     }
+     CWalletTx(const CMerkleTx& txIn) : CMerkleTx(txIn)
+     {
+         Init();
+     }
+     CWalletTx(const CTransaction& txIn) : CMerkleTx(txIn)
+     {
+         Init();
+     }
+     void Init()
+     {
+         vtxPrev.clear();
+         mapValue.clear();
+         vOrderForm.clear();
+         fTimeReceivedIsTxTime = false;
+         nTimeReceived = 0;
+         fFromMe = false;
+         strFromAccount.clear();
+         vfSpent.clear();
+         fDebitCached = false;
+         fCreditCached = false;
+         fAvailableCreditCached = false;
+         fChangeCached = false;
+         nDebitCached = 0;
+         nCreditCached = 0;
+         nAvailableCreditCached = 0;
+         nChangeCached = 0;
+         nTimeDisplayed = 0;
+         nLinesDisplayed = 0;
+         fConfirmedDisplayed = false;
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         CWalletTx* pthis = const_cast<CWalletTx*>(this);
+         if (fRead)
+             pthis->Init();
+         char fSpent = false;
+         if (!fRead)
+         {
+             pthis->mapValue["fromaccount"] = pthis->strFromAccount;
+             string str;
+             foreach(char f, vfSpent)
+             {
+                 str += (f ? '1' : '0');
+                 if (f)
+                     fSpent = true;
+             }
+             pthis->mapValue["spent"] = str;
+         }
+         nSerSize += SerReadWrite(s, *(CMerkleTx*)this, nType, nVersion,ser_action);
+         READWRITE(vtxPrev);
+         READWRITE(mapValue);
+         READWRITE(vOrderForm);
+         READWRITE(fTimeReceivedIsTxTime);
+         READWRITE(nTimeReceived);
+         READWRITE(fFromMe);
+         READWRITE(fSpent);
+         if (fRead)
+         {
+             pthis->strFromAccount = pthis->mapValue["fromaccount"];
+             if (mapValue.count("spent"))
+                 foreach(char c, pthis->mapValue["spent"])
+                     pthis->vfSpent.push_back(c != '0');
+             else
+                 pthis->vfSpent.assign(vout.size(), fSpent);
+         }
+         pthis->mapValue.erase("fromaccount");
+         pthis->mapValue.erase("version");
+         pthis->mapValue.erase("spent");
+     )
+     // marks certain txout's as spent
+     // returns true if any update took place
+     bool UpdateSpent(const vector<char>& vfNewSpent)
+     {
+         bool fReturn = false;
+         for (int i=0; i < vfNewSpent.size(); i++)
+         {
+             if (i == vfSpent.size())
+                 break;
+             if (vfNewSpent[i] && !vfSpent[i])
+             {
+                 vfSpent[i] = true;
+                 fReturn = true;
+                 fAvailableCreditCached = false;
+             }
+         }
+         return fReturn;
+     }
+     void MarkDirty()
+     {
+         fCreditCached = false;
+         fAvailableCreditCached = false;
+         fDebitCached = false;
+         fChangeCached = false;
+     }
+     void MarkSpent(unsigned int nOut)
+     {
+         if (nOut >= vout.size())
+             throw runtime_error("CWalletTx::MarkSpent() : nOut out of range");
+         vfSpent.resize(vout.size());
+         if (!vfSpent[nOut])
+         {
+             vfSpent[nOut] = true;
+             fAvailableCreditCached = false;
+         }
+     }
+     bool IsSpent(unsigned int nOut) const
+     {
+         if (nOut >= vout.size())
+             throw runtime_error("CWalletTx::IsSpent() : nOut out of range");
+         if (nOut >= vfSpent.size())
+             return false;
+         return (!!vfSpent[nOut]);
+     }
+     int64 GetDebit() const
+     {
+         if (vin.empty())
+             return 0;
+         if (fDebitCached)
+             return nDebitCached;
+         nDebitCached = CTransaction::GetDebit();
+         fDebitCached = true;
+         return nDebitCached;
+     }
+     int64 GetCredit(bool fUseCache=true) const
+     {
+         // Must wait until coinbase is safely deep enough in the chain before valuing it
+         if (IsCoinBase() && GetBlocksToMaturity() > 0)
+             return 0;
+         // GetBalance can assume transactions in mapWallet won't change
+         if (fUseCache && fCreditCached)
+             return nCreditCached;
+         nCreditCached = CTransaction::GetCredit();
+         fCreditCached = true;
+         return nCreditCached;
+     }
+     int64 GetAvailableCredit(bool fUseCache=true) const
+     {
+         // Must wait until coinbase is safely deep enough in the chain before valuing it
+         if (IsCoinBase() && GetBlocksToMaturity() > 0)
+             return 0;
+         if (fUseCache && fAvailableCreditCached)
+             return nAvailableCreditCached;
+         int64 nCredit = 0;
+         for (int i = 0; i < vout.size(); i++)
+         {
+             if (!IsSpent(i))
+             {
+                 const CTxOut &txout = vout[i];
+                 nCredit += txout.GetCredit();
+                 if (!MoneyRange(nCredit))
+                     throw runtime_error("CWalletTx::GetAvailableCredit() : value out of range");
+             }
+         }
+         nAvailableCreditCached = nCredit;
+         fAvailableCreditCached = true;
+         return nCredit;
+     }
+     int64 GetChange() const
+     {
+         if (fChangeCached)
+             return nChangeCached;
+         nChangeCached = CTransaction::GetChange();
+         fChangeCached = true;
+         return nChangeCached;
+     }
+     void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, list<pair<string /* address */, int64> >& listReceived,
+                     list<pair<string /* address */, int64> >& listSent, int64& nFee, string& strSentAccount) const;
+     void GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived, 
+                            int64& nSent, int64& nFee) const;
+     bool IsFromMe() const
+     {
+         return (GetDebit() > 0);
+     }
+     bool IsConfirmed() const
+     {
+         // Quick answer in most cases
+         if (!IsFinal())
+             return false;
+         if (GetDepthInMainChain() >= 1)
+             return true;
+         if (!IsFromMe()) // using wtx's cached debit
+             return false;
+         // If no confirmations but it's from us, we can still
+         // consider it confirmed if all dependencies are confirmed
+         map<uint256, const CMerkleTx*> mapPrev;
+         vector<const CMerkleTx*> vWorkQueue;
+         vWorkQueue.reserve(vtxPrev.size()+1);
+         vWorkQueue.push_back(this);
+         for (int i = 0; i < vWorkQueue.size(); i++)
+         {
+             const CMerkleTx* ptx = vWorkQueue[i];
+             if (!ptx->IsFinal())
+                 return false;
+             if (ptx->GetDepthInMainChain() >= 1)
++                continue;
+             if (!ptx->IsFromMe())
+                 return false;
+             if (mapPrev.empty())
+                 foreach(const CMerkleTx& tx, vtxPrev)
+                     mapPrev[tx.GetHash()] = &tx;
+             foreach(const CTxIn& txin, ptx->vin)
+             {
+                 if (!mapPrev.count(txin.prevout.hash))
+                     return false;
+                 vWorkQueue.push_back(mapPrev[txin.prevout.hash]);
+             }
+         }
+         return true;
+     }
+     bool WriteToDisk()
+     {
+         return CWalletDB().WriteTx(GetHash(), *this);
+     }
+     int64 GetTxTime() const;
+     int GetRequestCount() const;
+     void AddSupportingTransactions(CTxDB& txdb);
+     bool AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs=true);
+     bool AcceptWalletTransaction() { CTxDB txdb("r"); return AcceptWalletTransaction(txdb); }
+     void RelayWalletTransaction(CTxDB& txdb);
+     void RelayWalletTransaction() { CTxDB txdb("r"); RelayWalletTransaction(txdb); }
+ };
+ //
+ // A txdb record that contains the disk location of a transaction and the
+ // locations of transactions that spend its outputs.  vSpent is really only
+ // used as a flag, but having the location is very helpful for debugging.
+ //
+ class CTxIndex
+ {
+ public:
+     CDiskTxPos pos;
+     vector<CDiskTxPos> vSpent;
+     CTxIndex()
+     {
+         SetNull();
+     }
+     CTxIndex(const CDiskTxPos& posIn, unsigned int nOutputs)
+     {
+         pos = posIn;
+         vSpent.resize(nOutputs);
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         if (!(nType & SER_GETHASH))
+             READWRITE(nVersion);
+         READWRITE(pos);
+         READWRITE(vSpent);
+     )
+     void SetNull()
+     {
+         pos.SetNull();
+         vSpent.clear();
+     }
+     bool IsNull()
+     {
+         return pos.IsNull();
+     }
+     friend bool operator==(const CTxIndex& a, const CTxIndex& b)
+     {
+         return (a.pos    == b.pos &&
+                 a.vSpent == b.vSpent);
+     }
+     friend bool operator!=(const CTxIndex& a, const CTxIndex& b)
+     {
+         return !(a == b);
+     }
+     int GetDepthInMainChain() const;
+ };
+ //
+ // Nodes collect new transactions into a block, hash them into a hash tree,
+ // and scan through nonce values to make the block's hash satisfy proof-of-work
+ // requirements.  When they solve the proof-of-work, they broadcast the block
+ // to everyone and the block is added to the block chain.  The first transaction
+ // in the block is a special one that creates a new coin owned by the creator
+ // of the block.
+ //
+ // Blocks are appended to blk0001.dat files on disk.  Their location on disk
+ // is indexed by CBlockIndex objects in memory.
+ //
+ class CBlock
+ {
+ public:
+     // header
+     int nVersion;
+     uint256 hashPrevBlock;
+     uint256 hashMerkleRoot;
+     unsigned int nTime;
+     unsigned int nBits;
+     unsigned int nNonce;
+     // network and disk
+     vector<CTransaction> vtx;
+     // memory only
+     mutable vector<uint256> vMerkleTree;
+     CBlock()
+     {
+         SetNull();
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         READWRITE(this->nVersion);
+         nVersion = this->nVersion;
+         READWRITE(hashPrevBlock);
+         READWRITE(hashMerkleRoot);
+         READWRITE(nTime);
+         READWRITE(nBits);
+         READWRITE(nNonce);
+         // ConnectBlock depends on vtx being last so it can calculate offset
+         if (!(nType & (SER_GETHASH|SER_BLOCKHEADERONLY)))
+             READWRITE(vtx);
+         else if (fRead)
+             const_cast<CBlock*>(this)->vtx.clear();
+     )
+     void SetNull()
+     {
+         nVersion = 1;
+         hashPrevBlock = 0;
+         hashMerkleRoot = 0;
+         nTime = 0;
+         nBits = 0;
+         nNonce = 0;
+         vtx.clear();
+         vMerkleTree.clear();
+     }
+     bool IsNull() const
+     {
+         return (nBits == 0);
+     }
+     uint256 GetHash() const
+     {
+         return Hash(BEGIN(nVersion), END(nNonce));
+     }
+     int64 GetBlockTime() const
+     {
+         return (int64)nTime;
+     }
+     int GetSigOpCount() const
+     {
+         int n = 0;
+         foreach(const CTransaction& tx, vtx)
+             n += tx.GetSigOpCount();
+         return n;
+     }
+     uint256 BuildMerkleTree() const
+     {
+         vMerkleTree.clear();
+         foreach(const CTransaction& tx, vtx)
+             vMerkleTree.push_back(tx.GetHash());
+         int j = 0;
+         for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+         {
+             for (int i = 0; i < nSize; i += 2)
+             {
+                 int i2 = min(i+1, nSize-1);
+                 vMerkleTree.push_back(Hash(BEGIN(vMerkleTree[j+i]),  END(vMerkleTree[j+i]),
+                                            BEGIN(vMerkleTree[j+i2]), END(vMerkleTree[j+i2])));
+             }
+             j += nSize;
+         }
+         return (vMerkleTree.empty() ? 0 : vMerkleTree.back());
+     }
+     vector<uint256> GetMerkleBranch(int nIndex) const
+     {
+         if (vMerkleTree.empty())
+             BuildMerkleTree();
+         vector<uint256> vMerkleBranch;
+         int j = 0;
+         for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+         {
+             int i = min(nIndex^1, nSize-1);
+             vMerkleBranch.push_back(vMerkleTree[j+i]);
+             nIndex >>= 1;
+             j += nSize;
+         }
+         return vMerkleBranch;
+     }
+     static uint256 CheckMerkleBranch(uint256 hash, const vector<uint256>& vMerkleBranch, int nIndex)
+     {
+         if (nIndex == -1)
+             return 0;
+         foreach(const uint256& otherside, vMerkleBranch)
+         {
+             if (nIndex & 1)
+                 hash = Hash(BEGIN(otherside), END(otherside), BEGIN(hash), END(hash));
+             else
+                 hash = Hash(BEGIN(hash), END(hash), BEGIN(otherside), END(otherside));
+             nIndex >>= 1;
+         }
+         return hash;
+     }
+     bool WriteToDisk(unsigned int& nFileRet, unsigned int& nBlockPosRet)
+     {
+         // Open history file to append
+         CAutoFile fileout = AppendBlockFile(nFileRet);
+         if (!fileout)
+             return error("CBlock::WriteToDisk() : AppendBlockFile failed");
+         // Write index header
+         unsigned int nSize = fileout.GetSerializeSize(*this);
+         fileout << FLATDATA(pchMessageStart) << nSize;
+         // Write block
+         nBlockPosRet = ftell(fileout);
+         if (nBlockPosRet == -1)
+             return error("CBlock::WriteToDisk() : ftell failed");
+         fileout << *this;
+         // Flush stdio buffers and commit to disk before returning
+         fflush(fileout);
+         if (!IsInitialBlockDownload() || (nBestHeight+1) % 500 == 0)
+         {
+ #ifdef __WXMSW__
+             _commit(_fileno(fileout));
+ #else
+             fsync(fileno(fileout));
+ #endif
+         }
+         return true;
+     }
+     bool ReadFromDisk(unsigned int nFile, unsigned int nBlockPos, bool fReadTransactions=true)
+     {
+         SetNull();
+         // Open history file to read
+         CAutoFile filein = OpenBlockFile(nFile, nBlockPos, "rb");
+         if (!filein)
+             return error("CBlock::ReadFromDisk() : OpenBlockFile failed");
+         if (!fReadTransactions)
+             filein.nType |= SER_BLOCKHEADERONLY;
+         // Read block
+         filein >> *this;
+         // Check the header
+         if (!CheckProofOfWork(GetHash(), nBits))
+             return error("CBlock::ReadFromDisk() : errors in block header");
+         return true;
+     }
+     void print() const
+     {
+         printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%d)\n",
+             GetHash().ToString().substr(0,20).c_str(),
+             nVersion,
+             hashPrevBlock.ToString().substr(0,20).c_str(),
+             hashMerkleRoot.ToString().substr(0,10).c_str(),
+             nTime, nBits, nNonce,
+             vtx.size());
+         for (int i = 0; i < vtx.size(); i++)
+         {
+             printf("  ");
+             vtx[i].print();
+         }
+         printf("  vMerkleTree: ");
+         for (int i = 0; i < vMerkleTree.size(); i++)
+             printf("%s ", vMerkleTree[i].ToString().substr(0,10).c_str());
+         printf("\n");
+     }
+     bool DisconnectBlock(CTxDB& txdb, CBlockIndex* pindex);
+     bool ConnectBlock(CTxDB& txdb, CBlockIndex* pindex);
+     bool ReadFromDisk(const CBlockIndex* pindex, bool fReadTransactions=true);
+     bool SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew);
+     bool AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos);
+     bool CheckBlock() const;
+     bool AcceptBlock();
+ };
+ //
+ // The block chain is a tree shaped structure starting with the
+ // genesis block at the root, with each block potentially having multiple
+ // candidates to be the next block.  pprev and pnext link a path through the
+ // main/longest chain.  A blockindex may have multiple pprev pointing back
+ // to it, but pnext will only point forward to the longest branch, or will
+ // be null if the block is not part of the longest chain.
+ //
+ class CBlockIndex
+ {
+ public:
+     const uint256* phashBlock;
+     CBlockIndex* pprev;
+     CBlockIndex* pnext;
+     unsigned int nFile;
+     unsigned int nBlockPos;
+     int nHeight;
+     CBigNum bnChainWork;
+     // block header
+     int nVersion;
+     uint256 hashMerkleRoot;
+     unsigned int nTime;
+     unsigned int nBits;
+     unsigned int nNonce;
+     CBlockIndex()
+     {
+         phashBlock = NULL;
+         pprev = NULL;
+         pnext = NULL;
+         nFile = 0;
+         nBlockPos = 0;
+         nHeight = 0;
+         bnChainWork = 0;
+         nVersion       = 0;
+         hashMerkleRoot = 0;
+         nTime          = 0;
+         nBits          = 0;
+         nNonce         = 0;
+     }
+     CBlockIndex(unsigned int nFileIn, unsigned int nBlockPosIn, CBlock& block)
+     {
+         phashBlock = NULL;
+         pprev = NULL;
+         pnext = NULL;
+         nFile = nFileIn;
+         nBlockPos = nBlockPosIn;
+         nHeight = 0;
+         bnChainWork = 0;
+         nVersion       = block.nVersion;
+         hashMerkleRoot = block.hashMerkleRoot;
+         nTime          = block.nTime;
+         nBits          = block.nBits;
+         nNonce         = block.nNonce;
+     }
+     CBlock GetBlockHeader() const
+     {
+         CBlock block;
+         block.nVersion       = nVersion;
+         if (pprev)
+             block.hashPrevBlock = pprev->GetBlockHash();
+         block.hashMerkleRoot = hashMerkleRoot;
+         block.nTime          = nTime;
+         block.nBits          = nBits;
+         block.nNonce         = nNonce;
+         return block;
+     }
+     uint256 GetBlockHash() const
+     {
+         return *phashBlock;
+     }
+     int64 GetBlockTime() const
+     {
+         return (int64)nTime;
+     }
+     CBigNum GetBlockWork() const
+     {
+         CBigNum bnTarget;
+         bnTarget.SetCompact(nBits);
+         if (bnTarget <= 0)
+             return 0;
+         return (CBigNum(1)<<256) / (bnTarget+1);
+     }
+     bool IsInMainChain() const
+     {
+         return (pnext || this == pindexBest);
+     }
+     bool CheckIndex() const
+     {
+         return CheckProofOfWork(GetBlockHash(), nBits);
+     }
+     bool EraseBlockFromDisk()
+     {
+         // Open history file
+         CAutoFile fileout = OpenBlockFile(nFile, nBlockPos, "rb+");
+         if (!fileout)
+             return false;
+         // Overwrite with empty null block
+         CBlock block;
+         block.SetNull();
+         fileout << block;
+         return true;
+     }
+     enum { nMedianTimeSpan=11 };
+     int64 GetMedianTimePast() const
+     {
+         int64 pmedian[nMedianTimeSpan];
+         int64* pbegin = &pmedian[nMedianTimeSpan];
+         int64* pend = &pmedian[nMedianTimeSpan];
+         const CBlockIndex* pindex = this;
+         for (int i = 0; i < nMedianTimeSpan && pindex; i++, pindex = pindex->pprev)
+             *(--pbegin) = pindex->GetBlockTime();
+         sort(pbegin, pend);
+         return pbegin[(pend - pbegin)/2];
+     }
+     int64 GetMedianTime() const
+     {
+         const CBlockIndex* pindex = this;
+         for (int i = 0; i < nMedianTimeSpan/2; i++)
+         {
+             if (!pindex->pnext)
+                 return GetBlockTime();
+             pindex = pindex->pnext;
+         }
+         return pindex->GetMedianTimePast();
+     }
+     string ToString() const
+     {
+         return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nHeight=%d, merkle=%s, hashBlock=%s)",
+             pprev, pnext, nFile, nBlockPos, nHeight,
+             hashMerkleRoot.ToString().substr(0,10).c_str(),
+             GetBlockHash().ToString().substr(0,20).c_str());
+     }
+     void print() const
+     {
+         printf("%s\n", ToString().c_str());
+     }
+ };
+ //
+ // Used to marshal pointers into hashes for db storage.
+ //
+ class CDiskBlockIndex : public CBlockIndex
+ {
+ public:
+     uint256 hashPrev;
+     uint256 hashNext;
+     CDiskBlockIndex()
+     {
+         hashPrev = 0;
+         hashNext = 0;
+     }
+     explicit CDiskBlockIndex(CBlockIndex* pindex) : CBlockIndex(*pindex)
+     {
+         hashPrev = (pprev ? pprev->GetBlockHash() : 0);
+         hashNext = (pnext ? pnext->GetBlockHash() : 0);
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         if (!(nType & SER_GETHASH))
+             READWRITE(nVersion);
+         READWRITE(hashNext);
+         READWRITE(nFile);
+         READWRITE(nBlockPos);
+         READWRITE(nHeight);
+         // block header
+         READWRITE(this->nVersion);
+         READWRITE(hashPrev);
+         READWRITE(hashMerkleRoot);
+         READWRITE(nTime);
+         READWRITE(nBits);
+         READWRITE(nNonce);
+     )
+     uint256 GetBlockHash() const
+     {
+         CBlock block;
+         block.nVersion        = nVersion;
+         block.hashPrevBlock   = hashPrev;
+         block.hashMerkleRoot  = hashMerkleRoot;
+         block.nTime           = nTime;
+         block.nBits           = nBits;
+         block.nNonce          = nNonce;
+         return block.GetHash();
+     }
+     string ToString() const
+     {
+         string str = "CDiskBlockIndex(";
+         str += CBlockIndex::ToString();
+         str += strprintf("\n                hashBlock=%s, hashPrev=%s, hashNext=%s)",
+             GetBlockHash().ToString().c_str(),
+             hashPrev.ToString().substr(0,20).c_str(),
+             hashNext.ToString().substr(0,20).c_str());
+         return str;
+     }
+     void print() const
+     {
+         printf("%s\n", ToString().c_str());
+     }
+ };
+ //
+ // Describes a place in the block chain to another node such that if the
+ // other node doesn't have the same branch, it can find a recent common trunk.
+ // The further back it is, the further before the fork it may be.
+ //
+ class CBlockLocator
+ {
+ protected:
+     vector<uint256> vHave;
+ public:
+     CBlockLocator()
+     {
+     }
+     explicit CBlockLocator(const CBlockIndex* pindex)
+     {
+         Set(pindex);
+     }
+     explicit CBlockLocator(uint256 hashBlock)
+     {
+         map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
+         if (mi != mapBlockIndex.end())
+             Set((*mi).second);
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         if (!(nType & SER_GETHASH))
+             READWRITE(nVersion);
+         READWRITE(vHave);
+     )
+     void SetNull()
+     {
+         vHave.clear();
+     }
+     bool IsNull()
+     {
+         return vHave.empty();
+     }
+     void Set(const CBlockIndex* pindex)
+     {
+         vHave.clear();
+         int nStep = 1;
+         while (pindex)
+         {
+             vHave.push_back(pindex->GetBlockHash());
+             // Exponentially larger steps back
+             for (int i = 0; pindex && i < nStep; i++)
+                 pindex = pindex->pprev;
+             if (vHave.size() > 10)
+                 nStep *= 2;
+         }
+         vHave.push_back(hashGenesisBlock);
+     }
+     int GetDistanceBack()
+     {
+         // Retrace how far back it was in the sender's branch
+         int nDistance = 0;
+         int nStep = 1;
+         foreach(const uint256& hash, vHave)
+         {
+             map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
+             if (mi != mapBlockIndex.end())
+             {
+                 CBlockIndex* pindex = (*mi).second;
+                 if (pindex->IsInMainChain())
+                     return nDistance;
+             }
+             nDistance += nStep;
+             if (nDistance > 10)
+                 nStep *= 2;
+         }
+         return nDistance;
+     }
+     CBlockIndex* GetBlockIndex()
+     {
+         // Find the first block the caller has in the main chain
+         foreach(const uint256& hash, vHave)
+         {
+             map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
+             if (mi != mapBlockIndex.end())
+             {
+                 CBlockIndex* pindex = (*mi).second;
+                 if (pindex->IsInMainChain())
+                     return pindex;
+             }
+         }
+         return pindexGenesisBlock;
+     }
+     uint256 GetBlockHash()
+     {
+         // Find the first block the caller has in the main chain
+         foreach(const uint256& hash, vHave)
+         {
+             map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
+             if (mi != mapBlockIndex.end())
+             {
+                 CBlockIndex* pindex = (*mi).second;
+                 if (pindex->IsInMainChain())
+                     return hash;
+             }
+         }
+         return hashGenesisBlock;
+     }
+     int GetHeight()
+     {
+         CBlockIndex* pindex = GetBlockIndex();
+         if (!pindex)
+             return 0;
+         return pindex->nHeight;
+     }
+ };
+ //
+ // Private key that includes an expiration date in case it never gets used.
+ //
+ class CWalletKey
+ {
+ public:
+     CPrivKey vchPrivKey;
+     int64 nTimeCreated;
+     int64 nTimeExpires;
+     string strComment;
+     //// todo: add something to note what created it (user, getnewaddress, change)
+     ////   maybe should have a map<string, string> property map
+     CWalletKey(int64 nExpires=0)
+     {
+         nTimeCreated = (nExpires ? GetTime() : 0);
+         nTimeExpires = nExpires;
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         if (!(nType & SER_GETHASH))
+             READWRITE(nVersion);
+         READWRITE(vchPrivKey);
+         READWRITE(nTimeCreated);
+         READWRITE(nTimeExpires);
+         READWRITE(strComment);
+     )
+ };
+ //
+ // Account information.
+ // Stored in wallet with key "acc"+string account name
+ //
+ class CAccount
+ {
+ public:
+     vector<unsigned char> vchPubKey;
+     CAccount()
+     {
+         SetNull();
+     }
+     void SetNull()
+     {
+         vchPubKey.clear();
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         if (!(nType & SER_GETHASH))
+             READWRITE(nVersion);
+         READWRITE(vchPubKey);
+     )
+ };
+ //
+ // Internal transfers.
+ // Database key is acentry<account><counter>
+ //
+ class CAccountingEntry
+ {
+ public:
+     string strAccount;
+     int64 nCreditDebit;
+     int64 nTime;
+     string strOtherAccount;
+     string strComment;
+     CAccountingEntry()
+     {
+         SetNull();
+     }
+     void SetNull()
+     {
+         nCreditDebit = 0;
+         nTime = 0;
+         strAccount.clear();
+         strOtherAccount.clear();
+         strComment.clear();
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         if (!(nType & SER_GETHASH))
+             READWRITE(nVersion);
+         // Note: strAccount is serialized as part of the key, not here.
+         READWRITE(nCreditDebit);
+         READWRITE(nTime);
+         READWRITE(strOtherAccount);
+         READWRITE(strComment);
+     )
+ };
+ //
+ // Alerts are for notifying old versions if they become too obsolete and
+ // need to upgrade.  The message is displayed in the status bar.
+ // Alert messages are broadcast as a vector of signed data.  Unserializing may
+ // not read the entire buffer if the alert is for a newer version, but older
+ // versions can still relay the original data.
+ //
+ class CUnsignedAlert
+ {
+ public:
+     int nVersion;
+     int64 nRelayUntil;      // when newer nodes stop relaying to newer nodes
+     int64 nExpiration;
+     int nID;
+     int nCancel;
+     set<int> setCancel;
+     int nMinVer;            // lowest version inclusive
+     int nMaxVer;            // highest version inclusive
+     set<string> setSubVer;  // empty matches all
+     int nPriority;
+     // Actions
+     string strComment;
+     string strStatusBar;
+     string strReserved;
+     IMPLEMENT_SERIALIZE
+     (
+         READWRITE(this->nVersion);
+         nVersion = this->nVersion;
+         READWRITE(nRelayUntil);
+         READWRITE(nExpiration);
+         READWRITE(nID);
+         READWRITE(nCancel);
+         READWRITE(setCancel);
+         READWRITE(nMinVer);
+         READWRITE(nMaxVer);
+         READWRITE(setSubVer);
+         READWRITE(nPriority);
+         READWRITE(strComment);
+         READWRITE(strStatusBar);
+         READWRITE(strReserved);
+     )
+     void SetNull()
+     {
+         nVersion = 1;
+         nRelayUntil = 0;
+         nExpiration = 0;
+         nID = 0;
+         nCancel = 0;
+         setCancel.clear();
+         nMinVer = 0;
+         nMaxVer = 0;
+         setSubVer.clear();
+         nPriority = 0;
+         strComment.clear();
+         strStatusBar.clear();
+         strReserved.clear();
+     }
+     string ToString() const
+     {
+         string strSetCancel;
+         foreach(int n, setCancel)
+             strSetCancel += strprintf("%d ", n);
+         string strSetSubVer;
+         foreach(string str, setSubVer)
+             strSetSubVer += "\"" + str + "\" ";
+         return strprintf(
+                 "CAlert(\n"
+                 "    nVersion     = %d\n"
+                 "    nRelayUntil  = %"PRI64d"\n"
+                 "    nExpiration  = %"PRI64d"\n"
+                 "    nID          = %d\n"
+                 "    nCancel      = %d\n"
+                 "    setCancel    = %s\n"
+                 "    nMinVer      = %d\n"
+                 "    nMaxVer      = %d\n"
+                 "    setSubVer    = %s\n"
+                 "    nPriority    = %d\n"
+                 "    strComment   = \"%s\"\n"
+                 "    strStatusBar = \"%s\"\n"
+                 ")\n",
+             nVersion,
+             nRelayUntil,
+             nExpiration,
+             nID,
+             nCancel,
+             strSetCancel.c_str(),
+             nMinVer,
+             nMaxVer,
+             strSetSubVer.c_str(),
+             nPriority,
+             strComment.c_str(),
+             strStatusBar.c_str());
+     }
+     void print() const
+     {
+         printf("%s", ToString().c_str());
+     }
+ };
+ class CAlert : public CUnsignedAlert
+ {
+ public:
+     vector<unsigned char> vchMsg;
+     vector<unsigned char> vchSig;
+     CAlert()
+     {
+         SetNull();
+     }
+     IMPLEMENT_SERIALIZE
+     (
+         READWRITE(vchMsg);
+         READWRITE(vchSig);
+     )
+     void SetNull()
+     {
+         CUnsignedAlert::SetNull();
+         vchMsg.clear();
+         vchSig.clear();
+     }
+     bool IsNull() const
+     {
+         return (nExpiration == 0);
+     }
+     uint256 GetHash() const
+     {
+         return SerializeHash(*this);
+     }
+     bool IsInEffect() const
+     {
+         return (GetAdjustedTime() < nExpiration);
+     }
+     bool Cancels(const CAlert& alert) const
+     {
+         if (!IsInEffect())
+             return false; // this was a no-op before 31403
+         return (alert.nID <= nCancel || setCancel.count(alert.nID));
+     }
+     bool AppliesTo(int nVersion, string strSubVerIn) const
+     {
+         return (IsInEffect() &&
+                 nMinVer <= nVersion && nVersion <= nMaxVer &&
+                 (setSubVer.empty() || setSubVer.count(strSubVerIn)));
+     }
+     bool AppliesToMe() const
+     {
+         return AppliesTo(VERSION, ::pszSubVer);
+     }
+     bool RelayTo(CNode* pnode) const
+     {
+         if (!IsInEffect())
+             return false;
+         // returns true if wasn't already contained in the set
+         if (pnode->setKnown.insert(GetHash()).second)
+         {
+             if (AppliesTo(pnode->nVersion, pnode->strSubVer) ||
+                 AppliesToMe() ||
+                 GetAdjustedTime() < nRelayUntil)
+             {
+                 pnode->PushMessage("alert", *this);
+                 return true;
+             }
+         }
+         return false;
+     }
+     bool CheckSignature()
+     {
+         CKey key;
+         if (!key.SetPubKey(ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284")))
+             return error("CAlert::CheckSignature() : SetPubKey failed");
+         if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
+             return error("CAlert::CheckSignature() : verify signature failed");
+         // Now unserialize the data
+         CDataStream sMsg(vchMsg);
+         sMsg >> *(CUnsignedAlert*)this;
+         return true;
+     }
+     bool ProcessAlert();
+ };
+ extern map<uint256, CTransaction> mapTransactions;
+ extern map<uint256, CWalletTx> mapWallet;
+ extern vector<uint256> vWalletUpdated;
+ extern CCriticalSection cs_mapWallet;
+ extern map<vector<unsigned char>, CPrivKey> mapKeys;
+ extern map<uint160, vector<unsigned char> > mapPubKeys;
+ extern CCriticalSection cs_mapKeys;
+ extern CKey keyUser;
index 0000000000000000000000000000000000000000,61b925e3bc6d321868898a8d9730526f0a8b01b6..4f2da37894e3f5ac9e9e304799243d4793da3dde
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,85 +1,83 @@@
 -   -l dl
+ # Copyright (c) 2009-2010 Satoshi Nakamoto
+ # Distributed under the MIT/X11 software license, see the accompanying
+ # file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ CXX=g++
+ WXINCLUDEPATHS=$(shell wx-config --cxxflags)
+ WXLIBS=$(shell wx-config --libs)
+ USE_UPNP:=0
+ DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
+ # for boost 1.37, add -mt to the boost libraries
+ LIBS= \
+  -Wl,-Bstatic \
+    -l boost_system \
+    -l boost_filesystem \
+    -l boost_program_options \
+    -l boost_thread \
+    -l db_cxx \
+    -l ssl \
+    -l crypto
+ ifdef USE_UPNP
+       LIBS += -l miniupnpc
+       DEFS += -DUSE_UPNP=$(USE_UPNP)
+ endif
+ LIBS+= \
+  -Wl,-Bdynamic \
+    -l gthread-2.0 \
+    -l z \
 -obj/sha256.o: sha256.cpp
 -      $(CXX) -c $(CXXFLAGS) -msse2 -O3 -march=amdfam10 -o $@ $<
 -
 -bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha256.o
++   -l dl \
++   -l pthread
+ DEBUGFLAGS=-g -D__WXDEBUG__
+ CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS)
+ HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
+     script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
+ OBJS= \
+     obj/util.o \
+     obj/script.o \
+     obj/db.o \
+     obj/net.o \
+     obj/irc.o \
+     obj/main.o \
+     obj/rpc.o \
+     obj/init.o \
+     cryptopp/obj/sha.o \
+     cryptopp/obj/cpu.o
+ all: bitcoin
+ obj/%.o: %.cpp $(HEADERS)
+       $(CXX) -c $(CXXFLAGS) $(WXINCLUDEPATHS) -DGUI -o $@ $<
+ cryptopp/obj/%.o: cryptopp/%.cpp
+       $(CXX) -c $(CXXFLAGS) -O3 -o $@ $<
 -bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha256.o
++bitcoin: $(OBJS) obj/ui.o obj/uibase.o
+       $(CXX) $(CXXFLAGS) -o $@ $^ $(WXLIBS) $(LIBS)
+ obj/nogui/%.o: %.cpp $(HEADERS)
+       $(CXX) -c $(CXXFLAGS) -o $@ $<
++bitcoind: $(OBJS:obj/%=obj/nogui/%)
+       $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
+ clean:
+       -rm -f obj/*.o
+       -rm -f obj/nogui/*.o
+       -rm -f cryptopp/obj/*.o
+       -rm -f headers.h.gch
+       -rm -f bitcoin
+       -rm -f bitcoind
diff --cc src/rpc.cpp
index 0000000000000000000000000000000000000000,90e7f15a9164c945d619f5286636c40c56ea0ca6..d6a92b3463a760418654025836a38de48ecba238
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,2184 +1,2190 @@@
 -            "listtransactions [account] [count=10]\n"
 -            "Returns up to [count] most recent transactions for account <account>.");
+ // Copyright (c) 2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ #include "headers.h"
+ #include "cryptopp/sha.h"
+ #undef printf
+ #include <boost/asio.hpp>
+ #include <boost/iostreams/concepts.hpp>
+ #include <boost/iostreams/stream.hpp>
+ #ifdef USE_SSL
+ #include <boost/asio/ssl.hpp> 
+ typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
+ #endif
+ #include "json/json_spirit_reader_template.h"
+ #include "json/json_spirit_writer_template.h"
+ #include "json/json_spirit_utils.h"
+ #define printf OutputDebugStringF
+ // MinGW 3.4.5 gets "fatal error: had to relocate PCH" if the json headers are
+ // precompiled in headers.h.  The problem might be when the pch file goes over
+ // a certain size around 145MB.  If we need access to json_spirit outside this
+ // file, we could use the compiled json_spirit option.
+ using namespace boost::asio;
+ using namespace json_spirit;
+ void ThreadRPCServer2(void* parg);
+ typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
+ extern map<string, rpcfn_type> mapCallTable;
+ Object JSONRPCError(int code, const string& message)
+ {
+     Object error;
+     error.push_back(Pair("code", code));
+     error.push_back(Pair("message", message));
+     return error;
+ }
+ void PrintConsole(const char* format, ...)
+ {
+     char buffer[50000];
+     int limit = sizeof(buffer);
+     va_list arg_ptr;
+     va_start(arg_ptr, format);
+     int ret = _vsnprintf(buffer, limit, format, arg_ptr);
+     va_end(arg_ptr);
+     if (ret < 0 || ret >= limit)
+     {
+         ret = limit - 1;
+         buffer[limit-1] = 0;
+     }
+     printf("%s", buffer);
+ #if defined(__WXMSW__) && defined(GUI)
+     MyMessageBox(buffer, "Bitcoin", wxOK | wxICON_EXCLAMATION);
+ #else
+     fprintf(stdout, "%s", buffer);
+ #endif
+ }
+ int64 AmountFromValue(const Value& value)
+ {
+     double dAmount = value.get_real();
+     if (dAmount <= 0.0 || dAmount > 21000000.0)
+         throw JSONRPCError(-3, "Invalid amount");
+     int64 nAmount = roundint64(dAmount * COIN);
+     if (!MoneyRange(nAmount))
+         throw JSONRPCError(-3, "Invalid amount");
+     return nAmount;
+ }
+ Value ValueFromAmount(int64 amount)
+ {
+     return (double)amount / (double)COIN;
+ }
+ void WalletTxToJSON(const CWalletTx& wtx, Object& entry)
+ {
+     entry.push_back(Pair("confirmations", wtx.GetDepthInMainChain()));
+     entry.push_back(Pair("txid", wtx.GetHash().GetHex()));
+     entry.push_back(Pair("time", (boost::int64_t)wtx.GetTxTime()));
+     foreach(const PAIRTYPE(string,string)& item, wtx.mapValue)
+         entry.push_back(Pair(item.first, item.second));
+ }
+ string AccountFromValue(const Value& value)
+ {
+     string strAccount = value.get_str();
+     if (strAccount == "*")
+         throw JSONRPCError(-11, "Invalid account name");
+     return strAccount;
+ }
+ ///
+ /// Note: This interface may still be subject to change.
+ ///
+ Value help(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() > 1)
+         throw runtime_error(
+             "help [command]\n"
+             "List commands, or get help for a command.");
+     string strCommand;
+     if (params.size() > 0)
+         strCommand = params[0].get_str();
+     string strRet;
+     set<rpcfn_type> setDone;
+     for (map<string, rpcfn_type>::iterator mi = mapCallTable.begin(); mi != mapCallTable.end(); ++mi)
+     {
+         string strMethod = (*mi).first;
+         // We already filter duplicates, but these deprecated screw up the sort order
+         if (strMethod == "getamountreceived" ||
+             strMethod == "getallreceived" ||
+             (strMethod.find("label") != string::npos))
+             continue;
+         if (strCommand != "" && strMethod != strCommand)
+             continue;
+         try
+         {
+             Array params;
+             rpcfn_type pfn = (*mi).second;
+             if (setDone.insert(pfn).second)
+                 (*pfn)(params, true);
+         }
+         catch (std::exception& e)
+         {
+             // Help text is returned in an exception
+             string strHelp = string(e.what());
+             if (strCommand == "")
+                 if (strHelp.find('\n') != -1)
+                     strHelp = strHelp.substr(0, strHelp.find('\n'));
+             strRet += strHelp + "\n";
+         }
+     }
+     if (strRet == "")
+         strRet = strprintf("help: unknown command: %s\n", strCommand.c_str());
+     strRet = strRet.substr(0,strRet.size()-1);
+     return strRet;
+ }
+ Value stop(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "stop\n"
+             "Stop bitcoin server.");
+     // Shutdown will take long enough that the response should get back
+     CreateThread(Shutdown, NULL);
+     return "bitcoin server stopping";
+ }
+ Value getblockcount(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "getblockcount\n"
+             "Returns the number of blocks in the longest block chain.");
+     return nBestHeight;
+ }
+ Value getblocknumber(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "getblocknumber\n"
+             "Returns the block number of the latest block in the longest block chain.");
+     return nBestHeight;
+ }
+ Value getconnectioncount(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "getconnectioncount\n"
+             "Returns the number of connections to other nodes.");
+     return (int)vNodes.size();
+ }
+ double GetDifficulty()
+ {
+     // Floating point number that is a multiple of the minimum difficulty,
+     // minimum difficulty = 1.0.
+     if (pindexBest == NULL)
+         return 1.0;
+     int nShift = 256 - 32 - 31; // to fit in a uint
+     double dMinimum = (CBigNum().SetCompact(bnProofOfWorkLimit.GetCompact()) >> nShift).getuint();
+     double dCurrently = (CBigNum().SetCompact(pindexBest->nBits) >> nShift).getuint();
+     return dMinimum / dCurrently;
+ }
+ Value getdifficulty(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "getdifficulty\n"
+             "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.");
+     return GetDifficulty();
+ }
+ Value getgenerate(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "getgenerate\n"
+             "Returns true or false.");
+     return (bool)fGenerateBitcoins;
+ }
+ Value setgenerate(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 1 || params.size() > 2)
+         throw runtime_error(
+             "setgenerate <generate> [genproclimit]\n"
+             "<generate> is true or false to turn generation on or off.\n"
+             "Generation is limited to [genproclimit] processors, -1 is unlimited.");
+     bool fGenerate = true;
+     if (params.size() > 0)
+         fGenerate = params[0].get_bool();
+     if (params.size() > 1)
+     {
+         int nGenProcLimit = params[1].get_int();
+         fLimitProcessors = (nGenProcLimit != -1);
+         CWalletDB().WriteSetting("fLimitProcessors", fLimitProcessors);
+         if (nGenProcLimit != -1)
+             CWalletDB().WriteSetting("nLimitProcessors", nLimitProcessors = nGenProcLimit);
+         if (nGenProcLimit == 0)
+             fGenerate = false;
+     }
+     GenerateBitcoins(fGenerate);
+     return Value::null;
+ }
+ Value gethashespersec(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "gethashespersec\n"
+             "Returns a recent hashes per second performance measurement while generating.");
+     if (GetTimeMillis() - nHPSTimerStart > 8000)
+         return (boost::int64_t)0;
+     return (boost::int64_t)dHashesPerSec;
+ }
+ Value getinfo(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 0)
+         throw runtime_error(
+             "getinfo\n"
+             "Returns an object containing various state info.");
+     Object obj;
+     obj.push_back(Pair("version",       (int)VERSION));
+     obj.push_back(Pair("balance",       ValueFromAmount(GetBalance())));
+     obj.push_back(Pair("blocks",        (int)nBestHeight));
+     obj.push_back(Pair("connections",   (int)vNodes.size()));
+     obj.push_back(Pair("proxy",         (fUseProxy ? addrProxy.ToStringIPPort() : string())));
+     obj.push_back(Pair("generate",      (bool)fGenerateBitcoins));
+     obj.push_back(Pair("genproclimit",  (int)(fLimitProcessors ? nLimitProcessors : -1)));
+     obj.push_back(Pair("difficulty",    (double)GetDifficulty()));
+     obj.push_back(Pair("hashespersec",  gethashespersec(params, false)));
+     obj.push_back(Pair("testnet",       fTestNet));
+     obj.push_back(Pair("keypoololdest", (boost::int64_t)GetOldestKeyPoolTime()));
+     obj.push_back(Pair("paytxfee",      ValueFromAmount(nTransactionFee)));
+     obj.push_back(Pair("errors",        GetWarnings("statusbar")));
+     return obj;
+ }
+ Value getnewaddress(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() > 1)
+         throw runtime_error(
+             "getnewaddress [account]\n"
+             "Returns a new bitcoin address for receiving payments.  "
+             "If [account] is specified (recommended), it is added to the address book "
+             "so payments received with the address will be credited to [account].");
+     // Parse the account first so we don't generate a key if there's an error
+     string strAccount;
+     if (params.size() > 0)
+         strAccount = AccountFromValue(params[0]);
+     // Generate a new key that is added to wallet
+     string strAddress = PubKeyToAddress(GetKeyFromKeyPool());
+     SetAddressBookName(strAddress, strAccount);
+     return strAddress;
+ }
+ // requires cs_main, cs_mapWallet locks
+ string GetAccountAddress(string strAccount, bool bForceNew=false)
+ {
+     string strAddress;
+     CWalletDB walletdb;
+     walletdb.TxnBegin();
+     CAccount account;
+     walletdb.ReadAccount(strAccount, account);
+     // Check if the current key has been used
+     if (!account.vchPubKey.empty())
+     {
+         CScript scriptPubKey;
+         scriptPubKey.SetBitcoinAddress(account.vchPubKey);
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin();
+              it != mapWallet.end() && !account.vchPubKey.empty();
+              ++it)
+         {
+             const CWalletTx& wtx = (*it).second;
+             foreach(const CTxOut& txout, wtx.vout)
+                 if (txout.scriptPubKey == scriptPubKey)
+                     account.vchPubKey.clear();
+         }
+     }
+     // Generate a new key
+     if (account.vchPubKey.empty() || bForceNew)
+     {
+         account.vchPubKey = GetKeyFromKeyPool();
+         string strAddress = PubKeyToAddress(account.vchPubKey);
+         SetAddressBookName(strAddress, strAccount);
+         walletdb.WriteAccount(strAccount, account);
+     }
+     walletdb.TxnCommit();
+     strAddress = PubKeyToAddress(account.vchPubKey);
+     return strAddress;
+ }
+ Value getaccountaddress(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 1)
+         throw runtime_error(
+             "getaccountaddress <account>\n"
+             "Returns the current bitcoin address for receiving payments to this account.");
+     // Parse the account first so we don't generate a key if there's an error
+     string strAccount = AccountFromValue(params[0]);
+     Value ret;
+     CRITICAL_BLOCK(cs_main)
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         ret = GetAccountAddress(strAccount);
+     }
+     return ret;
+ }
+ Value setaccount(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 1 || params.size() > 2)
+         throw runtime_error(
+             "setaccount <bitcoinaddress> <account>\n"
+             "Sets the account associated with the given address.");
+     string strAddress = params[0].get_str();
+     uint160 hash160;
+     bool isValid = AddressToHash160(strAddress, hash160);
+     if (!isValid)
+         throw JSONRPCError(-5, "Invalid bitcoin address");
+     string strAccount;
+     if (params.size() > 1)
+         strAccount = AccountFromValue(params[1]);
+     // Detect when changing the account of an address that is the 'unused current key' of another account:
+     CRITICAL_BLOCK(cs_main)
+     CRITICAL_BLOCK(cs_mapWallet)
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         if (mapAddressBook.count(strAddress))
+         {
+             string strOldAccount = mapAddressBook[strAddress];
+             if (strAddress == GetAccountAddress(strOldAccount))
+                 GetAccountAddress(strOldAccount, true);
+         }
+     }
+     SetAddressBookName(strAddress, strAccount);
+     return Value::null;
+ }
+ Value getaccount(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 1)
+         throw runtime_error(
+             "getaccount <bitcoinaddress>\n"
+             "Returns the account associated with the given address.");
+     string strAddress = params[0].get_str();
+     string strAccount;
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         map<string, string>::iterator mi = mapAddressBook.find(strAddress);
+         if (mi != mapAddressBook.end() && !(*mi).second.empty())
+             strAccount = (*mi).second;
+     }
+     return strAccount;
+ }
+ Value getaddressesbyaccount(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 1)
+         throw runtime_error(
+             "getaddressesbyaccount <account>\n"
+             "Returns the list of addresses for the given account.");
+     string strAccount = AccountFromValue(params[0]);
+     // Find all addresses that have the given account
+     Array ret;
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
+         {
+             const string& strAddress = item.first;
+             const string& strName = item.second;
+             if (strName == strAccount)
+             {
+                 // We're only adding valid bitcoin addresses and not ip addresses
+                 CScript scriptPubKey;
+                 if (scriptPubKey.SetBitcoinAddress(strAddress))
+                     ret.push_back(strAddress);
+             }
+         }
+     }
+     return ret;
+ }
+ Value sendtoaddress(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 2 || params.size() > 4)
+         throw runtime_error(
+             "sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to]\n"
+             "<amount> is a real and is rounded to the nearest 0.01");
+     string strAddress = params[0].get_str();
+     // Amount
+     int64 nAmount = AmountFromValue(params[1]);
+     // Wallet comments
+     CWalletTx wtx;
+     if (params.size() > 2 && params[2].type() != null_type && !params[2].get_str().empty())
+         wtx.mapValue["comment"] = params[2].get_str();
+     if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty())
+         wtx.mapValue["to"]      = params[3].get_str();
+     CRITICAL_BLOCK(cs_main)
+     {
+         string strError = SendMoneyToBitcoinAddress(strAddress, nAmount, wtx);
+         if (strError != "")
+             throw JSONRPCError(-4, strError);
+     }
+     return wtx.GetHash().GetHex();
+ }
+ Value getreceivedbyaddress(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 1 || params.size() > 2)
+         throw runtime_error(
+             "getreceivedbyaddress <bitcoinaddress> [minconf=1]\n"
+             "Returns the total amount received by <bitcoinaddress> in transactions with at least [minconf] confirmations.");
+     // Bitcoin address
+     string strAddress = params[0].get_str();
+     CScript scriptPubKey;
+     if (!scriptPubKey.SetBitcoinAddress(strAddress))
+         throw JSONRPCError(-5, "Invalid bitcoin address");
+     if (!IsMine(scriptPubKey))
+         return (double)0.0;
+     // Minimum confirmations
+     int nMinDepth = 1;
+     if (params.size() > 1)
+         nMinDepth = params[1].get_int();
+     // Tally
+     int64 nAmount = 0;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             const CWalletTx& wtx = (*it).second;
+             if (wtx.IsCoinBase() || !wtx.IsFinal())
+                 continue;
+             foreach(const CTxOut& txout, wtx.vout)
+                 if (txout.scriptPubKey == scriptPubKey)
+                     if (wtx.GetDepthInMainChain() >= nMinDepth)
+                         nAmount += txout.nValue;
+         }
+     }
+     return  ValueFromAmount(nAmount);
+ }
+ void GetAccountPubKeys(string strAccount, set<CScript>& setPubKey)
+ {
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
+         {
+             const string& strAddress = item.first;
+             const string& strName = item.second;
+             if (strName == strAccount)
+             {
+                 // We're only counting our own valid bitcoin addresses and not ip addresses
+                 CScript scriptPubKey;
+                 if (scriptPubKey.SetBitcoinAddress(strAddress))
+                     if (IsMine(scriptPubKey))
+                         setPubKey.insert(scriptPubKey);
+             }
+         }
+     }
+ }
+ Value getreceivedbyaccount(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 1 || params.size() > 2)
+         throw runtime_error(
+             "getreceivedbyaccount <account> [minconf=1]\n"
+             "Returns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations.");
+     // Minimum confirmations
+     int nMinDepth = 1;
+     if (params.size() > 1)
+         nMinDepth = params[1].get_int();
+     // Get the set of pub keys that have the label
+     string strAccount = AccountFromValue(params[0]);
+     set<CScript> setPubKey;
+     GetAccountPubKeys(strAccount, setPubKey);
+     // Tally
+     int64 nAmount = 0;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             const CWalletTx& wtx = (*it).second;
+             if (wtx.IsCoinBase() || !wtx.IsFinal())
+                 continue;
+             foreach(const CTxOut& txout, wtx.vout)
+                 if (setPubKey.count(txout.scriptPubKey))
+                     if (wtx.GetDepthInMainChain() >= nMinDepth)
+                         nAmount += txout.nValue;
+         }
+     }
+     return (double)nAmount / (double)COIN;
+ }
+ int64 GetAccountBalance(CWalletDB& walletdb, const string& strAccount, int nMinDepth)
+ {
+     int64 nBalance = 0;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         // Tally wallet transactions
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             const CWalletTx& wtx = (*it).second;
+             if (!wtx.IsFinal())
+                 continue;
+             int64 nGenerated, nReceived, nSent, nFee;
+             wtx.GetAccountAmounts(strAccount, nGenerated, nReceived, nSent, nFee);
+             if (nReceived != 0 && wtx.GetDepthInMainChain() >= nMinDepth)
+                 nBalance += nReceived;
+             nBalance += nGenerated - nSent - nFee;
+         }
+         // Tally internal accounting entries
+         nBalance += walletdb.GetAccountCreditDebit(strAccount);
+     }
+     return nBalance;
+ }
+ int64 GetAccountBalance(const string& strAccount, int nMinDepth)
+ {
+     CWalletDB walletdb;
+     return GetAccountBalance(walletdb, strAccount, nMinDepth);
+ }
+ Value getbalance(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 0 || params.size() > 2)
+         throw runtime_error(
+             "getbalance [account] [minconf=1]\n"
+             "If [account] is not specified, returns the server's total available balance.\n"
+             "If [account] is specified, returns the balance in the account.");
+     if (params.size() == 0)
+         return  ValueFromAmount(GetBalance());
+     int nMinDepth = 1;
+     if (params.size() > 1)
+         nMinDepth = params[1].get_int();
+     if (params[0].get_str() == "*") {
+         // Calculate total balance a different way from GetBalance()
+         // (GetBalance() sums up all unspent TxOuts)
+         // getbalance and getbalance '*' should always return the same number.
+         int64 nBalance = 0;
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             const CWalletTx& wtx = (*it).second;
+             if (!wtx.IsFinal())
+                 continue;
+             int64 allGeneratedImmature, allGeneratedMature, allFee;
+             allGeneratedImmature = allGeneratedMature = allFee = 0;
+             string strSentAccount;
+             list<pair<string, int64> > listReceived;
+             list<pair<string, int64> > listSent;
+             wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount);
+             if (wtx.GetDepthInMainChain() >= nMinDepth)
+                 foreach(const PAIRTYPE(string,int64)& r, listReceived)
+                     nBalance += r.second;
+             foreach(const PAIRTYPE(string,int64)& r, listSent)
+                 nBalance -= r.second;
+             nBalance -= allFee;
+             nBalance += allGeneratedMature;
+         }
+         return  ValueFromAmount(nBalance);
+     }
+     string strAccount = AccountFromValue(params[0]);
+     int64 nBalance = GetAccountBalance(strAccount, nMinDepth);
+     return ValueFromAmount(nBalance);
+ }
+ Value movecmd(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 3 || params.size() > 5)
+         throw runtime_error(
+             "move <fromaccount> <toaccount> <amount> [minconf=1] [comment]\n"
+             "Move from one account in your wallet to another.");
+     string strFrom = AccountFromValue(params[0]);
+     string strTo = AccountFromValue(params[1]);
+     int64 nAmount = AmountFromValue(params[2]);
+     int nMinDepth = 1;
+     if (params.size() > 3)
+         nMinDepth = params[3].get_int();
+     string strComment;
+     if (params.size() > 4)
+         strComment = params[4].get_str();
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         CWalletDB walletdb;
+         walletdb.TxnBegin();
+         // Check funds
+         if (!strFrom.empty())
+         {
+             int64 nBalance = GetAccountBalance(walletdb, strFrom, nMinDepth);
+             if (nAmount > nBalance)
+                 throw JSONRPCError(-6, "Account has insufficient funds");
+         }
+         else
+         {
+             // move from "" account special case
+             int64 nBalance = GetAccountBalance(walletdb, strTo, nMinDepth);
+             if (nAmount > GetBalance() - nBalance)
+                 throw JSONRPCError(-6, "Account has insufficient funds");
+         }
+         int64 nNow = GetAdjustedTime();
+         // Debit
+         CAccountingEntry debit;
+         debit.strAccount = strFrom;
+         debit.nCreditDebit = -nAmount;
+         debit.nTime = nNow;
+         debit.strOtherAccount = strTo;
+         debit.strComment = strComment;
+         walletdb.WriteAccountingEntry(debit);
+         // Credit
+         CAccountingEntry credit;
+         credit.strAccount = strTo;
+         credit.nCreditDebit = nAmount;
+         credit.nTime = nNow;
+         credit.strOtherAccount = strFrom;
+         credit.strComment = strComment;
+         walletdb.WriteAccountingEntry(credit);
+         walletdb.TxnCommit();
+     }
+     return true;
+ }
+ Value sendfrom(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 3 || params.size() > 6)
+         throw runtime_error(
+             "sendfrom <fromaccount> <tobitcoinaddress> <amount> [minconf=1] [comment] [comment-to]\n"
+             "<amount> is a real and is rounded to the nearest 0.01");
+     string strAccount = AccountFromValue(params[0]);
+     string strAddress = params[1].get_str();
+     int64 nAmount = AmountFromValue(params[2]);
+     int nMinDepth = 1;
+     if (params.size() > 3)
+         nMinDepth = params[3].get_int();
+     CWalletTx wtx;
+     wtx.strFromAccount = strAccount;
+     if (params.size() > 4 && params[4].type() != null_type && !params[4].get_str().empty())
+         wtx.mapValue["comment"] = params[4].get_str();
+     if (params.size() > 5 && params[5].type() != null_type && !params[5].get_str().empty())
+         wtx.mapValue["to"]      = params[5].get_str();
+     CRITICAL_BLOCK(cs_main)
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         // Check funds
+         int64 nBalance = GetAccountBalance(strAccount, nMinDepth);
+         if (nAmount > nBalance)
+             throw JSONRPCError(-6, "Account has insufficient funds");
+         // Send
+         string strError = SendMoneyToBitcoinAddress(strAddress, nAmount, wtx);
+         if (strError != "")
+             throw JSONRPCError(-4, strError);
+     }
+     return wtx.GetHash().GetHex();
+ }
+ Value sendmany(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() < 2 || params.size() > 4)
+         throw runtime_error(
+             "sendmany <fromaccount> {address:amount,...} [minconf=1] [comment]\n"
+             "amounts are double-precision floating point numbers");
+     string strAccount = AccountFromValue(params[0]);
+     Object sendTo = params[1].get_obj();
+     int nMinDepth = 1;
+     if (params.size() > 2)
+         nMinDepth = params[2].get_int();
+     CWalletTx wtx;
+     wtx.strFromAccount = strAccount;
+     if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty())
+         wtx.mapValue["comment"] = params[3].get_str();
+     set<string> setAddress;
+     vector<pair<CScript, int64> > vecSend;
+     int64 totalAmount = 0;
+     foreach(const Pair& s, sendTo)
+     {
+         uint160 hash160;
+         string strAddress = s.name_;
+         if (setAddress.count(strAddress))
+             throw JSONRPCError(-8, string("Invalid parameter, duplicated address: ")+strAddress);
+         setAddress.insert(strAddress);
+         CScript scriptPubKey;
+         if (!scriptPubKey.SetBitcoinAddress(strAddress))
+             throw JSONRPCError(-5, string("Invalid bitcoin address:")+strAddress);
+         int64 nAmount = AmountFromValue(s.value_); 
+         totalAmount += nAmount;
+         vecSend.push_back(make_pair(scriptPubKey, nAmount));
+     }
+     CRITICAL_BLOCK(cs_main)
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         // Check funds
+         int64 nBalance = GetAccountBalance(strAccount, nMinDepth);
+         if (totalAmount > nBalance)
+             throw JSONRPCError(-6, "Account has insufficient funds");
+         // Send
+         CReserveKey keyChange;
+         int64 nFeeRequired = 0;
+         bool fCreated = CreateTransaction(vecSend, wtx, keyChange, nFeeRequired);
+         if (!fCreated)
+         {
+             if (totalAmount + nFeeRequired > GetBalance())
+                 throw JSONRPCError(-6, "Insufficient funds");
+             throw JSONRPCError(-4, "Transaction creation failed");
+         }
+         if (!CommitTransaction(wtx, keyChange))
+             throw JSONRPCError(-4, "Transaction commit failed");
+     }
+     return wtx.GetHash().GetHex();
+ }
+ struct tallyitem
+ {
+     int64 nAmount;
+     int nConf;
+     tallyitem()
+     {
+         nAmount = 0;
+         nConf = INT_MAX;
+     }
+ };
+ Value ListReceived(const Array& params, bool fByAccounts)
+ {
+     // Minimum confirmations
+     int nMinDepth = 1;
+     if (params.size() > 0)
+         nMinDepth = params[0].get_int();
+     // Whether to include empty accounts
+     bool fIncludeEmpty = false;
+     if (params.size() > 1)
+         fIncludeEmpty = params[1].get_bool();
+     // Tally
+     map<uint160, tallyitem> mapTally;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             const CWalletTx& wtx = (*it).second;
+             if (wtx.IsCoinBase() || !wtx.IsFinal())
+                 continue;
+             int nDepth = wtx.GetDepthInMainChain();
+             if (nDepth < nMinDepth)
+                 continue;
+             foreach(const CTxOut& txout, wtx.vout)
+             {
+                 // Only counting our own bitcoin addresses and not ip addresses
+                 uint160 hash160 = txout.scriptPubKey.GetBitcoinAddressHash160();
+                 if (hash160 == 0 || !mapPubKeys.count(hash160)) // IsMine
+                     continue;
+                 tallyitem& item = mapTally[hash160];
+                 item.nAmount += txout.nValue;
+                 item.nConf = min(item.nConf, nDepth);
+             }
+         }
+     }
+     // Reply
+     Array ret;
+     map<string, tallyitem> mapAccountTally;
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
+         {
+             const string& strAddress = item.first;
+             const string& strAccount = item.second;
+             uint160 hash160;
+             if (!AddressToHash160(strAddress, hash160))
+                 continue;
+             map<uint160, tallyitem>::iterator it = mapTally.find(hash160);
+             if (it == mapTally.end() && !fIncludeEmpty)
+                 continue;
+             int64 nAmount = 0;
+             int nConf = INT_MAX;
+             if (it != mapTally.end())
+             {
+                 nAmount = (*it).second.nAmount;
+                 nConf = (*it).second.nConf;
+             }
+             if (fByAccounts)
+             {
+                 tallyitem& item = mapAccountTally[strAccount];
+                 item.nAmount += nAmount;
+                 item.nConf = min(item.nConf, nConf);
+             }
+             else
+             {
+                 Object obj;
+                 obj.push_back(Pair("address",       strAddress));
+                 obj.push_back(Pair("account",       strAccount));
+                 obj.push_back(Pair("label",         strAccount)); // deprecated
+                 obj.push_back(Pair("amount",        ValueFromAmount(nAmount)));
+                 obj.push_back(Pair("confirmations", (nConf == INT_MAX ? 0 : nConf)));
+                 ret.push_back(obj);
+             }
+         }
+     }
+     if (fByAccounts)
+     {
+         for (map<string, tallyitem>::iterator it = mapAccountTally.begin(); it != mapAccountTally.end(); ++it)
+         {
+             int64 nAmount = (*it).second.nAmount;
+             int nConf = (*it).second.nConf;
+             Object obj;
+             obj.push_back(Pair("account",       (*it).first));
+             obj.push_back(Pair("label",         (*it).first)); // deprecated
+             obj.push_back(Pair("amount",        ValueFromAmount(nAmount)));
+             obj.push_back(Pair("confirmations", (nConf == INT_MAX ? 0 : nConf)));
+             ret.push_back(obj);
+         }
+     }
+     return ret;
+ }
+ Value listreceivedbyaddress(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() > 2)
+         throw runtime_error(
+             "listreceivedbyaddress [minconf=1] [includeempty=false]\n"
+             "[minconf] is the minimum number of confirmations before payments are included.\n"
+             "[includeempty] whether to include addresses that haven't received any payments.\n"
+             "Returns an array of objects containing:\n"
+             "  \"address\" : receiving address\n"
+             "  \"account\" : the account of the receiving address\n"
+             "  \"amount\" : total amount received by the address\n"
+             "  \"confirmations\" : number of confirmations of the most recent transaction included");
+     return ListReceived(params, false);
+ }
+ Value listreceivedbyaccount(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() > 2)
+         throw runtime_error(
+             "listreceivedbyaccount [minconf=1] [includeempty=false]\n"
+             "[minconf] is the minimum number of confirmations before payments are included.\n"
+             "[includeempty] whether to include accounts that haven't received any payments.\n"
+             "Returns an array of objects containing:\n"
+             "  \"account\" : the account of the receiving addresses\n"
+             "  \"amount\" : total amount received by addresses with this account\n"
+             "  \"confirmations\" : number of confirmations of the most recent transaction included");
+     return ListReceived(params, true);
+ }
+ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, Array& ret)
+ {
+     int64 nGeneratedImmature, nGeneratedMature, nFee;
+     string strSentAccount;
+     list<pair<string, int64> > listReceived;
+     list<pair<string, int64> > listSent;
+     wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount);
+     bool fAllAccounts = (strAccount == string("*"));
+     // Generated blocks assigned to account ""
+     if ((nGeneratedMature+nGeneratedImmature) != 0 && (fAllAccounts || strAccount == ""))
+     {
+         Object entry;
+         entry.push_back(Pair("account", string("")));
+         if (nGeneratedImmature)
+         {
+             entry.push_back(Pair("category", wtx.GetDepthInMainChain() ? "immature" : "orphan"));
+             entry.push_back(Pair("amount", ValueFromAmount(nGeneratedImmature)));
+         }
+         else
+         {
+             entry.push_back(Pair("category", "generate"));
+             entry.push_back(Pair("amount", ValueFromAmount(nGeneratedMature)));
+         }
+         if (fLong)
+             WalletTxToJSON(wtx, entry);
+         ret.push_back(entry);
+     }
+     // Sent
+     if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
+     {
+         foreach(const PAIRTYPE(string, int64)& s, listSent)
+         {
+             Object entry;
+             entry.push_back(Pair("account", strSentAccount));
+             entry.push_back(Pair("address", s.first));
+             entry.push_back(Pair("category", "send"));
+             entry.push_back(Pair("amount", ValueFromAmount(-s.second)));
+             entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
+             if (fLong)
+                 WalletTxToJSON(wtx, entry);
+             ret.push_back(entry);
+         }
+     }
+     // Received
+     if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth)
+         CRITICAL_BLOCK(cs_mapAddressBook)
+         {
+             foreach(const PAIRTYPE(string, int64)& r, listReceived)
+             {
+                 string account;
+                 if (mapAddressBook.count(r.first))
+                     account = mapAddressBook[r.first];
+                 if (fAllAccounts || (account == strAccount))
+                 {
+                     Object entry;
+                     entry.push_back(Pair("account", account));
+                     entry.push_back(Pair("address", r.first));
+                     entry.push_back(Pair("category", "receive"));
+                     entry.push_back(Pair("amount", ValueFromAmount(r.second)));
+                     if (fLong)
+                         WalletTxToJSON(wtx, entry);
+                     ret.push_back(entry);
+                 }
+             }
+         }
+ }
+ void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Array& ret)
+ {
+     bool fAllAccounts = (strAccount == string("*"));
+     if (fAllAccounts || acentry.strAccount == strAccount)
+     {
+         Object entry;
+         entry.push_back(Pair("account", acentry.strAccount));
+         entry.push_back(Pair("category", "move"));
+         entry.push_back(Pair("time", (boost::int64_t)acentry.nTime));
+         entry.push_back(Pair("amount", ValueFromAmount(acentry.nCreditDebit)));
+         entry.push_back(Pair("otheraccount", acentry.strOtherAccount));
+         entry.push_back(Pair("comment", acentry.strComment));
+         ret.push_back(entry);
+     }
+ }
+ Value listtransactions(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() > 2)
+         throw runtime_error(
 -        for (TxItems::reverse_iterator it = txByTime.rbegin(); it != txByTime.rend(); ++it)
++            "listtransactions [account] [count=10] [from=0]\n"
++            "Returns up to [count] most recent transactions skipping the first [from] transactions for account [account].");
+     string strAccount = "*";
+     if (params.size() > 0)
+         strAccount = params[0].get_str();
+     int nCount = 10;
+     if (params.size() > 1)
+         nCount = params[1].get_int();
++    int nFrom = 0;
++    if (params.size() > 2)
++        nFrom = params[2].get_int();
+     Array ret;
+     CWalletDB walletdb;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         // Firs: get all CWalletTx and CAccountingEntry into a sorted-by-time multimap:
+         typedef pair<CWalletTx*, CAccountingEntry*> TxPair;
+         typedef multimap<int64, TxPair > TxItems;
+         TxItems txByTime;
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             CWalletTx* wtx = &((*it).second);
+             txByTime.insert(make_pair(wtx->GetTxTime(), TxPair(wtx, (CAccountingEntry*)0)));
+         }
+         list<CAccountingEntry> acentries;
+         walletdb.ListAccountCreditDebit(strAccount, acentries);
+         foreach(CAccountingEntry& entry, acentries)
+         {
+             txByTime.insert(make_pair(entry.nTime, TxPair((CWalletTx*)0, &entry)));
+         }
+         // Now: iterate backwards until we have nCount items to return:
 -            if (strHeader == "Content-Length")
++        TxItems::reverse_iterator it = txByTime.rbegin();
++        for (std::advance(it, nFrom); it != txByTime.rend(); ++it)
+         {
+             CWalletTx *const pwtx = (*it).second.first;
+             if (pwtx != 0)
+                 ListTransactions(*pwtx, strAccount, 0, true, ret);
+             CAccountingEntry *const pacentry = (*it).second.second;
+             if (pacentry != 0)
+                 AcentryToJSON(*pacentry, strAccount, ret);
+             if (ret.size() >= nCount) break;
+         }
+         // ret is now newest to oldest
+     }
+     
+     // Make sure we return only last nCount items (sends-to-self might give us an extra):
+     if (ret.size() > nCount)
+     {
+         Array::iterator last = ret.begin();
+         std::advance(last, nCount);
+         ret.erase(last, ret.end());
+     }
+     std::reverse(ret.begin(), ret.end()); // oldest to newest
+     return ret;
+ }
+ Value listaccounts(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() > 1)
+         throw runtime_error(
+             "listaccounts [minconf=1]\n"
+             "Returns Object that has account names as keys, account balances as values.");
+     int nMinDepth = 1;
+     if (params.size() > 0)
+         nMinDepth = params[0].get_int();
+     map<string, int64> mapAccountBalances;
+     CRITICAL_BLOCK(cs_mapWallet)
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         foreach(const PAIRTYPE(string, string)& entry, mapAddressBook) {
+             uint160 hash160;
+             if(AddressToHash160(entry.first, hash160) && mapPubKeys.count(hash160)) // This address belongs to me
+                 mapAccountBalances[entry.second] = 0;
+         }
+         for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+         {
+             const CWalletTx& wtx = (*it).second;
+             int64 nGeneratedImmature, nGeneratedMature, nFee;
+             string strSentAccount;
+             list<pair<string, int64> > listReceived;
+             list<pair<string, int64> > listSent;
+             wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount);
+             mapAccountBalances[strSentAccount] -= nFee;
+             foreach(const PAIRTYPE(string, int64)& s, listSent)
+                 mapAccountBalances[strSentAccount] -= s.second;
+             if (wtx.GetDepthInMainChain() >= nMinDepth)
+             {
+                 mapAccountBalances[""] += nGeneratedMature;
+                 foreach(const PAIRTYPE(string, int64)& r, listReceived)
+                     if (mapAddressBook.count(r.first))
+                         mapAccountBalances[mapAddressBook[r.first]] += r.second;
+                     else
+                         mapAccountBalances[""] += r.second;
+             }
+         }
+     }
+     list<CAccountingEntry> acentries;
+     CWalletDB().ListAccountCreditDebit("*", acentries);
+     foreach(const CAccountingEntry& entry, acentries)
+         mapAccountBalances[entry.strAccount] += entry.nCreditDebit;
+     Object ret;
+     foreach(const PAIRTYPE(string, int64)& accountBalance, mapAccountBalances) {
+         ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second)));
+     }
+     return ret;
+ }
+ Value gettransaction(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 1)
+         throw runtime_error(
+             "gettransaction <txid>\n"
+             "Get detailed information about <txid>");
+     uint256 hash;
+     hash.SetHex(params[0].get_str());
+     Object entry;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         if (!mapWallet.count(hash))
+             throw JSONRPCError(-5, "Invalid or non-wallet transaction id");
+         const CWalletTx& wtx = mapWallet[hash];
+         int64 nCredit = wtx.GetCredit();
+         int64 nDebit = wtx.GetDebit();
+         int64 nNet = nCredit - nDebit;
+         int64 nFee = (wtx.IsFromMe() ? wtx.GetValueOut() - nDebit : 0);
+         entry.push_back(Pair("amount", ValueFromAmount(nNet - nFee)));
+         if (wtx.IsFromMe())
+             entry.push_back(Pair("fee", ValueFromAmount(nFee)));
+         WalletTxToJSON(mapWallet[hash], entry);
+         Array details;
+         ListTransactions(mapWallet[hash], "*", 0, false, details);
+         entry.push_back(Pair("details", details));
+     }
+     return entry;
+ }
+ Value backupwallet(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 1)
+         throw runtime_error(
+             "backupwallet <destination>\n"
+             "Safely copies wallet.dat to destination, which can be a directory or a path with filename.");
+     string strDest = params[0].get_str();
+     BackupWallet(strDest);
+     return Value::null;
+ }
+ Value validateaddress(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() != 1)
+         throw runtime_error(
+             "validateaddress <bitcoinaddress>\n"
+             "Return information about <bitcoinaddress>.");
+     string strAddress = params[0].get_str();
+     uint160 hash160;
+     bool isValid = AddressToHash160(strAddress, hash160);
+     Object ret;
+     ret.push_back(Pair("isvalid", isValid));
+     if (isValid)
+     {
+         // Call Hash160ToAddress() so we always return current ADDRESSVERSION
+         // version of the address:
+         string currentAddress = Hash160ToAddress(hash160);
+         ret.push_back(Pair("address", currentAddress));
+         ret.push_back(Pair("ismine", (mapPubKeys.count(hash160) > 0)));
+         CRITICAL_BLOCK(cs_mapAddressBook)
+         {
+             if (mapAddressBook.count(currentAddress))
+                 ret.push_back(Pair("account", mapAddressBook[currentAddress]));
+         }
+     }
+     return ret;
+ }
+ Value getwork(const Array& params, bool fHelp)
+ {
+     if (fHelp || params.size() > 1)
+         throw runtime_error(
+             "getwork [data]\n"
+             "If [data] is not specified, returns formatted hash data to work on:\n"
+             "  \"midstate\" : precomputed hash state after hashing the first half of the data\n"
+             "  \"data\" : block data\n"
+             "  \"hash1\" : formatted hash buffer for second hash\n"
+             "  \"target\" : little endian hash target\n"
+             "If [data] is specified, tries to solve the block and returns true if it was successful.");
+     if (vNodes.empty())
+         throw JSONRPCError(-9, "Bitcoin is not connected!");
+     if (IsInitialBlockDownload())
+         throw JSONRPCError(-10, "Bitcoin is downloading blocks...");
+     static map<uint256, pair<CBlock*, unsigned int> > mapNewBlock;
+     static vector<CBlock*> vNewBlock;
+     static CReserveKey reservekey;
+     if (params.size() == 0)
+     {
+         // Update block
+         static unsigned int nTransactionsUpdatedLast;
+         static CBlockIndex* pindexPrev;
+         static int64 nStart;
+         static CBlock* pblock;
+         if (pindexPrev != pindexBest ||
+             (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60))
+         {
+             if (pindexPrev != pindexBest)
+             {
+                 // Deallocate old blocks since they're obsolete now
+                 mapNewBlock.clear();
+                 foreach(CBlock* pblock, vNewBlock)
+                     delete pblock;
+                 vNewBlock.clear();
+             }
+             nTransactionsUpdatedLast = nTransactionsUpdated;
+             pindexPrev = pindexBest;
+             nStart = GetTime();
+             // Create new block
+             pblock = CreateNewBlock(reservekey);
+             if (!pblock)
+                 throw JSONRPCError(-7, "Out of memory");
+             vNewBlock.push_back(pblock);
+         }
+         // Update nTime
+         pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
+         pblock->nNonce = 0;
+         // Update nExtraNonce
+         static unsigned int nExtraNonce = 0;
+         static int64 nPrevTime = 0;
+         IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, nPrevTime);
+         // Save
+         mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, nExtraNonce);
+         // Prebuild hash buffers
+         char pmidstate[32];
+         char pdata[128];
+         char phash1[64];
+         FormatHashBuffers(pblock, pmidstate, pdata, phash1);
+         uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
+         Object result;
+         result.push_back(Pair("midstate", HexStr(BEGIN(pmidstate), END(pmidstate))));
+         result.push_back(Pair("data",     HexStr(BEGIN(pdata), END(pdata))));
+         result.push_back(Pair("hash1",    HexStr(BEGIN(phash1), END(phash1))));
+         result.push_back(Pair("target",   HexStr(BEGIN(hashTarget), END(hashTarget))));
+         return result;
+     }
+     else
+     {
+         // Parse parameters
+         vector<unsigned char> vchData = ParseHex(params[0].get_str());
+         if (vchData.size() != 128)
+             throw JSONRPCError(-8, "Invalid parameter");
+         CBlock* pdata = (CBlock*)&vchData[0];
+         // Byte reverse
+         for (int i = 0; i < 128/4; i++)
+             ((unsigned int*)pdata)[i] = CryptoPP::ByteReverse(((unsigned int*)pdata)[i]);
+         // Get saved block
+         if (!mapNewBlock.count(pdata->hashMerkleRoot))
+             return false;
+         CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
+         unsigned int nExtraNonce = mapNewBlock[pdata->hashMerkleRoot].second;
+         pblock->nTime = pdata->nTime;
+         pblock->nNonce = pdata->nNonce;
+         pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce);
+         pblock->hashMerkleRoot = pblock->BuildMerkleTree();
+         return CheckWork(pblock, reservekey);
+     }
+ }
+ //
+ // Call Table
+ //
+ pair<string, rpcfn_type> pCallTable[] =
+ {
+     make_pair("help",                  &help),
+     make_pair("stop",                  &stop),
+     make_pair("getblockcount",         &getblockcount),
+     make_pair("getblocknumber",        &getblocknumber),
+     make_pair("getconnectioncount",    &getconnectioncount),
+     make_pair("getdifficulty",         &getdifficulty),
+     make_pair("getgenerate",           &getgenerate),
+     make_pair("setgenerate",           &setgenerate),
+     make_pair("gethashespersec",       &gethashespersec),
+     make_pair("getinfo",               &getinfo),
+     make_pair("getnewaddress",         &getnewaddress),
+     make_pair("getaccountaddress",     &getaccountaddress),
+     make_pair("setaccount",            &setaccount),
+     make_pair("setlabel",              &setaccount), // deprecated
+     make_pair("getaccount",            &getaccount),
+     make_pair("getlabel",              &getaccount), // deprecated
+     make_pair("getaddressesbyaccount", &getaddressesbyaccount),
+     make_pair("getaddressesbylabel",   &getaddressesbyaccount), // deprecated
+     make_pair("sendtoaddress",         &sendtoaddress),
+     make_pair("getamountreceived",     &getreceivedbyaddress), // deprecated, renamed to getreceivedbyaddress
+     make_pair("getallreceived",        &listreceivedbyaddress), // deprecated, renamed to listreceivedbyaddress
+     make_pair("getreceivedbyaddress",  &getreceivedbyaddress),
+     make_pair("getreceivedbyaccount",  &getreceivedbyaccount),
+     make_pair("getreceivedbylabel",    &getreceivedbyaccount), // deprecated
+     make_pair("listreceivedbyaddress", &listreceivedbyaddress),
+     make_pair("listreceivedbyaccount", &listreceivedbyaccount),
+     make_pair("listreceivedbylabel",   &listreceivedbyaccount), // deprecated
+     make_pair("backupwallet",          &backupwallet),
+     make_pair("validateaddress",       &validateaddress),
+     make_pair("getbalance",            &getbalance),
+     make_pair("move",                  &movecmd),
+     make_pair("sendfrom",              &sendfrom),
+     make_pair("sendmany",              &sendmany),
+     make_pair("gettransaction",        &gettransaction),
+     make_pair("listtransactions",      &listtransactions),
+     make_pair("getwork",               &getwork),
+     make_pair("listaccounts",          &listaccounts),
+ };
+ map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0]));
+ string pAllowInSafeMode[] =
+ {
+     "help",
+     "stop",
+     "getblockcount",
+     "getblocknumber",
+     "getconnectioncount",
+     "getdifficulty",
+     "getgenerate",
+     "setgenerate",
+     "gethashespersec",
+     "getinfo",
+     "getnewaddress",
+     "getaccountaddress",
+     "setlabel",
+     "getaccount",
+     "getlabel", // deprecated
+     "getaddressesbyaccount",
+     "getaddressesbylabel", // deprecated
+     "backupwallet",
+     "validateaddress",
+     "getwork",
+ };
+ set<string> setAllowInSafeMode(pAllowInSafeMode, pAllowInSafeMode + sizeof(pAllowInSafeMode)/sizeof(pAllowInSafeMode[0]));
+ //
+ // HTTP protocol
+ //
+ // This ain't Apache.  We're just using HTTP header for the length field
+ // and to be compatible with other JSON-RPC implementations.
+ //
+ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeaders)
+ {
+     ostringstream s;
+     s << "POST / HTTP/1.1\r\n"
+       << "User-Agent: bitcoin-json-rpc/" << FormatFullVersion() << "\r\n"
+       << "Host: 127.0.0.1\r\n"
+       << "Content-Type: application/json\r\n"
+       << "Content-Length: " << strMsg.size() << "\r\n"
+       << "Accept: application/json\r\n";
+     foreach(const PAIRTYPE(string, string)& item, mapRequestHeaders)
+         s << item.first << ": " << item.second << "\r\n";
+     s << "\r\n" << strMsg;
+     return s.str();
+ }
+ string rfc1123Time()
+ {
+     char buffer[64];
+     time_t now;
+     time(&now);
+     struct tm* now_gmt = gmtime(&now);
+     string locale(setlocale(LC_TIME, NULL));
+     setlocale(LC_TIME, "C"); // we want posix (aka "C") weekday/month strings
+     strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S +0000", now_gmt);
+     setlocale(LC_TIME, locale.c_str());
+     return string(buffer);
+ }
+ string HTTPReply(int nStatus, const string& strMsg)
+ {
+     if (nStatus == 401)
+         return strprintf("HTTP/1.0 401 Authorization Required\r\n"
+             "Date: %s\r\n"
+             "Server: bitcoin-json-rpc/%s\r\n"
+             "WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n"
+             "Content-Type: text/html\r\n"
+             "Content-Length: 296\r\n"
+             "\r\n"
+             "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"
+             "\"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n"
+             "<HTML>\r\n"
+             "<HEAD>\r\n"
+             "<TITLE>Error</TITLE>\r\n"
+             "<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>\r\n"
+             "</HEAD>\r\n"
+             "<BODY><H1>401 Unauthorized.</H1></BODY>\r\n"
+             "</HTML>\r\n", rfc1123Time().c_str(), FormatFullVersion().c_str());
+     string strStatus;
+          if (nStatus == 200) strStatus = "OK";
+     else if (nStatus == 400) strStatus = "Bad Request";
+     else if (nStatus == 404) strStatus = "Not Found";
+     else if (nStatus == 500) strStatus = "Internal Server Error";
+     return strprintf(
+             "HTTP/1.1 %d %s\r\n"
+             "Date: %s\r\n"
+             "Connection: close\r\n"
+             "Content-Length: %d\r\n"
+             "Content-Type: application/json\r\n"
+             "Server: bitcoin-json-rpc/%s\r\n"
+             "\r\n"
+             "%s",
+         nStatus,
+         strStatus.c_str(),
+         rfc1123Time().c_str(),
+         strMsg.size(),
+         FormatFullVersion().c_str(),
+         strMsg.c_str());
+ }
+ int ReadHTTPStatus(std::basic_istream<char>& stream)
+ {
+     string str;
+     getline(stream, str);
+     vector<string> vWords;
+     boost::split(vWords, str, boost::is_any_of(" "));
+     if (vWords.size() < 2)
+         return 500;
+     return atoi(vWords[1].c_str());
+ }
+ int ReadHTTPHeader(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet)
+ {
+     int nLen = 0;
+     loop
+     {
+         string str;
+         std::getline(stream, str);
+         if (str.empty() || str == "\r")
+             break;
+         string::size_type nColon = str.find(":");
+         if (nColon != string::npos)
+         {
+             string strHeader = str.substr(0, nColon);
+             boost::trim(strHeader);
++            boost::to_lower(strHeader);
+             string strValue = str.substr(nColon+1);
+             boost::trim(strValue);
+             mapHeadersRet[strHeader] = strValue;
 -    string strAuth = mapHeaders["Authorization"];
++            if (strHeader == "content-length")
+                 nLen = atoi(strValue.c_str());
+         }
+     }
+     return nLen;
+ }
+ int ReadHTTP(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet, string& strMessageRet)
+ {
+     mapHeadersRet.clear();
+     strMessageRet = "";
+     // Read status
+     int nStatus = ReadHTTPStatus(stream);
+     // Read header
+     int nLen = ReadHTTPHeader(stream, mapHeadersRet);
+     if (nLen < 0 || nLen > MAX_SIZE)
+         return 500;
+     // Read message
+     if (nLen > 0)
+     {
+         vector<char> vch(nLen);
+         stream.read(&vch[0], nLen);
+         strMessageRet = string(vch.begin(), vch.end());
+     }
+     return nStatus;
+ }
+ string EncodeBase64(string s)
+ {
+     BIO *b64, *bmem;
+     BUF_MEM *bptr;
+     b64 = BIO_new(BIO_f_base64());
+     BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+     bmem = BIO_new(BIO_s_mem());
+     b64 = BIO_push(b64, bmem);
+     BIO_write(b64, s.c_str(), s.size());
+     BIO_flush(b64);
+     BIO_get_mem_ptr(b64, &bptr);
+     string result(bptr->data, bptr->length);
+     BIO_free_all(b64);
+     return result;
+ }
+ string DecodeBase64(string s)
+ {
+     BIO *b64, *bmem;
+     char* buffer = static_cast<char*>(calloc(s.size(), sizeof(char)));
+     b64 = BIO_new(BIO_f_base64());
+     BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+     bmem = BIO_new_mem_buf(const_cast<char*>(s.c_str()), s.size());
+     bmem = BIO_push(b64, bmem);
+     BIO_read(bmem, buffer, s.size());
+     BIO_free_all(bmem);
+     string result(buffer);
+     free(buffer);
+     return result;
+ }
+ bool HTTPAuthorized(map<string, string>& mapHeaders)
+ {
 -        if (mapHeaders.count("Authorization") == 0)
++    string strAuth = mapHeaders["authorization"];
+     if (strAuth.substr(0,6) != "Basic ")
+         return false;
+     string strUserPass64 = strAuth.substr(6); boost::trim(strUserPass64);
+     string strUserPass = DecodeBase64(strUserPass64);
+     string::size_type nColon = strUserPass.find(":");
+     if (nColon == string::npos)
+         return false;
+     string strUser = strUserPass.substr(0, nColon);
+     string strPassword = strUserPass.substr(nColon+1);
+     return (strUser == mapArgs["-rpcuser"] && strPassword == mapArgs["-rpcpassword"]);
+ }
+ //
+ // JSON-RPC protocol.  Bitcoin speaks version 1.0 for maximum compatibility,
+ // but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were
+ // unspecified (HTTP errors and contents of 'error').
+ //
+ // 1.0 spec: http://json-rpc.org/wiki/specification
+ // 1.2 spec: http://groups.google.com/group/json-rpc/web/json-rpc-over-http
+ // http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx
+ //
+ string JSONRPCRequest(const string& strMethod, const Array& params, const Value& id)
+ {
+     Object request;
+     request.push_back(Pair("method", strMethod));
+     request.push_back(Pair("params", params));
+     request.push_back(Pair("id", id));
+     return write_string(Value(request), false) + "\n";
+ }
+ string JSONRPCReply(const Value& result, const Value& error, const Value& id)
+ {
+     Object reply;
+     if (error.type() != null_type)
+         reply.push_back(Pair("result", Value::null));
+     else
+         reply.push_back(Pair("result", result));
+     reply.push_back(Pair("error", error));
+     reply.push_back(Pair("id", id));
+     return write_string(Value(reply), false) + "\n";
+ }
+ void ErrorReply(std::ostream& stream, const Object& objError, const Value& id)
+ {
+     // Send error reply from json-rpc error object
+     int nStatus = 500;
+     int code = find_value(objError, "code").get_int();
+     if (code == -32600) nStatus = 400;
+     else if (code == -32601) nStatus = 404;
+     string strReply = JSONRPCReply(Value::null, objError, id);
+     stream << HTTPReply(nStatus, strReply) << std::flush;
+ }
+ bool ClientAllowed(const string& strAddress)
+ {
+     if (strAddress == asio::ip::address_v4::loopback().to_string())
+         return true;
+     const vector<string>& vAllow = mapMultiArgs["-rpcallowip"];
+     foreach(string strAllow, vAllow)
+         if (WildcardMatch(strAddress, strAllow))
+             return true;
+     return false;
+ }
+ #ifdef USE_SSL
+ //
+ // IOStream device that speaks SSL but can also speak non-SSL
+ //
+ class SSLIOStreamDevice : public iostreams::device<iostreams::bidirectional> {
+ public:
+     SSLIOStreamDevice(SSLStream &streamIn, bool fUseSSLIn) : stream(streamIn)
+     {
+         fUseSSL = fUseSSLIn;
+         fNeedHandshake = fUseSSLIn;
+     }
+     void handshake(ssl::stream_base::handshake_type role)
+     {
+         if (!fNeedHandshake) return;
+         fNeedHandshake = false;
+         stream.handshake(role);
+     }
+     std::streamsize read(char* s, std::streamsize n)
+     {
+         handshake(ssl::stream_base::server); // HTTPS servers read first
+         if (fUseSSL) return stream.read_some(asio::buffer(s, n));
+         return stream.next_layer().read_some(asio::buffer(s, n));
+     }
+     std::streamsize write(const char* s, std::streamsize n)
+     {
+         handshake(ssl::stream_base::client); // HTTPS clients write first
+         if (fUseSSL) return asio::write(stream, asio::buffer(s, n));
+         return asio::write(stream.next_layer(), asio::buffer(s, n));
+     }
+     bool connect(const std::string& server, const std::string& port)
+     {
+         ip::tcp::resolver resolver(stream.get_io_service());
+         ip::tcp::resolver::query query(server.c_str(), port.c_str());
+         ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
+         ip::tcp::resolver::iterator end;
+         boost::system::error_code error = asio::error::host_not_found;
+         while (error && endpoint_iterator != end)
+         {
+             stream.lowest_layer().close();
+             stream.lowest_layer().connect(*endpoint_iterator++, error);
+         }
+         if (error)
+             return false;
+         return true;
+     }
+ private:
+     bool fNeedHandshake;
+     bool fUseSSL;
+     SSLStream& stream;
+ };
+ #endif
+ void ThreadRPCServer(void* parg)
+ {
+     IMPLEMENT_RANDOMIZE_STACK(ThreadRPCServer(parg));
+     try
+     {
+         vnThreadsRunning[4]++;
+         ThreadRPCServer2(parg);
+         vnThreadsRunning[4]--;
+     }
+     catch (std::exception& e) {
+         vnThreadsRunning[4]--;
+         PrintException(&e, "ThreadRPCServer()");
+     } catch (...) {
+         vnThreadsRunning[4]--;
+         PrintException(NULL, "ThreadRPCServer()");
+     }
+     printf("ThreadRPCServer exiting\n");
+ }
+ void ThreadRPCServer2(void* parg)
+ {
+     printf("ThreadRPCServer started\n");
+     if (mapArgs["-rpcuser"] == "" && mapArgs["-rpcpassword"] == "")
+     {
+         string strWhatAmI = "To use bitcoind";
+         if (mapArgs.count("-server"))
+             strWhatAmI = strprintf(_("To use the %s option"), "\"-server\"");
+         else if (mapArgs.count("-daemon"))
+             strWhatAmI = strprintf(_("To use the %s option"), "\"-daemon\"");
+         PrintConsole(
+             _("Warning: %s, you must set rpcpassword=<password>\nin the configuration file: %s\n"
+               "If the file does not exist, create it with owner-readable-only file permissions.\n"),
+                 strWhatAmI.c_str(),
+                 GetConfigFile().c_str());
+         CreateThread(Shutdown, NULL);
+         return;
+     }
+     bool fUseSSL = GetBoolArg("-rpcssl");
+     asio::ip::address bindAddress = mapArgs.count("-rpcallowip") ? asio::ip::address_v4::any() : asio::ip::address_v4::loopback();
+     asio::io_service io_service;
+     ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", 8332));
+     ip::tcp::acceptor acceptor(io_service, endpoint);
+     acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
+ #ifdef USE_SSL
+     ssl::context context(io_service, ssl::context::sslv23);
+     if (fUseSSL)
+     {
+         context.set_options(ssl::context::no_sslv2);
+         filesystem::path certfile = GetArg("-rpcsslcertificatechainfile", "server.cert");
+         if (!certfile.is_complete()) certfile = filesystem::path(GetDataDir()) / certfile;
+         if (filesystem::exists(certfile)) context.use_certificate_chain_file(certfile.string().c_str());
+         else printf("ThreadRPCServer ERROR: missing server certificate file %s\n", certfile.string().c_str());
+         filesystem::path pkfile = GetArg("-rpcsslprivatekeyfile", "server.pem");
+         if (!pkfile.is_complete()) pkfile = filesystem::path(GetDataDir()) / pkfile;
+         if (filesystem::exists(pkfile)) context.use_private_key_file(pkfile.string().c_str(), ssl::context::pem);
+         else printf("ThreadRPCServer ERROR: missing server private key file %s\n", pkfile.string().c_str());
+         string ciphers = GetArg("-rpcsslciphers",
+                                          "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH");
+         SSL_CTX_set_cipher_list(context.impl(), ciphers.c_str());
+     }
+ #else
+     if (fUseSSL)
+         throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries.");
+ #endif
+     loop
+     {
+         // Accept connection
+ #ifdef USE_SSL
+         SSLStream sslStream(io_service, context);
+         SSLIOStreamDevice d(sslStream, fUseSSL);
+         iostreams::stream<SSLIOStreamDevice> stream(d);
+ #else
+         ip::tcp::iostream stream;
+ #endif
+         ip::tcp::endpoint peer;
+         vnThreadsRunning[4]--;
+ #ifdef USE_SSL
+         acceptor.accept(sslStream.lowest_layer(), peer);
+ #else
+         acceptor.accept(*stream.rdbuf(), peer);
+ #endif
+         vnThreadsRunning[4]++;
+         if (fShutdown)
+             return;
+         // Restrict callers by IP
+         if (!ClientAllowed(peer.address().to_string()))
+             continue;
+         map<string, string> mapHeaders;
+         string strRequest;
+         boost::thread api_caller(ReadHTTP, boost::ref(stream), boost::ref(mapHeaders), boost::ref(strRequest));
+         if (!api_caller.timed_join(boost::posix_time::seconds(GetArg("-rpctimeout", 30))))
+         {   // Timed out:
+             acceptor.cancel();
+             printf("ThreadRPCServer ReadHTTP timeout\n");
+             continue;
+         }
+         // Check authorization
++        if (mapHeaders.count("authorization") == 0)
+         {
+             stream << HTTPReply(401, "") << std::flush;
+             continue;
+         }
+         if (!HTTPAuthorized(mapHeaders))
+         {
+             // Deter brute-forcing short passwords
+             if (mapArgs["-rpcpassword"].size() < 15)
+                 Sleep(50);
+             stream << HTTPReply(401, "") << std::flush;
+             printf("ThreadRPCServer incorrect password attempt\n");
+             continue;
+         }
+         Value id = Value::null;
+         try
+         {
+             // Parse request
+             Value valRequest;
+             if (!read_string(strRequest, valRequest) || valRequest.type() != obj_type)
+                 throw JSONRPCError(-32700, "Parse error");
+             const Object& request = valRequest.get_obj();
+             // Parse id now so errors from here on will have the id
+             id = find_value(request, "id");
+             // Parse method
+             Value valMethod = find_value(request, "method");
+             if (valMethod.type() == null_type)
+                 throw JSONRPCError(-32600, "Missing method");
+             if (valMethod.type() != str_type)
+                 throw JSONRPCError(-32600, "Method must be a string");
+             string strMethod = valMethod.get_str();
+             if (strMethod != "getwork")
+                 printf("ThreadRPCServer method=%s\n", strMethod.c_str());
+             // Parse params
+             Value valParams = find_value(request, "params");
+             Array params;
+             if (valParams.type() == array_type)
+                 params = valParams.get_array();
+             else if (valParams.type() == null_type)
+                 params = Array();
+             else
+                 throw JSONRPCError(-32600, "Params must be an array");
+             // Find method
+             map<string, rpcfn_type>::iterator mi = mapCallTable.find(strMethod);
+             if (mi == mapCallTable.end())
+                 throw JSONRPCError(-32601, "Method not found");
+             // Observe safe mode
+             string strWarning = GetWarnings("rpc");
+             if (strWarning != "" && !GetBoolArg("-disablesafemode") && !setAllowInSafeMode.count(strMethod))
+                 throw JSONRPCError(-2, string("Safe mode: ") + strWarning);
+             try
+             {
+                 // Execute
+                 Value result = (*(*mi).second)(params, false);
+                 // Send reply
+                 string strReply = JSONRPCReply(result, Value::null, id);
+                 stream << HTTPReply(200, strReply) << std::flush;
+             }
+             catch (std::exception& e)
+             {
+                 ErrorReply(stream, JSONRPCError(-1, e.what()), id);
+             }
+         }
+         catch (Object& objError)
+         {
+             ErrorReply(stream, objError, id);
+         }
+         catch (std::exception& e)
+         {
+             ErrorReply(stream, JSONRPCError(-32700, e.what()), id);
+         }
+     }
+ }
+ Object CallRPC(const string& strMethod, const Array& params)
+ {
+     if (mapArgs["-rpcuser"] == "" && mapArgs["-rpcpassword"] == "")
+         throw runtime_error(strprintf(
+             _("You must set rpcpassword=<password> in the configuration file:\n%s\n"
+               "If the file does not exist, create it with owner-readable-only file permissions."),
+                 GetConfigFile().c_str()));
+     // Connect to localhost
+     bool fUseSSL = GetBoolArg("-rpcssl");
+ #ifdef USE_SSL
+     asio::io_service io_service;
+     ssl::context context(io_service, ssl::context::sslv23);
+     context.set_options(ssl::context::no_sslv2);
+     SSLStream sslStream(io_service, context);
+     SSLIOStreamDevice d(sslStream, fUseSSL);
+     iostreams::stream<SSLIOStreamDevice> stream(d);
+     if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332")))
+         throw runtime_error("couldn't connect to server");
+ #else
+     if (fUseSSL)
+         throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries.");
+     ip::tcp::iostream stream(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332"));
+     if (stream.fail())
+         throw runtime_error("couldn't connect to server");
+ #endif
+     // HTTP basic authentication
+     string strUserPass64 = EncodeBase64(mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"]);
+     map<string, string> mapRequestHeaders;
+     mapRequestHeaders["Authorization"] = string("Basic ") + strUserPass64;
+     // Send request
+     string strRequest = JSONRPCRequest(strMethod, params, 1);
+     string strPost = HTTPPost(strRequest, mapRequestHeaders);
+     stream << strPost << std::flush;
+     // Receive reply
+     map<string, string> mapHeaders;
+     string strReply;
+     int nStatus = ReadHTTP(stream, mapHeaders, strReply);
+     if (nStatus == 401)
+         throw runtime_error("incorrect rpcuser or rpcpassword (authorization failed)");
+     else if (nStatus >= 400 && nStatus != 400 && nStatus != 404 && nStatus != 500)
+         throw runtime_error(strprintf("server returned HTTP error %d", nStatus));
+     else if (strReply.empty())
+         throw runtime_error("no response from server");
+     // Parse reply
+     Value valReply;
+     if (!read_string(strReply, valReply))
+         throw runtime_error("couldn't parse reply from server");
+     const Object& reply = valReply.get_obj();
+     if (reply.empty())
+         throw runtime_error("expected reply to have result, error and id properties");
+     return reply;
+ }
+ template<typename T>
+ void ConvertTo(Value& value)
+ {
+     if (value.type() == str_type)
+     {
+         // reinterpret string as unquoted json value
+         Value value2;
+         if (!read_string(value.get_str(), value2))
+             throw runtime_error("type mismatch");
+         value = value2.get_value<T>();
+     }
+     else
+     {
+         value = value.get_value<T>();
+     }
+ }
+ int CommandLineRPC(int argc, char *argv[])
+ {
+     string strPrint;
+     int nRet = 0;
+     try
+     {
+         // Skip switches
+         while (argc > 1 && IsSwitchChar(argv[1][0]))
+         {
+             argc--;
+             argv++;
+         }
+         // Method
+         if (argc < 2)
+             throw runtime_error("too few parameters");
+         string strMethod = argv[1];
+         // Parameters default to strings
+         Array params;
+         for (int i = 2; i < argc; i++)
+             params.push_back(argv[i]);
+         int n = params.size();
+         //
+         // Special case non-string parameter types
+         //
+         if (strMethod == "setgenerate"            && n > 0) ConvertTo<bool>(params[0]);
+         if (strMethod == "setgenerate"            && n > 1) ConvertTo<boost::int64_t>(params[1]);
+         if (strMethod == "sendtoaddress"          && n > 1) ConvertTo<double>(params[1]);
+         if (strMethod == "getamountreceived"      && n > 1) ConvertTo<boost::int64_t>(params[1]); // deprecated
+         if (strMethod == "getreceivedbyaddress"   && n > 1) ConvertTo<boost::int64_t>(params[1]);
+         if (strMethod == "getreceivedbyaccount"   && n > 1) ConvertTo<boost::int64_t>(params[1]);
+         if (strMethod == "getreceivedbylabel"     && n > 1) ConvertTo<boost::int64_t>(params[1]); // deprecated
+         if (strMethod == "getallreceived"         && n > 0) ConvertTo<boost::int64_t>(params[0]); // deprecated
+         if (strMethod == "getallreceived"         && n > 1) ConvertTo<bool>(params[1]);
+         if (strMethod == "listreceivedbyaddress"  && n > 0) ConvertTo<boost::int64_t>(params[0]);
+         if (strMethod == "listreceivedbyaddress"  && n > 1) ConvertTo<bool>(params[1]);
+         if (strMethod == "listreceivedbyaccount"  && n > 0) ConvertTo<boost::int64_t>(params[0]);
+         if (strMethod == "listreceivedbyaccount"  && n > 1) ConvertTo<bool>(params[1]);
+         if (strMethod == "listreceivedbylabel"    && n > 0) ConvertTo<boost::int64_t>(params[0]); // deprecated
+         if (strMethod == "listreceivedbylabel"    && n > 1) ConvertTo<bool>(params[1]); // deprecated
+         if (strMethod == "getbalance"             && n > 1) ConvertTo<boost::int64_t>(params[1]);
+         if (strMethod == "move"                   && n > 2) ConvertTo<double>(params[2]);
+         if (strMethod == "move"                   && n > 3) ConvertTo<boost::int64_t>(params[3]);
+         if (strMethod == "sendfrom"               && n > 2) ConvertTo<double>(params[2]);
+         if (strMethod == "sendfrom"               && n > 3) ConvertTo<boost::int64_t>(params[3]);
+         if (strMethod == "listtransactions"       && n > 1) ConvertTo<boost::int64_t>(params[1]);
++        if (strMethod == "listtransactions"       && n > 2) ConvertTo<boost::int64_t>(params[2]);
+         if (strMethod == "listaccounts"           && n > 0) ConvertTo<boost::int64_t>(params[0]);
+         if (strMethod == "sendmany"               && n > 1)
+         {
+             string s = params[1].get_str();
+             Value v;
+             if (!read_string(s, v) || v.type() != obj_type)
+                 throw runtime_error("type mismatch");
+             params[1] = v.get_obj();
+         }
+         if (strMethod == "sendmany"                && n > 2) ConvertTo<boost::int64_t>(params[2]);
+         // Execute
+         Object reply = CallRPC(strMethod, params);
+         // Parse reply
+         const Value& result = find_value(reply, "result");
+         const Value& error  = find_value(reply, "error");
+         const Value& id     = find_value(reply, "id");
+         if (error.type() != null_type)
+         {
+             // Error
+             strPrint = "error: " + write_string(error, false);
+             int code = find_value(error.get_obj(), "code").get_int();
+             nRet = abs(code);
+         }
+         else
+         {
+             // Result
+             if (result.type() == null_type)
+                 strPrint = "";
+             else if (result.type() == str_type)
+                 strPrint = result.get_str();
+             else
+                 strPrint = write_string(result, true);
+         }
+     }
+     catch (std::exception& e)
+     {
+         strPrint = string("error: ") + e.what();
+         nRet = 87;
+     }
+     catch (...)
+     {
+         PrintException(NULL, "CommandLineRPC()");
+     }
+     if (strPrint != "")
+     {
+ #if defined(__WXMSW__) && defined(GUI)
+         // Windows GUI apps can't print to command line,
+         // so settle for a message box yuck
+         MyMessageBox(strPrint, "Bitcoin", wxOK);
+ #else
+         fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str());
+ #endif
+     }
+     return nRet;
+ }
+ #ifdef TEST
+ int main(int argc, char *argv[])
+ {
+ #ifdef _MSC_VER
+     // Turn off microsoft heap dump noise
+     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+     _CrtSetReportFile(_CRT_WARN, CreateFile("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
+ #endif
+     setbuf(stdin, NULL);
+     setbuf(stdout, NULL);
+     setbuf(stderr, NULL);
+     try
+     {
+         if (argc >= 2 && string(argv[1]) == "-server")
+         {
+             printf("server ready\n");
+             ThreadRPCServer(NULL);
+         }
+         else
+         {
+             return CommandLineRPC(argc, argv);
+         }
+     }
+     catch (std::exception& e) {
+         PrintException(&e, "main()");
+     } catch (...) {
+         PrintException(NULL, "main()");
+     }
+     return 0;
+ }
+ #endif
diff --cc src/serialize.h
index 0000000000000000000000000000000000000000,383c9878647f39c33d6a44427394bff0338276cd..ee39c0703dba114c97442d32ccfdeb524c146109
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1261 +1,1261 @@@
 -static const int VERSION = 32100;
+ // Copyright (c) 2009-2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ #include <string>
+ #include <vector>
+ #include <map>
+ #include <set>
+ #include <boost/type_traits/is_fundamental.hpp>
+ #include <boost/tuple/tuple.hpp>
+ #include <boost/tuple/tuple_comparison.hpp>
+ #include <boost/tuple/tuple_io.hpp>
+ #if defined(_MSC_VER) || defined(__BORLANDC__)
+ typedef __int64  int64;
+ typedef unsigned __int64  uint64;
+ #else
+ typedef long long  int64;
+ typedef unsigned long long  uint64;
+ #endif
+ #if defined(_MSC_VER) && _MSC_VER < 1300
+ #define for  if (false) ; else for
+ #endif
+ class CScript;
+ class CDataStream;
+ class CAutoFile;
+ static const unsigned int MAX_SIZE = 0x02000000;
++static const int VERSION = 32200;
+ static const char* pszSubVer = "";
+ static const bool VERSION_IS_BETA = true;
+ /////////////////////////////////////////////////////////////////
+ //
+ // Templates for serializing to anything that looks like a stream,
+ // i.e. anything that supports .read(char*, int) and .write(char*, int)
+ //
+ enum
+ {
+     // primary actions
+     SER_NETWORK         = (1 << 0),
+     SER_DISK            = (1 << 1),
+     SER_GETHASH         = (1 << 2),
+     // modifiers
+     SER_SKIPSIG         = (1 << 16),
+     SER_BLOCKHEADERONLY = (1 << 17),
+ };
+ #define IMPLEMENT_SERIALIZE(statements)    \
+     unsigned int GetSerializeSize(int nType=0, int nVersion=VERSION) const  \
+     {                                           \
+         CSerActionGetSerializeSize ser_action;  \
+         const bool fGetSize = true;             \
+         const bool fWrite = false;              \
+         const bool fRead = false;               \
+         unsigned int nSerSize = 0;              \
+         ser_streamplaceholder s;                \
+         s.nType = nType;                        \
+         s.nVersion = nVersion;                  \
+         {statements}                            \
+         return nSerSize;                        \
+     }                                           \
+     template<typename Stream>                   \
+     void Serialize(Stream& s, int nType=0, int nVersion=VERSION) const  \
+     {                                           \
+         CSerActionSerialize ser_action;         \
+         const bool fGetSize = false;            \
+         const bool fWrite = true;               \
+         const bool fRead = false;               \
+         unsigned int nSerSize = 0;              \
+         {statements}                            \
+     }                                           \
+     template<typename Stream>                   \
+     void Unserialize(Stream& s, int nType=0, int nVersion=VERSION)  \
+     {                                           \
+         CSerActionUnserialize ser_action;       \
+         const bool fGetSize = false;            \
+         const bool fWrite = false;              \
+         const bool fRead = true;                \
+         unsigned int nSerSize = 0;              \
+         {statements}                            \
+     }
+ #define READWRITE(obj)      (nSerSize += ::SerReadWrite(s, (obj), nType, nVersion, ser_action))
+ //
+ // Basic types
+ //
+ #define WRITEDATA(s, obj)   s.write((char*)&(obj), sizeof(obj))
+ #define READDATA(s, obj)    s.read((char*)&(obj), sizeof(obj))
+ inline unsigned int GetSerializeSize(char a,           int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(signed char a,    int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(unsigned char a,  int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(signed short a,   int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(unsigned short a, int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(signed int a,     int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(unsigned int a,   int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(signed long a,    int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(unsigned long a,  int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(int64 a,          int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(uint64 a,         int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(float a,          int, int=0) { return sizeof(a); }
+ inline unsigned int GetSerializeSize(double a,         int, int=0) { return sizeof(a); }
+ template<typename Stream> inline void Serialize(Stream& s, char a,           int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, signed char a,    int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, unsigned char a,  int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, signed short a,   int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, unsigned short a, int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, signed int a,     int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, unsigned int a,   int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, signed long a,    int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, unsigned long a,  int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, int64 a,          int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, uint64 a,         int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, float a,          int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Serialize(Stream& s, double a,         int, int=0) { WRITEDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, char& a,           int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, signed char& a,    int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, unsigned char& a,  int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, signed short& a,   int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, unsigned short& a, int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, signed int& a,     int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, unsigned int& a,   int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, signed long& a,    int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, unsigned long& a,  int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, int64& a,          int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, uint64& a,         int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, float& a,          int, int=0) { READDATA(s, a); }
+ template<typename Stream> inline void Unserialize(Stream& s, double& a,         int, int=0) { READDATA(s, a); }
+ inline unsigned int GetSerializeSize(bool a, int, int=0)                          { return sizeof(char); }
+ template<typename Stream> inline void Serialize(Stream& s, bool a, int, int=0)    { char f=a; WRITEDATA(s, f); }
+ template<typename Stream> inline void Unserialize(Stream& s, bool& a, int, int=0) { char f; READDATA(s, f); a=f; }
+ //
+ // Compact size
+ //  size <  253        -- 1 byte
+ //  size <= USHRT_MAX  -- 3 bytes  (253 + 2 bytes)
+ //  size <= UINT_MAX   -- 5 bytes  (254 + 4 bytes)
+ //  size >  UINT_MAX   -- 9 bytes  (255 + 8 bytes)
+ //
+ inline unsigned int GetSizeOfCompactSize(uint64 nSize)
+ {
+     if (nSize < 253)             return sizeof(unsigned char);
+     else if (nSize <= USHRT_MAX) return sizeof(unsigned char) + sizeof(unsigned short);
+     else if (nSize <= UINT_MAX)  return sizeof(unsigned char) + sizeof(unsigned int);
+     else                         return sizeof(unsigned char) + sizeof(uint64);
+ }
+ template<typename Stream>
+ void WriteCompactSize(Stream& os, uint64 nSize)
+ {
+     if (nSize < 253)
+     {
+         unsigned char chSize = nSize;
+         WRITEDATA(os, chSize);
+     }
+     else if (nSize <= USHRT_MAX)
+     {
+         unsigned char chSize = 253;
+         unsigned short xSize = nSize;
+         WRITEDATA(os, chSize);
+         WRITEDATA(os, xSize);
+     }
+     else if (nSize <= UINT_MAX)
+     {
+         unsigned char chSize = 254;
+         unsigned int xSize = nSize;
+         WRITEDATA(os, chSize);
+         WRITEDATA(os, xSize);
+     }
+     else
+     {
+         unsigned char chSize = 255;
+         uint64 xSize = nSize;
+         WRITEDATA(os, chSize);
+         WRITEDATA(os, xSize);
+     }
+     return;
+ }
+ template<typename Stream>
+ uint64 ReadCompactSize(Stream& is)
+ {
+     unsigned char chSize;
+     READDATA(is, chSize);
+     uint64 nSizeRet = 0;
+     if (chSize < 253)
+     {
+         nSizeRet = chSize;
+     }
+     else if (chSize == 253)
+     {
+         unsigned short xSize;
+         READDATA(is, xSize);
+         nSizeRet = xSize;
+     }
+     else if (chSize == 254)
+     {
+         unsigned int xSize;
+         READDATA(is, xSize);
+         nSizeRet = xSize;
+     }
+     else
+     {
+         uint64 xSize;
+         READDATA(is, xSize);
+         nSizeRet = xSize;
+     }
+     if (nSizeRet > (uint64)MAX_SIZE)
+         throw std::ios_base::failure("ReadCompactSize() : size too large");
+     return nSizeRet;
+ }
+ //
+ // Wrapper for serializing arrays and POD
+ // There's a clever template way to make arrays serialize normally, but MSVC6 doesn't support it
+ //
+ #define FLATDATA(obj)   REF(CFlatData((char*)&(obj), (char*)&(obj) + sizeof(obj)))
+ class CFlatData
+ {
+ protected:
+     char* pbegin;
+     char* pend;
+ public:
+     CFlatData(void* pbeginIn, void* pendIn) : pbegin((char*)pbeginIn), pend((char*)pendIn) { }
+     char* begin() { return pbegin; }
+     const char* begin() const { return pbegin; }
+     char* end() { return pend; }
+     const char* end() const { return pend; }
+     unsigned int GetSerializeSize(int, int=0) const
+     {
+         return pend - pbegin;
+     }
+     template<typename Stream>
+     void Serialize(Stream& s, int, int=0) const
+     {
+         s.write(pbegin, pend - pbegin);
+     }
+     template<typename Stream>
+     void Unserialize(Stream& s, int, int=0)
+     {
+         s.read(pbegin, pend - pbegin);
+     }
+ };
+ //
+ // string stored as a fixed length field
+ //
+ template<std::size_t LEN>
+ class CFixedFieldString
+ {
+ protected:
+     const string* pcstr;
+     string* pstr;
+ public:
+     explicit CFixedFieldString(const string& str) : pcstr(&str), pstr(NULL) { }
+     explicit CFixedFieldString(string& str) : pcstr(&str), pstr(&str) { }
+     unsigned int GetSerializeSize(int, int=0) const
+     {
+         return LEN;
+     }
+     template<typename Stream>
+     void Serialize(Stream& s, int, int=0) const
+     {
+         char pszBuf[LEN];
+         strncpy(pszBuf, pcstr->c_str(), LEN);
+         s.write(pszBuf, LEN);
+     }
+     template<typename Stream>
+     void Unserialize(Stream& s, int, int=0)
+     {
+         if (pstr == NULL)
+             throw std::ios_base::failure("CFixedFieldString::Unserialize : trying to unserialize to const string");
+         char pszBuf[LEN+1];
+         s.read(pszBuf, LEN);
+         pszBuf[LEN] = '\0';
+         *pstr = pszBuf;
+     }
+ };
+ //
+ // Forward declarations
+ //
+ // string
+ template<typename C> unsigned int GetSerializeSize(const basic_string<C>& str, int, int=0);
+ template<typename Stream, typename C> void Serialize(Stream& os, const basic_string<C>& str, int, int=0);
+ template<typename Stream, typename C> void Unserialize(Stream& is, basic_string<C>& str, int, int=0);
+ // vector
+ template<typename T, typename A> unsigned int GetSerializeSize_impl(const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&);
+ template<typename T, typename A> unsigned int GetSerializeSize_impl(const std::vector<T, A>& v, int nType, int nVersion, const boost::false_type&);
+ template<typename T, typename A> inline unsigned int GetSerializeSize(const std::vector<T, A>& v, int nType, int nVersion=VERSION);
+ template<typename Stream, typename T, typename A> void Serialize_impl(Stream& os, const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&);
+ template<typename Stream, typename T, typename A> void Serialize_impl(Stream& os, const std::vector<T, A>& v, int nType, int nVersion, const boost::false_type&);
+ template<typename Stream, typename T, typename A> inline void Serialize(Stream& os, const std::vector<T, A>& v, int nType, int nVersion=VERSION);
+ template<typename Stream, typename T, typename A> void Unserialize_impl(Stream& is, std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&);
+ template<typename Stream, typename T, typename A> void Unserialize_impl(Stream& is, std::vector<T, A>& v, int nType, int nVersion, const boost::false_type&);
+ template<typename Stream, typename T, typename A> inline void Unserialize(Stream& is, std::vector<T, A>& v, int nType, int nVersion=VERSION);
+ // others derived from vector
+ extern inline unsigned int GetSerializeSize(const CScript& v, int nType, int nVersion=VERSION);
+ template<typename Stream> void Serialize(Stream& os, const CScript& v, int nType, int nVersion=VERSION);
+ template<typename Stream> void Unserialize(Stream& is, CScript& v, int nType, int nVersion=VERSION);
+ // pair
+ template<typename K, typename T> unsigned int GetSerializeSize(const std::pair<K, T>& item, int nType, int nVersion=VERSION);
+ template<typename Stream, typename K, typename T> void Serialize(Stream& os, const std::pair<K, T>& item, int nType, int nVersion=VERSION);
+ template<typename Stream, typename K, typename T> void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion=VERSION);
+ // 3 tuple
+ template<typename T0, typename T1, typename T2> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
+ template<typename Stream, typename T0, typename T1, typename T2> void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
+ template<typename Stream, typename T0, typename T1, typename T2> void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
+ // 4 tuple
+ template<typename T0, typename T1, typename T2, typename T3> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
+ template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
+ template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
+ // map
+ template<typename K, typename T, typename Pred, typename A> unsigned int GetSerializeSize(const std::map<K, T, Pred, A>& m, int nType, int nVersion=VERSION);
+ template<typename Stream, typename K, typename T, typename Pred, typename A> void Serialize(Stream& os, const std::map<K, T, Pred, A>& m, int nType, int nVersion=VERSION);
+ template<typename Stream, typename K, typename T, typename Pred, typename A> void Unserialize(Stream& is, std::map<K, T, Pred, A>& m, int nType, int nVersion=VERSION);
+ // set
+ template<typename K, typename Pred, typename A> unsigned int GetSerializeSize(const std::set<K, Pred, A>& m, int nType, int nVersion=VERSION);
+ template<typename Stream, typename K, typename Pred, typename A> void Serialize(Stream& os, const std::set<K, Pred, A>& m, int nType, int nVersion=VERSION);
+ template<typename Stream, typename K, typename Pred, typename A> void Unserialize(Stream& is, std::set<K, Pred, A>& m, int nType, int nVersion=VERSION);
+ //
+ // If none of the specialized versions above matched, default to calling member function.
+ // "int nType" is changed to "long nType" to keep from getting an ambiguous overload error.
+ // The compiler will only cast int to long if none of the other templates matched.
+ // Thanks to Boost serialization for this idea.
+ //
+ template<typename T>
+ inline unsigned int GetSerializeSize(const T& a, long nType, int nVersion=VERSION)
+ {
+     return a.GetSerializeSize((int)nType, nVersion);
+ }
+ template<typename Stream, typename T>
+ inline void Serialize(Stream& os, const T& a, long nType, int nVersion=VERSION)
+ {
+     a.Serialize(os, (int)nType, nVersion);
+ }
+ template<typename Stream, typename T>
+ inline void Unserialize(Stream& is, T& a, long nType, int nVersion=VERSION)
+ {
+     a.Unserialize(is, (int)nType, nVersion);
+ }
+ //
+ // string
+ //
+ template<typename C>
+ unsigned int GetSerializeSize(const basic_string<C>& str, int, int)
+ {
+     return GetSizeOfCompactSize(str.size()) + str.size() * sizeof(str[0]);
+ }
+ template<typename Stream, typename C>
+ void Serialize(Stream& os, const basic_string<C>& str, int, int)
+ {
+     WriteCompactSize(os, str.size());
+     if (!str.empty())
+         os.write((char*)&str[0], str.size() * sizeof(str[0]));
+ }
+ template<typename Stream, typename C>
+ void Unserialize(Stream& is, basic_string<C>& str, int, int)
+ {
+     unsigned int nSize = ReadCompactSize(is);
+     str.resize(nSize);
+     if (nSize != 0)
+         is.read((char*)&str[0], nSize * sizeof(str[0]));
+ }
+ //
+ // vector
+ //
+ template<typename T, typename A>
+ unsigned int GetSerializeSize_impl(const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
+ {
+     return (GetSizeOfCompactSize(v.size()) + v.size() * sizeof(T));
+ }
+ template<typename T, typename A>
+ unsigned int GetSerializeSize_impl(const std::vector<T, A>& v, int nType, int nVersion, const boost::false_type&)
+ {
+     unsigned int nSize = GetSizeOfCompactSize(v.size());
+     for (typename std::vector<T, A>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
+         nSize += GetSerializeSize((*vi), nType, nVersion);
+     return nSize;
+ }
+ template<typename T, typename A>
+ inline unsigned int GetSerializeSize(const std::vector<T, A>& v, int nType, int nVersion)
+ {
+     return GetSerializeSize_impl(v, nType, nVersion, boost::is_fundamental<T>());
+ }
+ template<typename Stream, typename T, typename A>
+ void Serialize_impl(Stream& os, const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
+ {
+     WriteCompactSize(os, v.size());
+     if (!v.empty())
+         os.write((char*)&v[0], v.size() * sizeof(T));
+ }
+ template<typename Stream, typename T, typename A>
+ void Serialize_impl(Stream& os, const std::vector<T, A>& v, int nType, int nVersion, const boost::false_type&)
+ {
+     WriteCompactSize(os, v.size());
+     for (typename std::vector<T, A>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
+         ::Serialize(os, (*vi), nType, nVersion);
+ }
+ template<typename Stream, typename T, typename A>
+ inline void Serialize(Stream& os, const std::vector<T, A>& v, int nType, int nVersion)
+ {
+     Serialize_impl(os, v, nType, nVersion, boost::is_fundamental<T>());
+ }
+ template<typename Stream, typename T, typename A>
+ void Unserialize_impl(Stream& is, std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
+ {
+     //unsigned int nSize = ReadCompactSize(is);
+     //v.resize(nSize);
+     //is.read((char*)&v[0], nSize * sizeof(T));
+     // Limit size per read so bogus size value won't cause out of memory
+     v.clear();
+     unsigned int nSize = ReadCompactSize(is);
+     unsigned int i = 0;
+     while (i < nSize)
+     {
+         unsigned int blk = min(nSize - i, (unsigned int)(1 + 4999999 / sizeof(T)));
+         v.resize(i + blk);
+         is.read((char*)&v[i], blk * sizeof(T));
+         i += blk;
+     }
+ }
+ template<typename Stream, typename T, typename A>
+ void Unserialize_impl(Stream& is, std::vector<T, A>& v, int nType, int nVersion, const boost::false_type&)
+ {
+     //unsigned int nSize = ReadCompactSize(is);
+     //v.resize(nSize);
+     //for (std::vector<T, A>::iterator vi = v.begin(); vi != v.end(); ++vi)
+     //    Unserialize(is, (*vi), nType, nVersion);
+     v.clear();
+     unsigned int nSize = ReadCompactSize(is);
+     unsigned int i = 0;
+     unsigned int nMid = 0;
+     while (nMid < nSize)
+     {
+         nMid += 5000000 / sizeof(T);
+         if (nMid > nSize)
+             nMid = nSize;
+         v.resize(nMid);
+         for (; i < nMid; i++)
+             Unserialize(is, v[i], nType, nVersion);
+     }
+ }
+ template<typename Stream, typename T, typename A>
+ inline void Unserialize(Stream& is, std::vector<T, A>& v, int nType, int nVersion)
+ {
+     Unserialize_impl(is, v, nType, nVersion, boost::is_fundamental<T>());
+ }
+ //
+ // others derived from vector
+ //
+ inline unsigned int GetSerializeSize(const CScript& v, int nType, int nVersion)
+ {
+     return GetSerializeSize((const vector<unsigned char>&)v, nType, nVersion);
+ }
+ template<typename Stream>
+ void Serialize(Stream& os, const CScript& v, int nType, int nVersion)
+ {
+     Serialize(os, (const vector<unsigned char>&)v, nType, nVersion);
+ }
+ template<typename Stream>
+ void Unserialize(Stream& is, CScript& v, int nType, int nVersion)
+ {
+     Unserialize(is, (vector<unsigned char>&)v, nType, nVersion);
+ }
+ //
+ // pair
+ //
+ template<typename K, typename T>
+ unsigned int GetSerializeSize(const std::pair<K, T>& item, int nType, int nVersion)
+ {
+     return GetSerializeSize(item.first, nType, nVersion) + GetSerializeSize(item.second, nType, nVersion);
+ }
+ template<typename Stream, typename K, typename T>
+ void Serialize(Stream& os, const std::pair<K, T>& item, int nType, int nVersion)
+ {
+     Serialize(os, item.first, nType, nVersion);
+     Serialize(os, item.second, nType, nVersion);
+ }
+ template<typename Stream, typename K, typename T>
+ void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion)
+ {
+     Unserialize(is, item.first, nType, nVersion);
+     Unserialize(is, item.second, nType, nVersion);
+ }
+ //
+ // 3 tuple
+ //
+ template<typename T0, typename T1, typename T2>
+ unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
+ {
+     unsigned int nSize = 0;
+     nSize += GetSerializeSize(get<0>(item), nType, nVersion);
+     nSize += GetSerializeSize(get<1>(item), nType, nVersion);
+     nSize += GetSerializeSize(get<2>(item), nType, nVersion);
+     return nSize;
+ }
+ template<typename Stream, typename T0, typename T1, typename T2>
+ void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
+ {
+     Serialize(os, get<0>(item), nType, nVersion);
+     Serialize(os, get<1>(item), nType, nVersion);
+     Serialize(os, get<2>(item), nType, nVersion);
+ }
+ template<typename Stream, typename T0, typename T1, typename T2>
+ void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
+ {
+     Unserialize(is, get<0>(item), nType, nVersion);
+     Unserialize(is, get<1>(item), nType, nVersion);
+     Unserialize(is, get<2>(item), nType, nVersion);
+ }
+ //
+ // 4 tuple
+ //
+ template<typename T0, typename T1, typename T2, typename T3>
+ unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
+ {
+     unsigned int nSize = 0;
+     nSize += GetSerializeSize(get<0>(item), nType, nVersion);
+     nSize += GetSerializeSize(get<1>(item), nType, nVersion);
+     nSize += GetSerializeSize(get<2>(item), nType, nVersion);
+     nSize += GetSerializeSize(get<3>(item), nType, nVersion);
+     return nSize;
+ }
+ template<typename Stream, typename T0, typename T1, typename T2, typename T3>
+ void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
+ {
+     Serialize(os, get<0>(item), nType, nVersion);
+     Serialize(os, get<1>(item), nType, nVersion);
+     Serialize(os, get<2>(item), nType, nVersion);
+     Serialize(os, get<3>(item), nType, nVersion);
+ }
+ template<typename Stream, typename T0, typename T1, typename T2, typename T3>
+ void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
+ {
+     Unserialize(is, get<0>(item), nType, nVersion);
+     Unserialize(is, get<1>(item), nType, nVersion);
+     Unserialize(is, get<2>(item), nType, nVersion);
+     Unserialize(is, get<3>(item), nType, nVersion);
+ }
+ //
+ // map
+ //
+ template<typename K, typename T, typename Pred, typename A>
+ unsigned int GetSerializeSize(const std::map<K, T, Pred, A>& m, int nType, int nVersion)
+ {
+     unsigned int nSize = GetSizeOfCompactSize(m.size());
+     for (typename std::map<K, T, Pred, A>::const_iterator mi = m.begin(); mi != m.end(); ++mi)
+         nSize += GetSerializeSize((*mi), nType, nVersion);
+     return nSize;
+ }
+ template<typename Stream, typename K, typename T, typename Pred, typename A>
+ void Serialize(Stream& os, const std::map<K, T, Pred, A>& m, int nType, int nVersion)
+ {
+     WriteCompactSize(os, m.size());
+     for (typename std::map<K, T, Pred, A>::const_iterator mi = m.begin(); mi != m.end(); ++mi)
+         Serialize(os, (*mi), nType, nVersion);
+ }
+ template<typename Stream, typename K, typename T, typename Pred, typename A>
+ void Unserialize(Stream& is, std::map<K, T, Pred, A>& m, int nType, int nVersion)
+ {
+     m.clear();
+     unsigned int nSize = ReadCompactSize(is);
+     typename std::map<K, T, Pred, A>::iterator mi = m.begin();
+     for (unsigned int i = 0; i < nSize; i++)
+     {
+         pair<K, T> item;
+         Unserialize(is, item, nType, nVersion);
+         mi = m.insert(mi, item);
+     }
+ }
+ //
+ // set
+ //
+ template<typename K, typename Pred, typename A>
+ unsigned int GetSerializeSize(const std::set<K, Pred, A>& m, int nType, int nVersion)
+ {
+     unsigned int nSize = GetSizeOfCompactSize(m.size());
+     for (typename std::set<K, Pred, A>::const_iterator it = m.begin(); it != m.end(); ++it)
+         nSize += GetSerializeSize((*it), nType, nVersion);
+     return nSize;
+ }
+ template<typename Stream, typename K, typename Pred, typename A>
+ void Serialize(Stream& os, const std::set<K, Pred, A>& m, int nType, int nVersion)
+ {
+     WriteCompactSize(os, m.size());
+     for (typename std::set<K, Pred, A>::const_iterator it = m.begin(); it != m.end(); ++it)
+         Serialize(os, (*it), nType, nVersion);
+ }
+ template<typename Stream, typename K, typename Pred, typename A>
+ void Unserialize(Stream& is, std::set<K, Pred, A>& m, int nType, int nVersion)
+ {
+     m.clear();
+     unsigned int nSize = ReadCompactSize(is);
+     typename std::set<K, Pred, A>::iterator it = m.begin();
+     for (unsigned int i = 0; i < nSize; i++)
+     {
+         K key;
+         Unserialize(is, key, nType, nVersion);
+         it = m.insert(it, key);
+     }
+ }
+ //
+ // Support for IMPLEMENT_SERIALIZE and READWRITE macro
+ //
+ class CSerActionGetSerializeSize { };
+ class CSerActionSerialize { };
+ class CSerActionUnserialize { };
+ template<typename Stream, typename T>
+ inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionGetSerializeSize ser_action)
+ {
+     return ::GetSerializeSize(obj, nType, nVersion);
+ }
+ template<typename Stream, typename T>
+ inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionSerialize ser_action)
+ {
+     ::Serialize(s, obj, nType, nVersion);
+     return 0;
+ }
+ template<typename Stream, typename T>
+ inline unsigned int SerReadWrite(Stream& s, T& obj, int nType, int nVersion, CSerActionUnserialize ser_action)
+ {
+     ::Unserialize(s, obj, nType, nVersion);
+     return 0;
+ }
+ struct ser_streamplaceholder
+ {
+     int nType;
+     int nVersion;
+ };
+ //
+ // Allocator that clears its contents before deletion
+ //
+ template<typename T>
+ struct secure_allocator : public std::allocator<T>
+ {
+     // MSVC8 default copy constructor is broken
+     typedef std::allocator<T> base;
+     typedef typename base::size_type size_type;
+     typedef typename base::difference_type  difference_type;
+     typedef typename base::pointer pointer;
+     typedef typename base::const_pointer const_pointer;
+     typedef typename base::reference reference;
+     typedef typename base::const_reference const_reference;
+     typedef typename base::value_type value_type;
+     secure_allocator() throw() {}
+     secure_allocator(const secure_allocator& a) throw() : base(a) {}
+     template <typename U>
+     secure_allocator(const secure_allocator<U>& a) throw() : base(a) {}
+     ~secure_allocator() throw() {}
+     template<typename _Other> struct rebind
+     { typedef secure_allocator<_Other> other; };
+     void deallocate(T* p, std::size_t n)
+     {
+         if (p != NULL)
+             memset(p, 0, sizeof(T) * n);
+         allocator<T>::deallocate(p, n);
+     }
+ };
+ //
+ // Double ended buffer combining vector and stream-like interfaces.
+ // >> and << read and write unformatted data using the above serialization templates.
+ // Fills with data in linear time; some stringstream implementations take N^2 time.
+ //
+ class CDataStream
+ {
+ protected:
+     typedef vector<char, secure_allocator<char> > vector_type;
+     vector_type vch;
+     unsigned int nReadPos;
+     short state;
+     short exceptmask;
+ public:
+     int nType;
+     int nVersion;
+     typedef vector_type::allocator_type   allocator_type;
+     typedef vector_type::size_type        size_type;
+     typedef vector_type::difference_type  difference_type;
+     typedef vector_type::reference        reference;
+     typedef vector_type::const_reference  const_reference;
+     typedef vector_type::value_type       value_type;
+     typedef vector_type::iterator         iterator;
+     typedef vector_type::const_iterator   const_iterator;
+     typedef vector_type::reverse_iterator reverse_iterator;
+     explicit CDataStream(int nTypeIn=SER_NETWORK, int nVersionIn=VERSION)
+     {
+         Init(nTypeIn, nVersionIn);
+     }
+     CDataStream(const_iterator pbegin, const_iterator pend, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(pbegin, pend)
+     {
+         Init(nTypeIn, nVersionIn);
+     }
+ #if !defined(_MSC_VER) || _MSC_VER >= 1300
+     CDataStream(const char* pbegin, const char* pend, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(pbegin, pend)
+     {
+         Init(nTypeIn, nVersionIn);
+     }
+ #endif
+     CDataStream(const vector_type& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
+     {
+         Init(nTypeIn, nVersionIn);
+     }
+     CDataStream(const vector<char>& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
+     {
+         Init(nTypeIn, nVersionIn);
+     }
+     CDataStream(const vector<unsigned char>& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch((char*)&vchIn.begin()[0], (char*)&vchIn.end()[0])
+     {
+         Init(nTypeIn, nVersionIn);
+     }
+     void Init(int nTypeIn=SER_NETWORK, int nVersionIn=VERSION)
+     {
+         nReadPos = 0;
+         nType = nTypeIn;
+         nVersion = nVersionIn;
+         state = 0;
+         exceptmask = ios::badbit | ios::failbit;
+     }
+     CDataStream& operator+=(const CDataStream& b)
+     {
+         vch.insert(vch.end(), b.begin(), b.end());
+         return *this;
+     }
+     friend CDataStream operator+(const CDataStream& a, const CDataStream& b)
+     {
+         CDataStream ret = a;
+         ret += b;
+         return (ret);
+     }
+     string str() const
+     {
+         return (string(begin(), end()));
+     }
+     //
+     // Vector subset
+     //
+     const_iterator begin() const                     { return vch.begin() + nReadPos; }
+     iterator begin()                                 { return vch.begin() + nReadPos; }
+     const_iterator end() const                       { return vch.end(); }
+     iterator end()                                   { return vch.end(); }
+     size_type size() const                           { return vch.size() - nReadPos; }
+     bool empty() const                               { return vch.size() == nReadPos; }
+     void resize(size_type n, value_type c=0)         { vch.resize(n + nReadPos, c); }
+     void reserve(size_type n)                        { vch.reserve(n + nReadPos); }
+     const_reference operator[](size_type pos) const  { return vch[pos + nReadPos]; }
+     reference operator[](size_type pos)              { return vch[pos + nReadPos]; }
+     void clear()                                     { vch.clear(); nReadPos = 0; }
+     iterator insert(iterator it, const char& x=char()) { return vch.insert(it, x); }
+     void insert(iterator it, size_type n, const char& x) { vch.insert(it, n, x); }
+     void insert(iterator it, const_iterator first, const_iterator last)
+     {
+         if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+         {
+             // special case for inserting at the front when there's room
+             nReadPos -= (last - first);
+             memcpy(&vch[nReadPos], &first[0], last - first);
+         }
+         else
+             vch.insert(it, first, last);
+     }
+     void insert(iterator it, vector<char>::const_iterator first, vector<char>::const_iterator last)
+     {
+         if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+         {
+             // special case for inserting at the front when there's room
+             nReadPos -= (last - first);
+             memcpy(&vch[nReadPos], &first[0], last - first);
+         }
+         else
+             vch.insert(it, first, last);
+     }
+ #if !defined(_MSC_VER) || _MSC_VER >= 1300
+     void insert(iterator it, const char* first, const char* last)
+     {
+         if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+         {
+             // special case for inserting at the front when there's room
+             nReadPos -= (last - first);
+             memcpy(&vch[nReadPos], &first[0], last - first);
+         }
+         else
+             vch.insert(it, first, last);
+     }
+ #endif
+     iterator erase(iterator it)
+     {
+         if (it == vch.begin() + nReadPos)
+         {
+             // special case for erasing from the front
+             if (++nReadPos >= vch.size())
+             {
+                 // whenever we reach the end, we take the opportunity to clear the buffer
+                 nReadPos = 0;
+                 return vch.erase(vch.begin(), vch.end());
+             }
+             return vch.begin() + nReadPos;
+         }
+         else
+             return vch.erase(it);
+     }
+     iterator erase(iterator first, iterator last)
+     {
+         if (first == vch.begin() + nReadPos)
+         {
+             // special case for erasing from the front
+             if (last == vch.end())
+             {
+                 nReadPos = 0;
+                 return vch.erase(vch.begin(), vch.end());
+             }
+             else
+             {
+                 nReadPos = (last - vch.begin());
+                 return last;
+             }
+         }
+         else
+             return vch.erase(first, last);
+     }
+     inline void Compact()
+     {
+         vch.erase(vch.begin(), vch.begin() + nReadPos);
+         nReadPos = 0;
+     }
+     bool Rewind(size_type n)
+     {
+         // Rewind by n characters if the buffer hasn't been compacted yet
+         if (n > nReadPos)
+             return false;
+         nReadPos -= n;
+         return true;
+     }
+     //
+     // Stream subset
+     //
+     void setstate(short bits, const char* psz)
+     {
+         state |= bits;
+         if (state & exceptmask)
+             throw std::ios_base::failure(psz);
+     }
+     bool eof() const             { return size() == 0; }
+     bool fail() const            { return state & (ios::badbit | ios::failbit); }
+     bool good() const            { return !eof() && (state == 0); }
+     void clear(short n)          { state = n; }  // name conflict with vector clear()
+     short exceptions()           { return exceptmask; }
+     short exceptions(short mask) { short prev = exceptmask; exceptmask = mask; setstate(0, "CDataStream"); return prev; }
+     CDataStream* rdbuf()         { return this; }
+     int in_avail()               { return size(); }
+     void SetType(int n)          { nType = n; }
+     int GetType()                { return nType; }
+     void SetVersion(int n)       { nVersion = n; }
+     int GetVersion()             { return nVersion; }
+     void ReadVersion()           { *this >> nVersion; }
+     void WriteVersion()          { *this << nVersion; }
+     CDataStream& read(char* pch, int nSize)
+     {
+         // Read from the beginning of the buffer
+         assert(nSize >= 0);
+         unsigned int nReadPosNext = nReadPos + nSize;
+         if (nReadPosNext >= vch.size())
+         {
+             if (nReadPosNext > vch.size())
+             {
+                 setstate(ios::failbit, "CDataStream::read() : end of data");
+                 memset(pch, 0, nSize);
+                 nSize = vch.size() - nReadPos;
+             }
+             memcpy(pch, &vch[nReadPos], nSize);
+             nReadPos = 0;
+             vch.clear();
+             return (*this);
+         }
+         memcpy(pch, &vch[nReadPos], nSize);
+         nReadPos = nReadPosNext;
+         return (*this);
+     }
+     CDataStream& ignore(int nSize)
+     {
+         // Ignore from the beginning of the buffer
+         assert(nSize >= 0);
+         unsigned int nReadPosNext = nReadPos + nSize;
+         if (nReadPosNext >= vch.size())
+         {
+             if (nReadPosNext > vch.size())
+             {
+                 setstate(ios::failbit, "CDataStream::ignore() : end of data");
+                 nSize = vch.size() - nReadPos;
+             }
+             nReadPos = 0;
+             vch.clear();
+             return (*this);
+         }
+         nReadPos = nReadPosNext;
+         return (*this);
+     }
+     CDataStream& write(const char* pch, int nSize)
+     {
+         // Write to the end of the buffer
+         assert(nSize >= 0);
+         vch.insert(vch.end(), pch, pch + nSize);
+         return (*this);
+     }
+     template<typename Stream>
+     void Serialize(Stream& s, int nType=0, int nVersion=VERSION) const
+     {
+         // Special case: stream << stream concatenates like stream += stream
+         if (!vch.empty())
+             s.write((char*)&vch[0], vch.size() * sizeof(vch[0]));
+     }
+     template<typename T>
+     unsigned int GetSerializeSize(const T& obj)
+     {
+         // Tells the size of the object if serialized to this stream
+         return ::GetSerializeSize(obj, nType, nVersion);
+     }
+     template<typename T>
+     CDataStream& operator<<(const T& obj)
+     {
+         // Serialize to this stream
+         ::Serialize(*this, obj, nType, nVersion);
+         return (*this);
+     }
+     template<typename T>
+     CDataStream& operator>>(T& obj)
+     {
+         // Unserialize from this stream
+         ::Unserialize(*this, obj, nType, nVersion);
+         return (*this);
+     }
+ };
+ #ifdef TESTCDATASTREAM
+ // VC6sp6
+ // CDataStream:
+ // n=1000       0 seconds
+ // n=2000       0 seconds
+ // n=4000       0 seconds
+ // n=8000       0 seconds
+ // n=16000      0 seconds
+ // n=32000      0 seconds
+ // n=64000      1 seconds
+ // n=128000     1 seconds
+ // n=256000     2 seconds
+ // n=512000     4 seconds
+ // n=1024000    8 seconds
+ // n=2048000    16 seconds
+ // n=4096000    32 seconds
+ // stringstream:
+ // n=1000       1 seconds
+ // n=2000       1 seconds
+ // n=4000       13 seconds
+ // n=8000       87 seconds
+ // n=16000      400 seconds
+ // n=32000      1660 seconds
+ // n=64000      6749 seconds
+ // n=128000     27241 seconds
+ // n=256000     109804 seconds
+ #include <iostream>
+ int main(int argc, char *argv[])
+ {
+     vector<unsigned char> vch(0xcc, 250);
+     printf("CDataStream:\n");
+     for (int n = 1000; n <= 4500000; n *= 2)
+     {
+         CDataStream ss;
+         time_t nStart = time(NULL);
+         for (int i = 0; i < n; i++)
+             ss.write((char*)&vch[0], vch.size());
+         printf("n=%-10d %d seconds\n", n, time(NULL) - nStart);
+     }
+     printf("stringstream:\n");
+     for (int n = 1000; n <= 4500000; n *= 2)
+     {
+         stringstream ss;
+         time_t nStart = time(NULL);
+         for (int i = 0; i < n; i++)
+             ss.write((char*)&vch[0], vch.size());
+         printf("n=%-10d %d seconds\n", n, time(NULL) - nStart);
+     }
+ }
+ #endif
+ //
+ // Automatic closing wrapper for FILE*
+ //  - Will automatically close the file when it goes out of scope if not null.
+ //  - If you're returning the file pointer, return file.release().
+ //  - If you need to close the file early, use file.fclose() instead of fclose(file).
+ //
+ class CAutoFile
+ {
+ protected:
+     FILE* file;
+     short state;
+     short exceptmask;
+ public:
+     int nType;
+     int nVersion;
+     typedef FILE element_type;
+     CAutoFile(FILE* filenew=NULL, int nTypeIn=SER_DISK, int nVersionIn=VERSION)
+     {
+         file = filenew;
+         nType = nTypeIn;
+         nVersion = nVersionIn;
+         state = 0;
+         exceptmask = ios::badbit | ios::failbit;
+     }
+     ~CAutoFile()
+     {
+         fclose();
+     }
+     void fclose()
+     {
+         if (file != NULL && file != stdin && file != stdout && file != stderr)
+             ::fclose(file);
+         file = NULL;
+     }
+     FILE* release()             { FILE* ret = file; file = NULL; return ret; }
+     operator FILE*()            { return file; }
+     FILE* operator->()          { return file; }
+     FILE& operator*()           { return *file; }
+     FILE** operator&()          { return &file; }
+     FILE* operator=(FILE* pnew) { return file = pnew; }
+     bool operator!()            { return (file == NULL); }
+     //
+     // Stream subset
+     //
+     void setstate(short bits, const char* psz)
+     {
+         state |= bits;
+         if (state & exceptmask)
+             throw std::ios_base::failure(psz);
+     }
+     bool fail() const            { return state & (ios::badbit | ios::failbit); }
+     bool good() const            { return state == 0; }
+     void clear(short n = 0)      { state = n; }
+     short exceptions()           { return exceptmask; }
+     short exceptions(short mask) { short prev = exceptmask; exceptmask = mask; setstate(0, "CAutoFile"); return prev; }
+     void SetType(int n)          { nType = n; }
+     int GetType()                { return nType; }
+     void SetVersion(int n)       { nVersion = n; }
+     int GetVersion()             { return nVersion; }
+     void ReadVersion()           { *this >> nVersion; }
+     void WriteVersion()          { *this << nVersion; }
+     CAutoFile& read(char* pch, int nSize)
+     {
+         if (!file)
+             throw std::ios_base::failure("CAutoFile::read : file handle is NULL");
+         if (fread(pch, 1, nSize, file) != nSize)
+             setstate(ios::failbit, feof(file) ? "CAutoFile::read : end of file" : "CAutoFile::read : fread failed");
+         return (*this);
+     }
+     CAutoFile& write(const char* pch, int nSize)
+     {
+         if (!file)
+             throw std::ios_base::failure("CAutoFile::write : file handle is NULL");
+         if (fwrite(pch, 1, nSize, file) != nSize)
+             setstate(ios::failbit, "CAutoFile::write : write failed");
+         return (*this);
+     }
+     template<typename T>
+     unsigned int GetSerializeSize(const T& obj)
+     {
+         // Tells the size of the object if serialized to this stream
+         return ::GetSerializeSize(obj, nType, nVersion);
+     }
+     template<typename T>
+     CAutoFile& operator<<(const T& obj)
+     {
+         // Serialize to this stream
+         if (!file)
+             throw std::ios_base::failure("CAutoFile::operator<< : file handle is NULL");
+         ::Serialize(*this, obj, nType, nVersion);
+         return (*this);
+     }
+     template<typename T>
+     CAutoFile& operator>>(T& obj)
+     {
+         // Unserialize from this stream
+         if (!file)
+             throw std::ios_base::failure("CAutoFile::operator>> : file handle is NULL");
+         ::Unserialize(*this, obj, nType, nVersion);
+         return (*this);
+     }
+ };
diff --cc src/ui.cpp
index 0000000000000000000000000000000000000000,2277da6a3a2aaf3b210b8bf16b42d8bf3b580eac..f2bdd49d559dd050688a68ed0281107f43d9bdf2
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,2933 +1,2903 @@@
 -void CMainFrame::OnMenuOptionsGenerate(wxCommandEvent& event)
 -{
 -    // Options->Generate Coins
 -    GenerateBitcoins(event.IsChecked());
 -}
 -
+ // Copyright (c) 2009-2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ #include "headers.h"
+ #ifdef _MSC_VER
+ #include <crtdbg.h>
+ #endif
+ DEFINE_EVENT_TYPE(wxEVT_UITHREADCALL)
+ CMainFrame* pframeMain = NULL;
+ CMyTaskBarIcon* ptaskbaricon = NULL;
+ bool fClosedToTray = false;
+ wxLocale g_locale;
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // Util
+ //
+ void HandleCtrlA(wxKeyEvent& event)
+ {
+     // Ctrl-a select all
+     event.Skip();
+     wxTextCtrl* textCtrl = (wxTextCtrl*)event.GetEventObject();
+     if (event.GetModifiers() == wxMOD_CONTROL && event.GetKeyCode() == 'A')
+         textCtrl->SetSelection(-1, -1);
+ }
+ bool Is24HourTime()
+ {
+     //char pszHourFormat[256];
+     //pszHourFormat[0] = '\0';
+     //GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, pszHourFormat, 256);
+     //return (pszHourFormat[0] != '0');
+     return true;
+ }
+ string DateStr(int64 nTime)
+ {
+     // Can only be used safely here in the UI
+     return (string)wxDateTime((time_t)nTime).FormatDate();
+ }
+ string DateTimeStr(int64 nTime)
+ {
+     // Can only be used safely here in the UI
+     wxDateTime datetime((time_t)nTime);
+     if (Is24HourTime())
+         return (string)datetime.Format("%x %H:%M");
+     else
+         return (string)datetime.Format("%x ") + itostr((datetime.GetHour() + 11) % 12 + 1) + (string)datetime.Format(":%M %p");
+ }
+ wxString GetItemText(wxListCtrl* listCtrl, int nIndex, int nColumn)
+ {
+     // Helper to simplify access to listctrl
+     wxListItem item;
+     item.m_itemId = nIndex;
+     item.m_col = nColumn;
+     item.m_mask = wxLIST_MASK_TEXT;
+     if (!listCtrl->GetItem(item))
+         return "";
+     return item.GetText();
+ }
+ int InsertLine(wxListCtrl* listCtrl, const wxString& str0, const wxString& str1)
+ {
+     int nIndex = listCtrl->InsertItem(listCtrl->GetItemCount(), str0);
+     listCtrl->SetItem(nIndex, 1, str1);
+     return nIndex;
+ }
+ int InsertLine(wxListCtrl* listCtrl, const wxString& str0, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4)
+ {
+     int nIndex = listCtrl->InsertItem(listCtrl->GetItemCount(), str0);
+     listCtrl->SetItem(nIndex, 1, str1);
+     listCtrl->SetItem(nIndex, 2, str2);
+     listCtrl->SetItem(nIndex, 3, str3);
+     listCtrl->SetItem(nIndex, 4, str4);
+     return nIndex;
+ }
+ int InsertLine(wxListCtrl* listCtrl, void* pdata, const wxString& str0, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4)
+ {
+     int nIndex = listCtrl->InsertItem(listCtrl->GetItemCount(), str0);
+     listCtrl->SetItemPtrData(nIndex, (wxUIntPtr)pdata);
+     listCtrl->SetItem(nIndex, 1, str1);
+     listCtrl->SetItem(nIndex, 2, str2);
+     listCtrl->SetItem(nIndex, 3, str3);
+     listCtrl->SetItem(nIndex, 4, str4);
+     return nIndex;
+ }
+ void SetItemTextColour(wxListCtrl* listCtrl, int nIndex, const wxColour& colour)
+ {
+     // Repaint on Windows is more flickery if the colour has ever been set,
+     // so don't want to set it unless it's different.  Default colour has
+     // alpha 0 transparent, so our colours don't match using operator==.
+     wxColour c1 = listCtrl->GetItemTextColour(nIndex);
+     if (!c1.IsOk())
+         c1 = wxColour(0,0,0);
+     if (colour.Red() != c1.Red() || colour.Green() != c1.Green() || colour.Blue() != c1.Blue())
+         listCtrl->SetItemTextColour(nIndex, colour);
+ }
+ void SetSelection(wxListCtrl* listCtrl, int nIndex)
+ {
+     int nSize = listCtrl->GetItemCount();
+     long nState = (wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
+     for (int i = 0; i < nSize; i++)
+         listCtrl->SetItemState(i, (i == nIndex ? nState : 0), nState);
+ }
+ int GetSelection(wxListCtrl* listCtrl)
+ {
+     int nSize = listCtrl->GetItemCount();
+     for (int i = 0; i < nSize; i++)
+         if (listCtrl->GetItemState(i, wxLIST_STATE_FOCUSED))
+             return i;
+     return -1;
+ }
+ string HtmlEscape(const char* psz, bool fMultiLine=false)
+ {
+     int len = 0;
+     for (const char* p = psz; *p; p++)
+     {
+              if (*p == '<') len += 4;
+         else if (*p == '>') len += 4;
+         else if (*p == '&') len += 5;
+         else if (*p == '"') len += 6;
+         else if (*p == ' ' && p > psz && p[-1] == ' ' && p[1] == ' ') len += 6;
+         else if (*p == '\n' && fMultiLine) len += 5;
+         else
+             len++;
+     }
+     string str;
+     str.reserve(len);
+     for (const char* p = psz; *p; p++)
+     {
+              if (*p == '<') str += "&lt;";
+         else if (*p == '>') str += "&gt;";
+         else if (*p == '&') str += "&amp;";
+         else if (*p == '"') str += "&quot;";
+         else if (*p == ' ' && p > psz && p[-1] == ' ' && p[1] == ' ') str += "&nbsp;";
+         else if (*p == '\n' && fMultiLine) str += "<br>\n";
+         else
+             str += *p;
+     }
+     return str;
+ }
+ string HtmlEscape(const string& str, bool fMultiLine=false)
+ {
+     return HtmlEscape(str.c_str(), fMultiLine);
+ }
+ void CalledMessageBox(const string& message, const string& caption, int style, wxWindow* parent, int x, int y, int* pnRet, bool* pfDone)
+ {
+     *pnRet = wxMessageBox(message, caption, style, parent, x, y);
+     *pfDone = true;
+ }
+ int ThreadSafeMessageBox(const string& message, const string& caption, int style, wxWindow* parent, int x, int y)
+ {
+ #ifdef __WXMSW__
+     return wxMessageBox(message, caption, style, parent, x, y);
+ #else
+     if (wxThread::IsMain() || fDaemon)
+     {
+         return wxMessageBox(message, caption, style, parent, x, y);
+     }
+     else
+     {
+         int nRet = 0;
+         bool fDone = false;
+         UIThreadCall(bind(CalledMessageBox, message, caption, style, parent, x, y, &nRet, &fDone));
+         while (!fDone)
+             Sleep(100);
+         return nRet;
+     }
+ #endif
+ }
+ bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
+ {
+     if (nFeeRequired < CENT || nFeeRequired <= nTransactionFee || fDaemon)
+         return true;
+     string strMessage = strprintf(
+         _("This transaction is over the size limit.  You can still send it for a fee of %s, "
+           "which goes to the nodes that process your transaction and helps to support the network.  "
+           "Do you want to pay the fee?"),
+         FormatMoney(nFeeRequired).c_str());
+     return (ThreadSafeMessageBox(strMessage, strCaption, wxYES_NO, parent) == wxYES);
+ }
+ void CalledSetStatusBar(const string& strText, int nField)
+ {
+     if (nField == 0 && GetWarnings("statusbar") != "")
+         return;
+     if (pframeMain && pframeMain->m_statusBar)
+         pframeMain->m_statusBar->SetStatusText(strText, nField);
+ }
+ void SetDefaultReceivingAddress(const string& strAddress)
+ {
+     // Update main window address and database
+     if (pframeMain == NULL)
+         return;
+     if (strAddress != pframeMain->m_textCtrlAddress->GetValue())
+     {
+         uint160 hash160;
+         if (!AddressToHash160(strAddress, hash160))
+             return;
+         if (!mapPubKeys.count(hash160))
+             return;
+         CWalletDB().WriteDefaultKey(mapPubKeys[hash160]);
+         pframeMain->m_textCtrlAddress->SetValue(strAddress);
+     }
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CMainFrame
+ //
+ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
+ {
+     Connect(wxEVT_UITHREADCALL, wxCommandEventHandler(CMainFrame::OnUIThreadCall), NULL, this);
+     // Set initially selected page
+     wxNotebookEvent event;
+     event.SetSelection(0);
+     OnNotebookPageChanged(event);
+     m_notebook->ChangeSelection(0);
+     // Init
+     fRefreshListCtrl = false;
+     fRefreshListCtrlRunning = false;
+     fOnSetFocusAddress = false;
+     fRefresh = false;
+     m_choiceFilter->SetSelection(0);
+     double dResize = 1.0;
+ #ifdef __WXMSW__
+     SetIcon(wxICON(bitcoin));
+ #else
+     SetIcon(bitcoin80_xpm);
+     SetBackgroundColour(m_toolBar->GetBackgroundColour());
+     wxFont fontTmp = m_staticText41->GetFont();
+     fontTmp.SetFamily(wxFONTFAMILY_TELETYPE);
+     m_staticTextBalance->SetFont(fontTmp);
+     m_staticTextBalance->SetSize(140, 17);
+     // resize to fit ubuntu's huge default font
+     dResize = 1.22;
+     SetSize(dResize * GetSize().GetWidth(), 1.15 * GetSize().GetHeight());
+ #endif
+     m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + "  ");
+     m_listCtrl->SetFocus();
+     ptaskbaricon = new CMyTaskBarIcon();
+ #ifdef __WXMAC_OSX__
+     // Mac automatically moves wxID_EXIT, wxID_PREFERENCES and wxID_ABOUT
+     // to their standard places, leaving these menus empty.
+     GetMenuBar()->Remove(2); // remove Help menu
+     GetMenuBar()->Remove(0); // remove File menu
+ #endif
+     // Init column headers
+     int nDateWidth = DateTimeStr(1229413914).size() * 6 + 8;
+     if (!strstr(DateTimeStr(1229413914).c_str(), "2008"))
+         nDateWidth += 12;
+ #ifdef __WXMAC_OSX__
+     nDateWidth += 5;
+     dResize -= 0.01;
+ #endif
+     wxListCtrl* pplistCtrl[] = {m_listCtrlAll, m_listCtrlSentReceived, m_listCtrlSent, m_listCtrlReceived};
+     foreach(wxListCtrl* p, pplistCtrl)
+     {
+         p->InsertColumn(0, "",               wxLIST_FORMAT_LEFT,  dResize * 0);
+         p->InsertColumn(1, "",               wxLIST_FORMAT_LEFT,  dResize * 0);
+         p->InsertColumn(2, _("Status"),      wxLIST_FORMAT_LEFT,  dResize * 112);
+         p->InsertColumn(3, _("Date"),        wxLIST_FORMAT_LEFT,  dResize * nDateWidth);
+         p->InsertColumn(4, _("Description"), wxLIST_FORMAT_LEFT,  dResize * 409 - nDateWidth);
+         p->InsertColumn(5, _("Debit"),       wxLIST_FORMAT_RIGHT, dResize * 79);
+         p->InsertColumn(6, _("Credit"),      wxLIST_FORMAT_RIGHT, dResize * 79);
+     }
+     // Init status bar
+     int pnWidths[3] = { -100, 88, 300 };
+ #ifndef __WXMSW__
+     pnWidths[1] = pnWidths[1] * 1.1 * dResize;
+     pnWidths[2] = pnWidths[2] * 1.1 * dResize;
+ #endif
+     m_statusBar->SetFieldsCount(3, pnWidths);
+     // Fill your address text box
+     vector<unsigned char> vchPubKey;
+     if (CWalletDB("r").ReadDefaultKey(vchPubKey))
+         m_textCtrlAddress->SetValue(PubKeyToAddress(vchPubKey));
+     // Fill listctrl with wallet transactions
+     RefreshListCtrl();
+ }
+ CMainFrame::~CMainFrame()
+ {
+     pframeMain = NULL;
+     delete ptaskbaricon;
+     ptaskbaricon = NULL;
+ }
+ void CMainFrame::OnNotebookPageChanged(wxNotebookEvent& event)
+ {
+     event.Skip();
+     nPage = event.GetSelection();
+     if (nPage == ALL)
+     {
+         m_listCtrl = m_listCtrlAll;
+         fShowGenerated = true;
+         fShowSent = true;
+         fShowReceived = true;
+     }
+     else if (nPage == SENTRECEIVED)
+     {
+         m_listCtrl = m_listCtrlSentReceived;
+         fShowGenerated = false;
+         fShowSent = true;
+         fShowReceived = true;
+     }
+     else if (nPage == SENT)
+     {
+         m_listCtrl = m_listCtrlSent;
+         fShowGenerated = false;
+         fShowSent = true;
+         fShowReceived = false;
+     }
+     else if (nPage == RECEIVED)
+     {
+         m_listCtrl = m_listCtrlReceived;
+         fShowGenerated = false;
+         fShowSent = false;
+         fShowReceived = true;
+     }
+     RefreshListCtrl();
+     m_listCtrl->SetFocus();
+ }
+ void CMainFrame::OnClose(wxCloseEvent& event)
+ {
+     if (fMinimizeOnClose && event.CanVeto() && !IsIconized())
+     {
+         // Divert close to minimize
+         event.Veto();
+         fClosedToTray = true;
+         Iconize(true);
+     }
+     else
+     {
+         Destroy();
+         CreateThread(Shutdown, NULL);
+     }
+ }
+ void CMainFrame::OnIconize(wxIconizeEvent& event)
+ {
+     event.Skip();
+     // Hide the task bar button when minimized.
+     // Event is sent when the frame is minimized or restored.
+     // wxWidgets 2.8.9 doesn't have IsIconized() so there's no way
+     // to get rid of the deprecated warning.  Just ignore it.
+     if (!event.Iconized())
+         fClosedToTray = false;
+ #if defined(__WXGTK__) || defined(__WXMAC_OSX__)
+     if (GetBoolArg("-minimizetotray")) {
+ #endif
+     // The tray icon sometimes disappears on ubuntu karmic
+     // Hiding the taskbar button doesn't work cleanly on ubuntu lucid
+     // Reports of CPU peg on 64-bit linux
+     if (fMinimizeToTray && event.Iconized())
+         fClosedToTray = true;
+     Show(!fClosedToTray);
+     ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);
+ #if defined(__WXGTK__) || defined(__WXMAC_OSX__)
+     }
+ #endif
+ }
+ void CMainFrame::OnMouseEvents(wxMouseEvent& event)
+ {
+     event.Skip();
+     RandAddSeed();
+     RAND_add(&event.m_x, sizeof(event.m_x), 0.25);
+     RAND_add(&event.m_y, sizeof(event.m_y), 0.25);
+ }
+ void CMainFrame::OnListColBeginDrag(wxListEvent& event)
+ {
+     // Hidden columns not resizeable
+     if (event.GetColumn() <= 1 && !fDebug)
+         event.Veto();
+     else
+         event.Skip();
+ }
+ int CMainFrame::GetSortIndex(const string& strSort)
+ {
+ #ifdef __WXMSW__
+     return 0;
+ #else
+     // The wx generic listctrl implementation used on GTK doesn't sort,
+     // so we have to do it ourselves.  Remember, we sort in reverse order.
+     // In the wx generic implementation, they store the list of items
+     // in a vector, so indexed lookups are fast, but inserts are slower
+     // the closer they are to the top.
+     int low = 0;
+     int high = m_listCtrl->GetItemCount();
+     while (low < high)
+     {
+         int mid = low + ((high - low) / 2);
+         if (strSort.compare(m_listCtrl->GetItemText(mid).c_str()) >= 0)
+             high = mid;
+         else
+             low = mid + 1;
+     }
+     return low;
+ #endif
+ }
+ void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxColour& colour, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5, const wxString& str6)
+ {
+     strSort = " " + strSort;       // leading space to workaround wx2.9.0 ubuntu 9.10 bug
+     long nData = *(long*)&hashKey; //  where first char of hidden column is displayed
+     // Find item
+     if (!fNew && nIndex == -1)
+     {
+         string strHash = " " + hashKey.ToString();
+         while ((nIndex = m_listCtrl->FindItem(nIndex, nData)) != -1)
+             if (GetItemText(m_listCtrl, nIndex, 1) == strHash)
+                 break;
+     }
+     // fNew is for blind insert, only use if you're sure it's new
+     if (fNew || nIndex == -1)
+     {
+         nIndex = m_listCtrl->InsertItem(GetSortIndex(strSort), strSort);
+     }
+     else
+     {
+         // If sort key changed, must delete and reinsert to make it relocate
+         if (GetItemText(m_listCtrl, nIndex, 0) != strSort)
+         {
+             m_listCtrl->DeleteItem(nIndex);
+             nIndex = m_listCtrl->InsertItem(GetSortIndex(strSort), strSort);
+         }
+     }
+     m_listCtrl->SetItem(nIndex, 1, " " + hashKey.ToString());
+     m_listCtrl->SetItem(nIndex, 2, str2);
+     m_listCtrl->SetItem(nIndex, 3, str3);
+     m_listCtrl->SetItem(nIndex, 4, str4);
+     m_listCtrl->SetItem(nIndex, 5, str5);
+     m_listCtrl->SetItem(nIndex, 6, str6);
+     m_listCtrl->SetItemData(nIndex, nData);
+     SetItemTextColour(m_listCtrl, nIndex, colour);
+ }
+ bool CMainFrame::DeleteLine(uint256 hashKey)
+ {
+     long nData = *(long*)&hashKey;
+     // Find item
+     int nIndex = -1;
+     string strHash = " " + hashKey.ToString();
+     while ((nIndex = m_listCtrl->FindItem(nIndex, nData)) != -1)
+         if (GetItemText(m_listCtrl, nIndex, 1) == strHash)
+             break;
+     if (nIndex != -1)
+         m_listCtrl->DeleteItem(nIndex);
+     return nIndex != -1;
+ }
+ string FormatTxStatus(const CWalletTx& wtx)
+ {
+     // Status
+     if (!wtx.IsFinal())
+     {
+         if (wtx.nLockTime < 500000000)
+             return strprintf(_("Open for %d blocks"), nBestHeight - wtx.nLockTime);
+         else
+             return strprintf(_("Open until %s"), DateTimeStr(wtx.nLockTime).c_str());
+     }
+     else
+     {
+         int nDepth = wtx.GetDepthInMainChain();
+         if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
+             return strprintf(_("%d/offline?"), nDepth);
+         else if (nDepth < 6)
+             return strprintf(_("%d/unconfirmed"), nDepth);
+         else
+             return strprintf(_("%d confirmations"), nDepth);
+     }
+ }
+ string SingleLine(const string& strIn)
+ {
+     string strOut;
+     bool fOneSpace = false;
+     foreach(unsigned char c, strIn)
+     {
+         if (isspace(c))
+         {
+             fOneSpace = true;
+         }
+         else if (c > ' ')
+         {
+             if (fOneSpace && !strOut.empty())
+                 strOut += ' ';
+             strOut += c;
+             fOneSpace = false;
+         }
+     }
+     return strOut;
+ }
+ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
+ {
+     int64 nTime = wtx.nTimeDisplayed = wtx.GetTxTime();
+     int64 nCredit = wtx.GetCredit(true);
+     int64 nDebit = wtx.GetDebit();
+     int64 nNet = nCredit - nDebit;
+     uint256 hash = wtx.GetHash();
+     string strStatus = FormatTxStatus(wtx);
+     bool fConfirmed = wtx.fConfirmedDisplayed = wtx.IsConfirmed();
+     wxColour colour = (fConfirmed ? wxColour(0,0,0) : wxColour(128,128,128));
+     map<string, string> mapValue = wtx.mapValue;
+     wtx.nLinesDisplayed = 1;
+     nListViewUpdated++;
+     // Filter
+     if (wtx.IsCoinBase())
+     {
+         // Don't show generated coin until confirmed by at least one block after it
+         // so we don't get the user's hopes up until it looks like it's probably accepted.
+         //
+         // It is not an error when generated blocks are not accepted.  By design,
+         // some percentage of blocks, like 10% or more, will end up not accepted.
+         // This is the normal mechanism by which the network copes with latency.
+         //
+         // We display regular transactions right away before any confirmation
+         // because they can always get into some block eventually.  Generated coins
+         // are special because if their block is not accepted, they are not valid.
+         //
+         if (wtx.GetDepthInMainChain() < 2)
+         {
+             wtx.nLinesDisplayed = 0;
+             return false;
+         }
+         if (!fShowGenerated)
+             return false;
+     }
+     // Find the block the tx is in
+     CBlockIndex* pindex = NULL;
+     map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(wtx.hashBlock);
+     if (mi != mapBlockIndex.end())
+         pindex = (*mi).second;
+     // Sort order, unrecorded transactions sort to the top
+     string strSort = strprintf("%010d-%01d-%010u",
+         (pindex ? pindex->nHeight : INT_MAX),
+         (wtx.IsCoinBase() ? 1 : 0),
+         wtx.nTimeReceived);
+     // Insert line
+     if (nNet > 0 || wtx.IsCoinBase())
+     {
+         //
+         // Credit
+         //
+         string strDescription;
+         if (wtx.IsCoinBase())
+         {
+             // Generated
+             strDescription = _("Generated");
+             if (nCredit == 0)
+             {
+                 int64 nUnmatured = 0;
+                 foreach(const CTxOut& txout, wtx.vout)
+                     nUnmatured += txout.GetCredit();
+                 if (wtx.IsInMainChain())
+                 {
+                     strDescription = strprintf(_("Generated (%s matures in %d more blocks)"), FormatMoney(nUnmatured).c_str(), wtx.GetBlocksToMaturity());
+                     // Check if the block was requested by anyone
+                     if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
+                         strDescription = _("Generated - Warning: This block was not received by any other nodes and will probably not be accepted!");
+                 }
+                 else
+                 {
+                     strDescription = _("Generated (not accepted)");
+                 }
+             }
+         }
+         else if (!mapValue["from"].empty() || !mapValue["message"].empty())
+         {
+             // Received by IP connection
+             if (!fShowReceived)
+                 return false;
+             if (!mapValue["from"].empty())
+                 strDescription += _("From: ") + mapValue["from"];
+             if (!mapValue["message"].empty())
+             {
+                 if (!strDescription.empty())
+                     strDescription += " - ";
+                 strDescription += mapValue["message"];
+             }
+         }
+         else
+         {
+             // Received by Bitcoin Address
+             if (!fShowReceived)
+                 return false;
+             foreach(const CTxOut& txout, wtx.vout)
+             {
+                 if (txout.IsMine())
+                 {
+                     vector<unsigned char> vchPubKey;
+                     if (ExtractPubKey(txout.scriptPubKey, true, vchPubKey))
+                     {
+                         CRITICAL_BLOCK(cs_mapAddressBook)
+                         {
+                             //strDescription += _("Received payment to ");
+                             //strDescription += _("Received with address ");
+                             strDescription += _("Received with: ");
+                             string strAddress = PubKeyToAddress(vchPubKey);
+                             map<string, string>::iterator mi = mapAddressBook.find(strAddress);
+                             if (mi != mapAddressBook.end() && !(*mi).second.empty())
+                             {
+                                 string strLabel = (*mi).second;
+                                 strDescription += strAddress.substr(0,12) + "... ";
+                                 strDescription += "(" + strLabel + ")";
+                             }
+                             else
+                                 strDescription += strAddress;
+                         }
+                     }
+                     break;
+                 }
+             }
+         }
+         string strCredit = FormatMoney(nNet, true);
+         if (!fConfirmed)
+             strCredit = "[" + strCredit + "]";
+         InsertLine(fNew, nIndex, hash, strSort, colour,
+                    strStatus,
+                    nTime ? DateTimeStr(nTime) : "",
+                    SingleLine(strDescription),
+                    "",
+                    strCredit);
+     }
+     else
+     {
+         bool fAllFromMe = true;
+         foreach(const CTxIn& txin, wtx.vin)
+             fAllFromMe = fAllFromMe && txin.IsMine();
+         bool fAllToMe = true;
+         foreach(const CTxOut& txout, wtx.vout)
+             fAllToMe = fAllToMe && txout.IsMine();
+         if (fAllFromMe && fAllToMe)
+         {
+             // Payment to self
+             int64 nChange = wtx.GetChange();
+             InsertLine(fNew, nIndex, hash, strSort, colour,
+                        strStatus,
+                        nTime ? DateTimeStr(nTime) : "",
+                        _("Payment to yourself"),
+                        FormatMoney(-(nDebit - nChange), true),
+                        FormatMoney(nCredit - nChange, true));
+         }
+         else if (fAllFromMe)
+         {
+             //
+             // Debit
+             //
+             if (!fShowSent)
+                 return false;
+             int64 nTxFee = nDebit - wtx.GetValueOut();
+             wtx.nLinesDisplayed = 0;
+             for (int nOut = 0; nOut < wtx.vout.size(); nOut++)
+             {
+                 const CTxOut& txout = wtx.vout[nOut];
+                 if (txout.IsMine())
+                     continue;
+                 string strAddress;
+                 if (!mapValue["to"].empty())
+                 {
+                     // Sent to IP
+                     strAddress = mapValue["to"];
+                 }
+                 else
+                 {
+                     // Sent to Bitcoin Address
+                     uint160 hash160;
+                     if (ExtractHash160(txout.scriptPubKey, hash160))
+                         strAddress = Hash160ToAddress(hash160);
+                 }
+                 string strDescription = _("To: ");
+                 CRITICAL_BLOCK(cs_mapAddressBook)
+                     if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty())
+                         strDescription += mapAddressBook[strAddress] + " ";
+                 strDescription += strAddress;
+                 if (!mapValue["message"].empty())
+                 {
+                     if (!strDescription.empty())
+                         strDescription += " - ";
+                     strDescription += mapValue["message"];
+                 }
+                 else if (!mapValue["comment"].empty())
+                 {
+                     if (!strDescription.empty())
+                         strDescription += " - ";
+                     strDescription += mapValue["comment"];
+                 }
+                 int64 nValue = txout.nValue;
+                 if (nTxFee > 0)
+                 {
+                     nValue += nTxFee;
+                     nTxFee = 0;
+                 }
+                 InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut), colour,
+                            strStatus,
+                            nTime ? DateTimeStr(nTime) : "",
+                            SingleLine(strDescription),
+                            FormatMoney(-nValue, true),
+                            "");
+                 nIndex = -1;
+                 wtx.nLinesDisplayed++;
+             }
+         }
+         else
+         {
+             //
+             // Mixed debit transaction, can't break down payees
+             //
+             bool fAllMine = true;
+             foreach(const CTxOut& txout, wtx.vout)
+                 fAllMine = fAllMine && txout.IsMine();
+             foreach(const CTxIn& txin, wtx.vin)
+                 fAllMine = fAllMine && txin.IsMine();
+             InsertLine(fNew, nIndex, hash, strSort, colour,
+                        strStatus,
+                        nTime ? DateTimeStr(nTime) : "",
+                        "",
+                        FormatMoney(nNet, true),
+                        "");
+         }
+     }
+     return true;
+ }
+ void CMainFrame::RefreshListCtrl()
+ {
+     fRefreshListCtrl = true;
+     ::wxWakeUpIdle();
+ }
+ void CMainFrame::OnIdle(wxIdleEvent& event)
+ {
+     if (fRefreshListCtrl)
+     {
+         // Collect list of wallet transactions and sort newest first
+         bool fEntered = false;
+         vector<pair<unsigned int, uint256> > vSorted;
+         TRY_CRITICAL_BLOCK(cs_mapWallet)
+         {
+             printf("RefreshListCtrl starting\n");
+             fEntered = true;
+             fRefreshListCtrl = false;
+             vWalletUpdated.clear();
+             // Do the newest transactions first
+             vSorted.reserve(mapWallet.size());
+             for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+             {
+                 const CWalletTx& wtx = (*it).second;
+                 unsigned int nTime = UINT_MAX - wtx.GetTxTime();
+                 vSorted.push_back(make_pair(nTime, (*it).first));
+             }
+             m_listCtrl->DeleteAllItems();
+         }
+         if (!fEntered)
+             return;
+         sort(vSorted.begin(), vSorted.end());
+         // Fill list control
+         for (int i = 0; i < vSorted.size();)
+         {
+             if (fShutdown)
+                 return;
+             bool fEntered = false;
+             TRY_CRITICAL_BLOCK(cs_mapWallet)
+             {
+                 fEntered = true;
+                 uint256& hash = vSorted[i++].second;
+                 map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash);
+                 if (mi != mapWallet.end())
+                     InsertTransaction((*mi).second, true);
+             }
+             if (!fEntered || i == 100 || i % 500 == 0)
+                 wxYield();
+         }
+         printf("RefreshListCtrl done\n");
+         // Update transaction total display
+         MainFrameRepaint();
+     }
+     else
+     {
+         // Check for time updates
+         static int64 nLastTime;
+         if (GetTime() > nLastTime + 30)
+         {
+             TRY_CRITICAL_BLOCK(cs_mapWallet)
+             {
+                 nLastTime = GetTime();
+                 for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+                 {
+                     CWalletTx& wtx = (*it).second;
+                     if (wtx.nTimeDisplayed && wtx.nTimeDisplayed != wtx.GetTxTime())
+                         InsertTransaction(wtx, false);
+                 }
+             }
+         }
+     }
+ }
+ void CMainFrame::RefreshStatusColumn()
+ {
+     static int nLastTop;
+     static CBlockIndex* pindexLastBest;
+     static unsigned int nLastRefreshed;
+     int nTop = max((int)m_listCtrl->GetTopItem(), 0);
+     if (nTop == nLastTop && pindexLastBest == pindexBest)
+         return;
+     TRY_CRITICAL_BLOCK(cs_mapWallet)
+     {
+         int nStart = nTop;
+         int nEnd = min(nStart + 100, m_listCtrl->GetItemCount());
+         if (pindexLastBest == pindexBest && nLastRefreshed == nListViewUpdated)
+         {
+             // If no updates, only need to do the part that moved onto the screen
+             if (nStart >= nLastTop && nStart < nLastTop + 100)
+                 nStart = nLastTop + 100;
+             if (nEnd >= nLastTop && nEnd < nLastTop + 100)
+                 nEnd = nLastTop;
+         }
+         nLastTop = nTop;
+         pindexLastBest = pindexBest;
+         nLastRefreshed = nListViewUpdated;
+         for (int nIndex = nStart; nIndex < min(nEnd, m_listCtrl->GetItemCount()); nIndex++)
+         {
+             uint256 hash((string)GetItemText(m_listCtrl, nIndex, 1));
+             map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash);
+             if (mi == mapWallet.end())
+             {
+                 printf("CMainFrame::RefreshStatusColumn() : tx not found in mapWallet\n");
+                 continue;
+             }
+             CWalletTx& wtx = (*mi).second;
+             if (wtx.IsCoinBase() ||
+                 wtx.GetTxTime() != wtx.nTimeDisplayed ||
+                 wtx.IsConfirmed() != wtx.fConfirmedDisplayed)
+             {
+                 if (!InsertTransaction(wtx, false, nIndex))
+                     m_listCtrl->DeleteItem(nIndex--);
+             }
+             else
+             {
+                 m_listCtrl->SetItem(nIndex, 2, FormatTxStatus(wtx));
+             }
+         }
+     }
+ }
+ void CMainFrame::OnPaint(wxPaintEvent& event)
+ {
+     event.Skip();
+     if (fRefresh)
+     {
+         fRefresh = false;
+         Refresh();
+     }
+ }
+ unsigned int nNeedRepaint = 0;
+ unsigned int nLastRepaint = 0;
+ int64 nLastRepaintTime = 0;
+ int64 nRepaintInterval = 500;
+ void ThreadDelayedRepaint(void* parg)
+ {
+     while (!fShutdown)
+     {
+         if (nLastRepaint != nNeedRepaint && GetTimeMillis() - nLastRepaintTime >= nRepaintInterval)
+         {
+             nLastRepaint = nNeedRepaint;
+             if (pframeMain)
+             {
+                 printf("DelayedRepaint\n");
+                 wxPaintEvent event;
+                 pframeMain->fRefresh = true;
+                 pframeMain->GetEventHandler()->AddPendingEvent(event);
+             }
+         }
+         Sleep(nRepaintInterval);
+     }
+ }
+ void MainFrameRepaint()
+ {
+     // This is called by network code that shouldn't access pframeMain
+     // directly because it could still be running after the UI is closed.
+     if (pframeMain)
+     {
+         // Don't repaint too often
+         static int64 nLastRepaintRequest;
+         if (GetTimeMillis() - nLastRepaintRequest < 100)
+         {
+             nNeedRepaint++;
+             return;
+         }
+         nLastRepaintRequest = GetTimeMillis();
+         printf("MainFrameRepaint\n");
+         wxPaintEvent event;
+         pframeMain->fRefresh = true;
+         pframeMain->GetEventHandler()->AddPendingEvent(event);
+     }
+ }
+ void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)
+ {
+     // Skip lets the listctrl do the paint, we're just hooking the message
+     event.Skip();
+     if (ptaskbaricon)
+         ptaskbaricon->UpdateTooltip();
+     //
+     // Slower stuff
+     //
+     static int nTransactionCount;
+     bool fPaintedBalance = false;
+     if (GetTimeMillis() - nLastRepaintTime >= nRepaintInterval)
+     {
+         nLastRepaint = nNeedRepaint;
+         nLastRepaintTime = GetTimeMillis();
+         // Update listctrl contents
+         if (!vWalletUpdated.empty())
+         {
+             TRY_CRITICAL_BLOCK(cs_mapWallet)
+             {
+                 string strTop;
+                 if (m_listCtrl->GetItemCount())
+                     strTop = (string)m_listCtrl->GetItemText(0);
+                 foreach(uint256 hash, vWalletUpdated)
+                 {
+                     map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash);
+                     if (mi != mapWallet.end())
+                         InsertTransaction((*mi).second, false);
+                 }
+                 vWalletUpdated.clear();
+                 if (m_listCtrl->GetItemCount() && strTop != (string)m_listCtrl->GetItemText(0))
+                     m_listCtrl->ScrollList(0, INT_MIN/2);
+             }
+         }
+         // Balance total
+         TRY_CRITICAL_BLOCK(cs_mapWallet)
+         {
+             fPaintedBalance = true;
+             m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + "  ");
+             // Count hidden and multi-line transactions
+             nTransactionCount = 0;
+             for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
+             {
+                 CWalletTx& wtx = (*it).second;
+                 nTransactionCount += wtx.nLinesDisplayed;
+             }
+         }
+     }
+     if (!vWalletUpdated.empty() || !fPaintedBalance)
+         nNeedRepaint++;
+     // Update status column of visible items only
+     RefreshStatusColumn();
+     // Update status bar
+     static string strPrevWarning;
+     string strWarning = GetWarnings("statusbar");
+     if (strWarning != "")
+         m_statusBar->SetStatusText(string("    ") + _(strWarning), 0);
+     else if (strPrevWarning != "")
+         m_statusBar->SetStatusText("", 0);
+     strPrevWarning = strWarning;
+     string strGen = "";
+     if (fGenerateBitcoins)
+         strGen = _("    Generating");
+     if (fGenerateBitcoins && vNodes.empty())
+         strGen = _("(not connected)");
+     m_statusBar->SetStatusText(strGen, 1);
+     string strStatus = strprintf(_("     %d connections     %d blocks     %d transactions"), vNodes.size(), nBestHeight, nTransactionCount);
+     m_statusBar->SetStatusText(strStatus, 2);
+     // Update receiving address
+     string strDefaultAddress = PubKeyToAddress(vchDefaultKey);
+     if (m_textCtrlAddress->GetValue() != strDefaultAddress)
+         m_textCtrlAddress->SetValue(strDefaultAddress);
+ }
+ void UIThreadCall(boost::function0<void> fn)
+ {
+     // Call this with a function object created with bind.
+     // bind needs all parameters to match the function's expected types
+     // and all default parameters specified.  Some examples:
+     //  UIThreadCall(bind(wxBell));
+     //  UIThreadCall(bind(wxMessageBox, wxT("Message"), wxT("Title"), wxOK, (wxWindow*)NULL, -1, -1));
+     //  UIThreadCall(bind(&CMainFrame::OnMenuHelpAbout, pframeMain, event));
+     if (pframeMain)
+     {
+         wxCommandEvent event(wxEVT_UITHREADCALL);
+         event.SetClientData((void*)new boost::function0<void>(fn));
+         pframeMain->GetEventHandler()->AddPendingEvent(event);
+     }
+ }
+ void CMainFrame::OnUIThreadCall(wxCommandEvent& event)
+ {
+     boost::function0<void>* pfn = (boost::function0<void>*)event.GetClientData();
+     (*pfn)();
+     delete pfn;
+ }
+ void CMainFrame::OnMenuFileExit(wxCommandEvent& event)
+ {
+     // File->Exit
+     Close(true);
+ }
 -    m_checkBoxLimitProcessors->SetValue(fLimitProcessors);
 -    m_spinCtrlLimitProcessors->Enable(fLimitProcessors);
 -    m_spinCtrlLimitProcessors->SetValue(nLimitProcessors);
 -    int nProcessors = wxThread::GetCPUCount();
 -    if (nProcessors < 1)
 -        nProcessors = 999;
 -    m_spinCtrlLimitProcessors->SetRange(1, nProcessors);
+ void CMainFrame::OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event)
+ {
+     event.Check(fGenerateBitcoins);
+ }
+ void CMainFrame::OnMenuOptionsChangeYourAddress(wxCommandEvent& event)
+ {
+     // Options->Your Receiving Addresses
+     CAddressBookDialog dialog(this, "", CAddressBookDialog::RECEIVING, false);
+     if (!dialog.ShowModal())
+         return;
+ }
+ void CMainFrame::OnMenuOptionsOptions(wxCommandEvent& event)
+ {
+     // Options->Options
+     COptionsDialog dialog(this);
+     dialog.ShowModal();
+ }
+ void CMainFrame::OnMenuHelpAbout(wxCommandEvent& event)
+ {
+     // Help->About
+     CAboutDialog dialog(this);
+     dialog.ShowModal();
+ }
+ void CMainFrame::OnButtonSend(wxCommandEvent& event)
+ {
+     // Toolbar: Send
+     CSendDialog dialog(this);
+     dialog.ShowModal();
+ }
+ void CMainFrame::OnButtonAddressBook(wxCommandEvent& event)
+ {
+     // Toolbar: Address Book
+     CAddressBookDialog dialogAddr(this, "", CAddressBookDialog::SENDING, false);
+     if (dialogAddr.ShowModal() == 2)
+     {
+         // Send
+         CSendDialog dialogSend(this, dialogAddr.GetSelectedAddress());
+         dialogSend.ShowModal();
+     }
+ }
+ void CMainFrame::OnSetFocusAddress(wxFocusEvent& event)
+ {
+     // Automatically select-all when entering window
+     event.Skip();
+     m_textCtrlAddress->SetSelection(-1, -1);
+     fOnSetFocusAddress = true;
+ }
+ void CMainFrame::OnMouseEventsAddress(wxMouseEvent& event)
+ {
+     event.Skip();
+     if (fOnSetFocusAddress)
+         m_textCtrlAddress->SetSelection(-1, -1);
+     fOnSetFocusAddress = false;
+ }
+ void CMainFrame::OnButtonNew(wxCommandEvent& event)
+ {
+     // Ask name
+     CGetTextFromUserDialog dialog(this,
+         _("New Receiving Address"),
+         _("You should use a new address for each payment you receive.\n\nLabel"),
+         "");
+     if (!dialog.ShowModal())
+         return;
+     string strName = dialog.GetValue();
+     // Generate new key
+     string strAddress = PubKeyToAddress(GetKeyFromKeyPool());
+     // Save
+     SetAddressBookName(strAddress, strName);
+     SetDefaultReceivingAddress(strAddress);
+ }
+ void CMainFrame::OnButtonCopy(wxCommandEvent& event)
+ {
+     // Copy address box to clipboard
+     if (wxTheClipboard->Open())
+     {
+         wxTheClipboard->SetData(new wxTextDataObject(m_textCtrlAddress->GetValue()));
+         wxTheClipboard->Close();
+     }
+ }
+ void CMainFrame::OnListItemActivated(wxListEvent& event)
+ {
+     uint256 hash((string)GetItemText(m_listCtrl, event.GetIndex(), 1));
+     CWalletTx wtx;
+     CRITICAL_BLOCK(cs_mapWallet)
+     {
+         map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash);
+         if (mi == mapWallet.end())
+         {
+             printf("CMainFrame::OnListItemActivated() : tx not found in mapWallet\n");
+             return;
+         }
+         wtx = (*mi).second;
+     }
+     CTxDetailsDialog dialog(this, wtx);
+     dialog.ShowModal();
+     //CTxDetailsDialog* pdialog = new CTxDetailsDialog(this, wtx);
+     //pdialog->Show();
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CTxDetailsDialog
+ //
+ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetailsDialogBase(parent)
+ {
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         string strHTML;
+         strHTML.reserve(4000);
+         strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
+         int64 nTime = wtx.GetTxTime();
+         int64 nCredit = wtx.GetCredit();
+         int64 nDebit = wtx.GetDebit();
+         int64 nNet = nCredit - nDebit;
+         strHTML += _("<b>Status:</b> ") + FormatTxStatus(wtx);
+         int nRequests = wtx.GetRequestCount();
+         if (nRequests != -1)
+         {
+             if (nRequests == 0)
+                 strHTML += _(", has not been successfully broadcast yet");
+             else if (nRequests == 1)
+                 strHTML += strprintf(_(", broadcast through %d node"), nRequests);
+             else
+                 strHTML += strprintf(_(", broadcast through %d nodes"), nRequests);
+         }
+         strHTML += "<br>";
+         strHTML += _("<b>Date:</b> ") + (nTime ? DateTimeStr(nTime) : "") + "<br>";
+         //
+         // From
+         //
+         if (wtx.IsCoinBase())
+         {
+             strHTML += _("<b>Source:</b> Generated<br>");
+         }
+         else if (!wtx.mapValue["from"].empty())
+         {
+             // Online transaction
+             if (!wtx.mapValue["from"].empty())
+                 strHTML += _("<b>From:</b> ") + HtmlEscape(wtx.mapValue["from"]) + "<br>";
+         }
+         else
+         {
+             // Offline transaction
+             if (nNet > 0)
+             {
+                 // Credit
+                 foreach(const CTxOut& txout, wtx.vout)
+                 {
+                     if (txout.IsMine())
+                     {
+                         vector<unsigned char> vchPubKey;
+                         if (ExtractPubKey(txout.scriptPubKey, true, vchPubKey))
+                         {
+                             string strAddress = PubKeyToAddress(vchPubKey);
+                             if (mapAddressBook.count(strAddress))
+                             {
+                                 strHTML += string() + _("<b>From:</b> ") + _("unknown") + "<br>";
+                                 strHTML += _("<b>To:</b> ");
+                                 strHTML += HtmlEscape(strAddress);
+                                 if (!mapAddressBook[strAddress].empty())
+                                     strHTML += _(" (yours, label: ") + mapAddressBook[strAddress] + ")";
+                                 else
+                                     strHTML += _(" (yours)");
+                                 strHTML += "<br>";
+                             }
+                         }
+                         break;
+                     }
+                 }
+             }
+         }
+         //
+         // To
+         //
+         string strAddress;
+         if (!wtx.mapValue["to"].empty())
+         {
+             // Online transaction
+             strAddress = wtx.mapValue["to"];
+             strHTML += _("<b>To:</b> ");
+             if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty())
+                 strHTML += mapAddressBook[strAddress] + " ";
+             strHTML += HtmlEscape(strAddress) + "<br>";
+         }
+         //
+         // Amount
+         //
+         if (wtx.IsCoinBase() && nCredit == 0)
+         {
+             //
+             // Coinbase
+             //
+             int64 nUnmatured = 0;
+             foreach(const CTxOut& txout, wtx.vout)
+                 nUnmatured += txout.GetCredit();
+             strHTML += _("<b>Credit:</b> ");
+             if (wtx.IsInMainChain())
+                 strHTML += strprintf(_("(%s matures in %d more blocks)"), FormatMoney(nUnmatured).c_str(), wtx.GetBlocksToMaturity());
+             else
+                 strHTML += _("(not accepted)");
+             strHTML += "<br>";
+         }
+         else if (nNet > 0)
+         {
+             //
+             // Credit
+             //
+             strHTML += _("<b>Credit:</b> ") + FormatMoney(nNet) + "<br>";
+         }
+         else
+         {
+             bool fAllFromMe = true;
+             foreach(const CTxIn& txin, wtx.vin)
+                 fAllFromMe = fAllFromMe && txin.IsMine();
+             bool fAllToMe = true;
+             foreach(const CTxOut& txout, wtx.vout)
+                 fAllToMe = fAllToMe && txout.IsMine();
+             if (fAllFromMe)
+             {
+                 //
+                 // Debit
+                 //
+                 foreach(const CTxOut& txout, wtx.vout)
+                 {
+                     if (txout.IsMine())
+                         continue;
+                     if (wtx.mapValue["to"].empty())
+                     {
+                         // Offline transaction
+                         uint160 hash160;
+                         if (ExtractHash160(txout.scriptPubKey, hash160))
+                         {
+                             string strAddress = Hash160ToAddress(hash160);
+                             strHTML += _("<b>To:</b> ");
+                             if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty())
+                                 strHTML += mapAddressBook[strAddress] + " ";
+                             strHTML += strAddress;
+                             strHTML += "<br>";
+                         }
+                     }
+                     strHTML += _("<b>Debit:</b> ") + FormatMoney(-txout.nValue) + "<br>";
+                 }
+                 if (fAllToMe)
+                 {
+                     // Payment to self
+                     int64 nChange = wtx.GetChange();
+                     int64 nValue = nCredit - nChange;
+                     strHTML += _("<b>Debit:</b> ") + FormatMoney(-nValue) + "<br>";
+                     strHTML += _("<b>Credit:</b> ") + FormatMoney(nValue) + "<br>";
+                 }
+                 int64 nTxFee = nDebit - wtx.GetValueOut();
+                 if (nTxFee > 0)
+                     strHTML += _("<b>Transaction fee:</b> ") + FormatMoney(-nTxFee) + "<br>";
+             }
+             else
+             {
+                 //
+                 // Mixed debit transaction
+                 //
+                 foreach(const CTxIn& txin, wtx.vin)
+                     if (txin.IsMine())
+                         strHTML += _("<b>Debit:</b> ") + FormatMoney(-txin.GetDebit()) + "<br>";
+                 foreach(const CTxOut& txout, wtx.vout)
+                     if (txout.IsMine())
+                         strHTML += _("<b>Credit:</b> ") + FormatMoney(txout.GetCredit()) + "<br>";
+             }
+         }
+         strHTML += _("<b>Net amount:</b> ") + FormatMoney(nNet, true) + "<br>";
+         //
+         // Message
+         //
+         if (!wtx.mapValue["message"].empty())
+             strHTML += string() + "<br><b>" + _("Message:") + "</b><br>" + HtmlEscape(wtx.mapValue["message"], true) + "<br>";
+         if (!wtx.mapValue["comment"].empty())
+             strHTML += string() + "<br><b>" + _("Comment:") + "</b><br>" + HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
+         if (wtx.IsCoinBase())
+             strHTML += string() + "<br>" + _("Generated coins must wait 120 blocks before they can be spent.  When you generated this block, it was broadcast to the network to be added to the block chain.  If it fails to get into the chain, it will change to \"not accepted\" and not be spendable.  This may occasionally happen if another node generates a block within a few seconds of yours.") + "<br>";
+         //
+         // Debug view
+         //
+         if (fDebug)
+         {
+             strHTML += "<hr><br>debug print<br><br>";
+             foreach(const CTxIn& txin, wtx.vin)
+                 if (txin.IsMine())
+                     strHTML += "<b>Debit:</b> " + FormatMoney(-txin.GetDebit()) + "<br>";
+             foreach(const CTxOut& txout, wtx.vout)
+                 if (txout.IsMine())
+                     strHTML += "<b>Credit:</b> " + FormatMoney(txout.GetCredit()) + "<br>";
+             strHTML += "<br><b>Transaction:</b><br>";
+             strHTML += HtmlEscape(wtx.ToString(), true);
+             strHTML += "<br><b>Inputs:</b><br>";
+             CRITICAL_BLOCK(cs_mapWallet)
+             {
+                 foreach(const CTxIn& txin, wtx.vin)
+                 {
+                     COutPoint prevout = txin.prevout;
+                     map<uint256, CWalletTx>::iterator mi = mapWallet.find(prevout.hash);
+                     if (mi != mapWallet.end())
+                     {
+                         const CWalletTx& prev = (*mi).second;
+                         if (prevout.n < prev.vout.size())
+                         {
+                             strHTML += HtmlEscape(prev.ToString(), true);
+                             strHTML += " &nbsp;&nbsp; " + FormatTxStatus(prev) + ", ";
+                             strHTML = strHTML + "IsMine=" + (prev.vout[prevout.n].IsMine() ? "true" : "false") + "<br>";
+                         }
+                     }
+                 }
+             }
+         }
+         strHTML += "</font></html>";
+         string(strHTML.begin(), strHTML.end()).swap(strHTML);
+         m_htmlWin->SetPage(strHTML);
+         m_buttonOK->SetFocus();
+     }
+ }
+ void CTxDetailsDialog::OnButtonOK(wxCommandEvent& event)
+ {
+     EndModal(false);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // Startup folder
+ //
+ #ifdef __WXMSW__
+ string StartupShortcutPath()
+ {
+     return MyGetSpecialFolderPath(CSIDL_STARTUP, true) + "\\Bitcoin.lnk";
+ }
+ bool GetStartOnSystemStartup()
+ {
+     return filesystem::exists(StartupShortcutPath().c_str());
+ }
+ void SetStartOnSystemStartup(bool fAutoStart)
+ {
+     // If the shortcut exists already, remove it for updating
+     remove(StartupShortcutPath().c_str());
+     if (fAutoStart)
+     {
+         CoInitialize(NULL);
+         // Get a pointer to the IShellLink interface.
+         IShellLink* psl = NULL;
+         HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
+                                 CLSCTX_INPROC_SERVER, IID_IShellLink,
+                                 reinterpret_cast<void**>(&psl));
+         if (SUCCEEDED(hres))
+         {
+             // Get the current executable path
+             TCHAR pszExePath[MAX_PATH];
+             GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
+             // Set the path to the shortcut target
+             psl->SetPath(pszExePath);
+             PathRemoveFileSpec(pszExePath);
+             psl->SetWorkingDirectory(pszExePath);
+             psl->SetShowCmd(SW_SHOWMINNOACTIVE);
+             // Query IShellLink for the IPersistFile interface for
+             // saving the shortcut in persistent storage.
+             IPersistFile* ppf = NULL;
+             hres = psl->QueryInterface(IID_IPersistFile,
+                                        reinterpret_cast<void**>(&ppf));
+             if (SUCCEEDED(hres))
+             {
+                 WCHAR pwsz[MAX_PATH];
+                 // Ensure that the string is ANSI.
+                 MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().c_str(), -1, pwsz, MAX_PATH);
+                 // Save the link by calling IPersistFile::Save.
+                 hres = ppf->Save(pwsz, TRUE);
+                 ppf->Release();
+             }
+             psl->Release();
+         }
+         CoUninitialize();
+     }
+ }
+ #elif defined(__WXGTK__)
+ // Follow the Desktop Application Autostart Spec:
+ //  http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
+ boost::filesystem::path GetAutostartDir()
+ {
+     namespace fs = boost::filesystem;
+     char* pszConfigHome = getenv("XDG_CONFIG_HOME");
+     if (pszConfigHome) return fs::path(pszConfigHome) / fs::path("autostart");
+     char* pszHome = getenv("HOME");
+     if (pszHome) return fs::path(pszHome) / fs::path(".config/autostart");
+     return fs::path();
+ }
+ boost::filesystem::path GetAutostartFilePath()
+ {
+     return GetAutostartDir() / boost::filesystem::path("bitcoin.desktop");
+ }
+ bool GetStartOnSystemStartup()
+ {
+     boost::filesystem::ifstream optionFile(GetAutostartFilePath());
+     if (!optionFile.good())
+         return false;
+     // Scan through file for "Hidden=true":
+     string line;
+     while (!optionFile.eof())
+     {
+         getline(optionFile, line);
+         if (line.find("Hidden") != string::npos &&
+             line.find("true") != string::npos)
+             return false;
+     }
+     optionFile.close();
+     return true;
+ }
+ void SetStartOnSystemStartup(bool fAutoStart)
+ {
+     if (!fAutoStart)
+     {
+         unlink(GetAutostartFilePath().native_file_string().c_str());
+     }
+     else
+     {
+         char pszExePath[MAX_PATH+1];
+         memset(pszExePath, 0, sizeof(pszExePath));
+         if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
+             return;
+         boost::filesystem::create_directories(GetAutostartDir());
+         boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc);
+         if (!optionFile.good())
+         {
+             wxMessageBox(_("Cannot write autostart/bitcoin.desktop file"), "Bitcoin");
+             return;
+         }
+         // Write a bitcoin.desktop file to the autostart directory:
+         optionFile << "[Desktop Entry]\n";
+         optionFile << "Type=Application\n";
+         optionFile << "Name=Bitcoin\n";
+         optionFile << "Exec=" << pszExePath << "\n";
+         optionFile << "Terminal=false\n";
+         optionFile << "Hidden=false\n";
+         optionFile.close();
+     }
+ }
+ #else
+ // TODO: OSX startup stuff; see:
+ // http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html
+ bool GetStartOnSystemStartup() { return false; }
+ void SetStartOnSystemStartup(bool fAutoStart) { }
+ #endif
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // COptionsDialog
+ //
+ COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent)
+ {
+     // Set up list box of page choices
+     m_listBox->Append(_("Main"));
+     //m_listBox->Append(_("Test 2"));
+     m_listBox->SetSelection(0);
+     SelectPage(0);
+ #ifndef __WXMSW__
+     SetSize(1.0 * GetSize().GetWidth(), 1.2 * GetSize().GetHeight());
+ #endif
+ #if defined(__WXGTK__) || defined(__WXMAC_OSX__)
+     m_checkBoxStartOnSystemStartup->SetLabel(_("&Start Bitcoin on window system startup"));
+     if (!GetBoolArg("-minimizetotray"))
+     {
+         // Minimize to tray is just too buggy on Linux
+         fMinimizeToTray = false;
+         m_checkBoxMinimizeToTray->SetValue(false);
+         m_checkBoxMinimizeToTray->Enable(false);
+         m_checkBoxMinimizeOnClose->SetLabel(_("&Minimize on close"));
+     }
+ #endif
+ #ifdef __WXMAC_OSX__
+     m_checkBoxStartOnSystemStartup->Enable(false); // not implemented yet
+ #endif
+     // Init values
+     m_textCtrlTransactionFee->SetValue(FormatMoney(nTransactionFee));
 -void COptionsDialog::OnCheckBoxLimitProcessors(wxCommandEvent& event)
 -{
 -    m_spinCtrlLimitProcessors->Enable(event.IsChecked());
 -}
 -
+     m_checkBoxStartOnSystemStartup->SetValue(fTmpStartOnSystemStartup = GetStartOnSystemStartup());
+     m_checkBoxMinimizeToTray->SetValue(fMinimizeToTray);
+     m_checkBoxMinimizeOnClose->SetValue(fMinimizeOnClose);
+     if (fHaveUPnP)
+         m_checkBoxUseUPnP->SetValue(fUseUPnP);
+     else
+         m_checkBoxUseUPnP->Enable(false);
+     m_checkBoxUseProxy->SetValue(fUseProxy);
+     m_textCtrlProxyIP->Enable(fUseProxy);
+     m_textCtrlProxyPort->Enable(fUseProxy);
+     m_staticTextProxyIP->Enable(fUseProxy);
+     m_staticTextProxyPort->Enable(fUseProxy);
+     m_textCtrlProxyIP->SetValue(addrProxy.ToStringIP());
+     m_textCtrlProxyPort->SetValue(addrProxy.ToStringPort());
+     m_buttonOK->SetFocus();
+ }
+ void COptionsDialog::SelectPage(int nPage)
+ {
+     m_panelMain->Show(nPage == 0);
+     m_panelTest2->Show(nPage == 1);
+     m_scrolledWindow->Layout();
+     m_scrolledWindow->SetScrollbars(0, 0, 0, 0, 0, 0);
+ }
+ void COptionsDialog::OnListBox(wxCommandEvent& event)
+ {
+     SelectPage(event.GetSelection());
+ }
+ void COptionsDialog::OnKillFocusTransactionFee(wxFocusEvent& event)
+ {
+     event.Skip();
+     int64 nTmp = nTransactionFee;
+     ParseMoney(m_textCtrlTransactionFee->GetValue(), nTmp);
+     m_textCtrlTransactionFee->SetValue(FormatMoney(nTmp));
+ }
 -    int nPrevMaxProc = (fLimitProcessors ? nLimitProcessors : INT_MAX);
 -    if (fLimitProcessors != m_checkBoxLimitProcessors->GetValue())
 -    {
 -        fLimitProcessors = m_checkBoxLimitProcessors->GetValue();
 -        walletdb.WriteSetting("fLimitProcessors", fLimitProcessors);
 -    }
 -    if (nLimitProcessors != m_spinCtrlLimitProcessors->GetValue())
 -    {
 -        nLimitProcessors = m_spinCtrlLimitProcessors->GetValue();
 -        walletdb.WriteSetting("nLimitProcessors", nLimitProcessors);
 -    }
 -    if (fGenerateBitcoins && (fLimitProcessors ? nLimitProcessors : INT_MAX) > nPrevMaxProc)
 -        GenerateBitcoins(fGenerateBitcoins);
 -
+ void COptionsDialog::OnCheckBoxUseProxy(wxCommandEvent& event)
+ {
+     m_textCtrlProxyIP->Enable(event.IsChecked());
+     m_textCtrlProxyPort->Enable(event.IsChecked());
+     m_staticTextProxyIP->Enable(event.IsChecked());
+     m_staticTextProxyPort->Enable(event.IsChecked());
+ }
+ CAddress COptionsDialog::GetProxyAddr()
+ {
+     // Be careful about byte order, addr.ip and addr.port are big endian
+     CAddress addr(m_textCtrlProxyIP->GetValue() + ":" + m_textCtrlProxyPort->GetValue());
+     if (addr.ip == INADDR_NONE)
+         addr.ip = addrProxy.ip;
+     int nPort = atoi(m_textCtrlProxyPort->GetValue());
+     addr.port = htons(nPort);
+     if (nPort <= 0 || nPort > USHRT_MAX)
+         addr.port = addrProxy.port;
+     return addr;
+ }
+ void COptionsDialog::OnKillFocusProxy(wxFocusEvent& event)
+ {
+     event.Skip();
+     m_textCtrlProxyIP->SetValue(GetProxyAddr().ToStringIP());
+     m_textCtrlProxyPort->SetValue(GetProxyAddr().ToStringPort());
+ }
+ void COptionsDialog::OnButtonOK(wxCommandEvent& event)
+ {
+     OnButtonApply(event);
+     EndModal(false);
+ }
+ void COptionsDialog::OnButtonCancel(wxCommandEvent& event)
+ {
+     EndModal(false);
+ }
+ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
+ {
+     CWalletDB walletdb;
+     int64 nPrevTransactionFee = nTransactionFee;
+     if (ParseMoney(m_textCtrlTransactionFee->GetValue(), nTransactionFee) && nTransactionFee != nPrevTransactionFee)
+         walletdb.WriteSetting("nTransactionFee", nTransactionFee);
 -
+     if (fTmpStartOnSystemStartup != m_checkBoxStartOnSystemStartup->GetValue())
+     {
+         fTmpStartOnSystemStartup = m_checkBoxStartOnSystemStartup->GetValue();
+         SetStartOnSystemStartup(fTmpStartOnSystemStartup);
+     }
+     if (fMinimizeToTray != m_checkBoxMinimizeToTray->GetValue())
+     {
+         fMinimizeToTray = m_checkBoxMinimizeToTray->GetValue();
+         walletdb.WriteSetting("fMinimizeToTray", fMinimizeToTray);
+         ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);
+     }
+     if (fMinimizeOnClose != m_checkBoxMinimizeOnClose->GetValue())
+     {
+         fMinimizeOnClose = m_checkBoxMinimizeOnClose->GetValue();
+         walletdb.WriteSetting("fMinimizeOnClose", fMinimizeOnClose);
+     }
+     if (fHaveUPnP && fUseUPnP != m_checkBoxUseUPnP->GetValue())
+     {
+         fUseUPnP = m_checkBoxUseUPnP->GetValue();
+         walletdb.WriteSetting("fUseUPnP", fUseUPnP);
+         MapPort(fUseUPnP);
+     }
+     fUseProxy = m_checkBoxUseProxy->GetValue();
+     walletdb.WriteSetting("fUseProxy", fUseProxy);
+     addrProxy = GetProxyAddr();
+     walletdb.WriteSetting("addrProxy", addrProxy);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CAboutDialog
+ //
+ CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
+ {
+     m_staticTextVersion->SetLabel(strprintf(_("version %s"), FormatFullVersion().c_str()));
+     // Change (c) into UTF-8 or ANSI copyright symbol
+     wxString str = m_staticTextMain->GetLabel();
+ #if wxUSE_UNICODE
+     str.Replace("(c)", wxString::FromUTF8("\xC2\xA9"));
+ #else
+     str.Replace("(c)", "\xA9");
+ #endif
+     m_staticTextMain->SetLabel(str);
+ #ifndef __WXMSW__
+     // Resize on Linux to make the window fit the text.
+     // The text was wrapped manually rather than using the Wrap setting because
+     // the wrap would be too small on Linux and it can't be changed at this point.
+     wxFont fontTmp = m_staticTextMain->GetFont();
+     if (fontTmp.GetPointSize() > 8);
+         fontTmp.SetPointSize(8);
+     m_staticTextMain->SetFont(fontTmp);
+     SetSize(GetSize().GetWidth() + 44, GetSize().GetHeight() + 10);
+ #endif
+ }
+ void CAboutDialog::OnButtonOK(wxCommandEvent& event)
+ {
+     EndModal(false);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CSendDialog
+ //
+ CSendDialog::CSendDialog(wxWindow* parent, const wxString& strAddress) : CSendDialogBase(parent)
+ {
+     // Init
+     m_textCtrlAddress->SetValue(strAddress);
+     m_choiceTransferType->SetSelection(0);
+     m_bitmapCheckMark->Show(false);
+     fEnabledPrev = true;
+     m_textCtrlAddress->SetFocus();
++    
+     //// todo: should add a display of your balance for convenience
+ #ifndef __WXMSW__
+     wxFont fontTmp = m_staticTextInstructions->GetFont();
+     if (fontTmp.GetPointSize() > 9);
+         fontTmp.SetPointSize(9);
+     m_staticTextInstructions->SetFont(fontTmp);
+     SetSize(725, 180);
+ #endif
 -    EVT_MENU(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnMenuGenerate)
++    
+     // Set Icon
+     wxIcon iconSend;
+     iconSend.CopyFromBitmap(wxBitmap(send16noshadow_xpm));
+     SetIcon(iconSend);
+     // Fixup the tab order
+     m_buttonPaste->MoveAfterInTabOrder(m_buttonCancel);
+     m_buttonAddress->MoveAfterInTabOrder(m_buttonPaste);
+     this->Layout();
+ }
+ void CSendDialog::OnKillFocusAmount(wxFocusEvent& event)
+ {
+     // Reformat the amount
+     event.Skip();
+     if (m_textCtrlAmount->GetValue().Trim().empty())
+         return;
+     int64 nTmp;
+     if (ParseMoney(m_textCtrlAmount->GetValue(), nTmp))
+         m_textCtrlAmount->SetValue(FormatMoney(nTmp));
+ }
+ void CSendDialog::OnButtonAddressBook(wxCommandEvent& event)
+ {
+     // Open address book
+     CAddressBookDialog dialog(this, m_textCtrlAddress->GetValue(), CAddressBookDialog::SENDING, true);
+     if (dialog.ShowModal())
+         m_textCtrlAddress->SetValue(dialog.GetSelectedAddress());
+ }
+ void CSendDialog::OnButtonPaste(wxCommandEvent& event)
+ {
+     // Copy clipboard to address box
+     if (wxTheClipboard->Open())
+     {
+         if (wxTheClipboard->IsSupported(wxDF_TEXT))
+         {
+             wxTextDataObject data;
+             wxTheClipboard->GetData(data);
+             m_textCtrlAddress->SetValue(data.GetText());
+         }
+         wxTheClipboard->Close();
+     }
+ }
+ void CSendDialog::OnButtonSend(wxCommandEvent& event)
+ {
+     static CCriticalSection cs_sendlock;
+     TRY_CRITICAL_BLOCK(cs_sendlock)
+     {
+         CWalletTx wtx;
+         string strAddress = (string)m_textCtrlAddress->GetValue();
+         // Parse amount
+         int64 nValue = 0;
+         if (!ParseMoney(m_textCtrlAmount->GetValue(), nValue) || nValue <= 0)
+         {
+             wxMessageBox(_("Error in amount  "), _("Send Coins"));
+             return;
+         }
+         if (nValue > GetBalance())
+         {
+             wxMessageBox(_("Amount exceeds your balance  "), _("Send Coins"));
+             return;
+         }
+         if (nValue + nTransactionFee > GetBalance())
+         {
+             wxMessageBox(string(_("Total exceeds your balance when the ")) + FormatMoney(nTransactionFee) + _(" transaction fee is included  "), _("Send Coins"));
+             return;
+         }
+         // Parse bitcoin address
+         uint160 hash160;
+         bool fBitcoinAddress = AddressToHash160(strAddress, hash160);
+         if (fBitcoinAddress)
+         {
+           CRITICAL_BLOCK(cs_main)
+           {
+                 // Send to bitcoin address
+                 CScript scriptPubKey;
+                 scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
+                 string strError = SendMoney(scriptPubKey, nValue, wtx, true);
+                 if (strError == "")
+                     wxMessageBox(_("Payment sent  "), _("Sending..."));
+                 else if (strError == "ABORTED")
+                     return; // leave send dialog open
+                 else
+                 {
+                     wxMessageBox(strError + "  ", _("Sending..."));
+                     EndModal(false);
++                    return;
+                 }
+           }
+         }
+         else
+         {
+             // Parse IP address
+             CAddress addr(strAddress);
+             if (!addr.IsValid())
+             {
+                 wxMessageBox(_("Invalid address  "), _("Send Coins"));
+                 return;
+             }
+             // Message
+             wtx.mapValue["to"] = strAddress;
+             // Send to IP address
+             CSendingDialog* pdialog = new CSendingDialog(this, addr, nValue, wtx);
+             if (!pdialog->ShowModal())
+                 return;
+         }
+         CRITICAL_BLOCK(cs_mapAddressBook)
+             if (!mapAddressBook.count(strAddress))
+                 SetAddressBookName(strAddress, "");
+         EndModal(true);
+     }
+ }
+ void CSendDialog::OnButtonCancel(wxCommandEvent& event)
+ {
+     // Cancel
+     EndModal(false);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CSendingDialog
+ //
+ CSendingDialog::CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn) : CSendingDialogBase(NULL) // we have to give null so parent can't destroy us
+ {
+     addr = addrIn;
+     nPrice = nPriceIn;
+     wtx = wtxIn;
+     start = wxDateTime::UNow();
+     memset(pszStatus, 0, sizeof(pszStatus));
+     fCanCancel = true;
+     fAbort = false;
+     fSuccess = false;
+     fUIDone = false;
+     fWorkDone = false;
+ #ifndef __WXMSW__
+     SetSize(1.2 * GetSize().GetWidth(), 1.08 * GetSize().GetHeight());
+ #endif
+     SetTitle(strprintf(_("Sending %s to %s"), FormatMoney(nPrice).c_str(), wtx.mapValue["to"].c_str()));
+     m_textCtrlStatus->SetValue("");
+     CreateThread(SendingDialogStartTransfer, this);
+ }
+ CSendingDialog::~CSendingDialog()
+ {
+     printf("~CSendingDialog()\n");
+ }
+ void CSendingDialog::Close()
+ {
+     // Last one out turn out the lights.
+     // fWorkDone signals that work side is done and UI thread should call destroy.
+     // fUIDone signals that UI window has closed and work thread should call destroy.
+     // This allows the window to disappear and end modality when cancelled
+     // without making the user wait for ConnectNode to return.  The dialog object
+     // hangs around in the background until the work thread exits.
+     if (IsModal())
+         EndModal(fSuccess);
+     else
+         Show(false);
+     if (fWorkDone)
+         Destroy();
+     else
+         fUIDone = true;
+ }
+ void CSendingDialog::OnClose(wxCloseEvent& event)
+ {
+     if (!event.CanVeto() || fWorkDone || fAbort || !fCanCancel)
+     {
+         Close();
+     }
+     else
+     {
+         event.Veto();
+         wxCommandEvent cmdevent;
+         OnButtonCancel(cmdevent);
+     }
+ }
+ void CSendingDialog::OnButtonOK(wxCommandEvent& event)
+ {
+     if (fWorkDone)
+         Close();
+ }
+ void CSendingDialog::OnButtonCancel(wxCommandEvent& event)
+ {
+     if (fCanCancel)
+         fAbort = true;
+ }
+ void CSendingDialog::OnPaint(wxPaintEvent& event)
+ {
+     event.Skip();
+     if (strlen(pszStatus) > 130)
+         m_textCtrlStatus->SetValue(string("\n") + pszStatus);
+     else
+         m_textCtrlStatus->SetValue(string("\n\n") + pszStatus);
+     m_staticTextSending->SetFocus();
+     if (!fCanCancel)
+         m_buttonCancel->Enable(false);
+     if (fWorkDone)
+     {
+         m_buttonOK->Enable(true);
+         m_buttonOK->SetFocus();
+         m_buttonCancel->Enable(false);
+     }
+     if (fAbort && fCanCancel && IsShown())
+     {
+         strcpy(pszStatus, _("CANCELLED"));
+         m_buttonOK->Enable(true);
+         m_buttonOK->SetFocus();
+         m_buttonCancel->Enable(false);
+         m_buttonCancel->SetLabel(_("Cancelled"));
+         Close();
+         wxMessageBox(_("Transfer cancelled  "), _("Sending..."), wxOK, this);
+     }
+ }
+ //
+ // Everything from here on is not in the UI thread and must only communicate
+ // with the rest of the dialog through variables and calling repaint.
+ //
+ void CSendingDialog::Repaint()
+ {
+     Refresh();
+     wxPaintEvent event;
+     GetEventHandler()->AddPendingEvent(event);
+ }
+ bool CSendingDialog::Status()
+ {
+     if (fUIDone)
+     {
+         Destroy();
+         return false;
+     }
+     if (fAbort && fCanCancel)
+     {
+         memset(pszStatus, 0, 10);
+         strcpy(pszStatus, _("CANCELLED"));
+         Repaint();
+         fWorkDone = true;
+         return false;
+     }
+     return true;
+ }
+ bool CSendingDialog::Status(const string& str)
+ {
+     if (!Status())
+         return false;
+     // This can be read by the UI thread at any time,
+     // so copy in a way that can be read cleanly at all times.
+     memset(pszStatus, 0, min(str.size()+1, sizeof(pszStatus)));
+     strlcpy(pszStatus, str.c_str(), sizeof(pszStatus));
+     Repaint();
+     return true;
+ }
+ bool CSendingDialog::Error(const string& str)
+ {
+     fCanCancel = false;
+     fWorkDone = true;
+     Status(string(_("Error: ")) + str);
+     return false;
+ }
+ void SendingDialogStartTransfer(void* parg)
+ {
+     ((CSendingDialog*)parg)->StartTransfer();
+ }
+ void CSendingDialog::StartTransfer()
+ {
+     // Make sure we have enough money
+     if (nPrice + nTransactionFee > GetBalance())
+     {
+         Error(_("Insufficient funds"));
+         return;
+     }
+     // We may have connected already for product details
+     if (!Status(_("Connecting...")))
+         return;
+     CNode* pnode = ConnectNode(addr, 15 * 60);
+     if (!pnode)
+     {
+         Error(_("Unable to connect"));
+         return;
+     }
+     // Send order to seller, with response going to OnReply2 via event handler
+     if (!Status(_("Requesting public key...")))
+         return;
+     pnode->PushRequest("checkorder", wtx, SendingDialogOnReply2, this);
+ }
+ void SendingDialogOnReply2(void* parg, CDataStream& vRecv)
+ {
+     ((CSendingDialog*)parg)->OnReply2(vRecv);
+ }
+ void CSendingDialog::OnReply2(CDataStream& vRecv)
+ {
+     if (!Status(_("Received public key...")))
+         return;
+     CScript scriptPubKey;
+     int nRet;
+     try
+     {
+         vRecv >> nRet;
+         if (nRet > 0)
+         {
+             string strMessage;
+             if (!vRecv.empty())
+                 vRecv >> strMessage;
+             if (nRet == 2)
+                 Error(_("Recipient is not accepting transactions sent by IP address"));
+             else
+                 Error(_("Transfer was not accepted"));
+             //// todo: enlarge the window and enable a hidden white box to put seller's message
+             return;
+         }
+         vRecv >> scriptPubKey;
+     }
+     catch (...)
+     {
+         //// what do we want to do about this?
+         Error(_("Invalid response received"));
+         return;
+     }
+     // Pause to give the user a chance to cancel
+     while (wxDateTime::UNow() < start + wxTimeSpan(0, 0, 0, 2 * 1000))
+     {
+         Sleep(200);
+         if (!Status())
+             return;
+     }
+     CRITICAL_BLOCK(cs_main)
+     {
+         // Pay
+         if (!Status(_("Creating transaction...")))
+             return;
+         if (nPrice + nTransactionFee > GetBalance())
+         {
+             Error(_("Insufficient funds"));
+             return;
+         }
+         CReserveKey reservekey;
+         int64 nFeeRequired;
+         if (!CreateTransaction(scriptPubKey, nPrice, wtx, reservekey, nFeeRequired))
+         {
+             if (nPrice + nFeeRequired > GetBalance())
+                 Error(strprintf(_("This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds"), FormatMoney(nFeeRequired).c_str()));
+             else
+                 Error(_("Transaction creation failed"));
+             return;
+         }
+         // Transaction fee
+         if (!ThreadSafeAskFee(nFeeRequired, _("Sending..."), this))
+         {
+             Error(_("Transaction aborted"));
+             return;
+         }
+         // Make sure we're still connected
+         CNode* pnode = ConnectNode(addr, 2 * 60 * 60);
+         if (!pnode)
+         {
+             Error(_("Lost connection, transaction cancelled"));
+             return;
+         }
+         // Last chance to cancel
+         Sleep(50);
+         if (!Status())
+             return;
+         fCanCancel = false;
+         if (fAbort)
+         {
+             fCanCancel = true;
+             if (!Status())
+                 return;
+             fCanCancel = false;
+         }
+         if (!Status(_("Sending payment...")))
+             return;
+         // Commit
+         if (!CommitTransaction(wtx, reservekey))
+         {
+             Error(_("The transaction was rejected.  This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."));
+             return;
+         }
+         // Send payment tx to seller, with response going to OnReply3 via event handler
+         CWalletTx wtxSend = wtx;
+         wtxSend.fFromMe = false;
+         pnode->PushRequest("submitorder", wtxSend, SendingDialogOnReply3, this);
+         Status(_("Waiting for confirmation..."));
+         MainFrameRepaint();
+     }
+ }
+ void SendingDialogOnReply3(void* parg, CDataStream& vRecv)
+ {
+     ((CSendingDialog*)parg)->OnReply3(vRecv);
+ }
+ void CSendingDialog::OnReply3(CDataStream& vRecv)
+ {
+     int nRet;
+     try
+     {
+         vRecv >> nRet;
+         if (nRet > 0)
+         {
+             Error(_("The payment was sent, but the recipient was unable to verify it.\n"
+                     "The transaction is recorded and will credit to the recipient,\n"
+                     "but the comment information will be blank."));
+             return;
+         }
+     }
+     catch (...)
+     {
+         //// what do we want to do about this?
+         Error(_("Payment was sent, but an invalid response was received"));
+         return;
+     }
+     fSuccess = true;
+     fWorkDone = true;
+     Status(_("Payment completed"));
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CAddressBookDialog
+ //
+ CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn) : CAddressBookDialogBase(parent)
+ {
+     // Set initially selected page
+     wxNotebookEvent event;
+     event.SetSelection(nPageIn);
+     OnNotebookPageChanged(event);
+     m_notebook->ChangeSelection(nPageIn);
+     fDuringSend = fDuringSendIn;
+     if (!fDuringSend)
+         m_buttonCancel->Show(false);
+     // Set Icon
+     wxIcon iconAddressBook;
+     iconAddressBook.CopyFromBitmap(wxBitmap(addressbook16_xpm));
+     SetIcon(iconAddressBook);
+     // Init column headers
+     m_listCtrlSending->InsertColumn(0, _("Name"), wxLIST_FORMAT_LEFT, 200);
+     m_listCtrlSending->InsertColumn(1, _("Address"), wxLIST_FORMAT_LEFT, 350);
+     m_listCtrlSending->SetFocus();
+     m_listCtrlReceiving->InsertColumn(0, _("Label"), wxLIST_FORMAT_LEFT, 200);
+     m_listCtrlReceiving->InsertColumn(1, _("Bitcoin Address"), wxLIST_FORMAT_LEFT, 350);
+     m_listCtrlReceiving->SetFocus();
+     // Fill listctrl with address book data
+     CRITICAL_BLOCK(cs_mapKeys)
+     CRITICAL_BLOCK(cs_mapAddressBook)
+     {
+         string strDefaultReceiving = (string)pframeMain->m_textCtrlAddress->GetValue();
+         foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
+         {
+             string strAddress = item.first;
+             string strName = item.second;
+             uint160 hash160;
+             bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160));
+             wxListCtrl* plistCtrl = fMine ? m_listCtrlReceiving : m_listCtrlSending;
+             int nIndex = InsertLine(plistCtrl, strName, strAddress);
+             if (strAddress == (fMine ? strDefaultReceiving : string(strInitSelected)))
+                 plistCtrl->SetItemState(nIndex, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
+         }
+     }
+ }
+ wxString CAddressBookDialog::GetSelectedAddress()
+ {
+     int nIndex = GetSelection(m_listCtrl);
+     if (nIndex == -1)
+         return "";
+     return GetItemText(m_listCtrl, nIndex, 1);
+ }
+ wxString CAddressBookDialog::GetSelectedSendingAddress()
+ {
+     int nIndex = GetSelection(m_listCtrlSending);
+     if (nIndex == -1)
+         return "";
+     return GetItemText(m_listCtrlSending, nIndex, 1);
+ }
+ wxString CAddressBookDialog::GetSelectedReceivingAddress()
+ {
+     int nIndex = GetSelection(m_listCtrlReceiving);
+     if (nIndex == -1)
+         return "";
+     return GetItemText(m_listCtrlReceiving, nIndex, 1);
+ }
+ void CAddressBookDialog::OnNotebookPageChanged(wxNotebookEvent& event)
+ {
+     event.Skip();
+     nPage = event.GetSelection();
+     if (nPage == SENDING)
+         m_listCtrl = m_listCtrlSending;
+     else if (nPage == RECEIVING)
+         m_listCtrl = m_listCtrlReceiving;
+     m_buttonDelete->Show(nPage == SENDING);
+     m_buttonCopy->Show(nPage == RECEIVING);
+     this->Layout();
+     m_listCtrl->SetFocus();
+ }
+ void CAddressBookDialog::OnListEndLabelEdit(wxListEvent& event)
+ {
+     // Update address book with edited name
+     event.Skip();
+     if (event.IsEditCancelled())
+         return;
+     string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1);
+     SetAddressBookName(strAddress, string(event.GetText()));
+     pframeMain->RefreshListCtrl();
+ }
+ void CAddressBookDialog::OnListItemSelected(wxListEvent& event)
+ {
+     event.Skip();
+     if (nPage == RECEIVING)
+         SetDefaultReceivingAddress((string)GetSelectedReceivingAddress());
+ }
+ void CAddressBookDialog::OnListItemActivated(wxListEvent& event)
+ {
+     event.Skip();
+     if (fDuringSend)
+     {
+         // Doubleclick returns selection
+         EndModal(GetSelectedAddress() != "" ? 2 : 0);
+         return;
+     }
+     // Doubleclick edits item
+     wxCommandEvent event2;
+     OnButtonEdit(event2);
+ }
+ void CAddressBookDialog::OnButtonDelete(wxCommandEvent& event)
+ {
+     if (nPage != SENDING)
+         return;
+     for (int nIndex = m_listCtrl->GetItemCount()-1; nIndex >= 0; nIndex--)
+     {
+         if (m_listCtrl->GetItemState(nIndex, wxLIST_STATE_SELECTED))
+         {
+             string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1);
+             CWalletDB().EraseName(strAddress);
+             m_listCtrl->DeleteItem(nIndex);
+         }
+     }
+     pframeMain->RefreshListCtrl();
+ }
+ void CAddressBookDialog::OnButtonCopy(wxCommandEvent& event)
+ {
+     // Copy address box to clipboard
+     if (wxTheClipboard->Open())
+     {
+         wxTheClipboard->SetData(new wxTextDataObject(GetSelectedAddress()));
+         wxTheClipboard->Close();
+     }
+ }
+ bool CAddressBookDialog::CheckIfMine(const string& strAddress, const string& strTitle)
+ {
+     uint160 hash160;
+     bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160));
+     if (fMine)
+         wxMessageBox(_("This is one of your own addresses for receiving payments and cannot be entered in the address book.  "), strTitle);
+     return fMine;
+ }
+ void CAddressBookDialog::OnButtonEdit(wxCommandEvent& event)
+ {
+     int nIndex = GetSelection(m_listCtrl);
+     if (nIndex == -1)
+         return;
+     string strName = (string)m_listCtrl->GetItemText(nIndex);
+     string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1);
+     string strAddressOrg = strAddress;
+     if (nPage == SENDING)
+     {
+         // Ask name and address
+         do
+         {
+             CGetTextFromUserDialog dialog(this, _("Edit Address"), _("Name"), strName, _("Address"), strAddress);
+             if (!dialog.ShowModal())
+                 return;
+             strName = dialog.GetValue1();
+             strAddress = dialog.GetValue2();
+         }
+         while (CheckIfMine(strAddress, _("Edit Address")));
+     }
+     else if (nPage == RECEIVING)
+     {
+         // Ask name
+         CGetTextFromUserDialog dialog(this, _("Edit Address Label"), _("Label"), strName);
+         if (!dialog.ShowModal())
+             return;
+         strName = dialog.GetValue();
+     }
+     // Write back
+     if (strAddress != strAddressOrg)
+         CWalletDB().EraseName(strAddressOrg);
+     SetAddressBookName(strAddress, strName);
+     m_listCtrl->SetItem(nIndex, 1, strAddress);
+     m_listCtrl->SetItemText(nIndex, strName);
+     pframeMain->RefreshListCtrl();
+ }
+ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event)
+ {
+     string strName;
+     string strAddress;
+     if (nPage == SENDING)
+     {
+         // Ask name and address
+         do
+         {
+             CGetTextFromUserDialog dialog(this, _("Add Address"), _("Name"), strName, _("Address"), strAddress);
+             if (!dialog.ShowModal())
+                 return;
+             strName = dialog.GetValue1();
+             strAddress = dialog.GetValue2();
+         }
+         while (CheckIfMine(strAddress, _("Add Address")));
+     }
+     else if (nPage == RECEIVING)
+     {
+         // Ask name
+         CGetTextFromUserDialog dialog(this,
+             _("New Receiving Address"),
+             _("You should use a new address for each payment you receive.\n\nLabel"),
+             "");
+         if (!dialog.ShowModal())
+             return;
+         strName = dialog.GetValue();
+         // Generate new key
+         strAddress = PubKeyToAddress(GetKeyFromKeyPool());
+     }
+     // Add to list and select it
+     SetAddressBookName(strAddress, strName);
+     int nIndex = InsertLine(m_listCtrl, strName, strAddress);
+     SetSelection(m_listCtrl, nIndex);
+     m_listCtrl->SetFocus();
+     if (nPage == SENDING)
+         pframeMain->RefreshListCtrl();
+ }
+ void CAddressBookDialog::OnButtonOK(wxCommandEvent& event)
+ {
+     // OK
+     EndModal(GetSelectedAddress() != "" ? 1 : 0);
+ }
+ void CAddressBookDialog::OnButtonCancel(wxCommandEvent& event)
+ {
+     // Cancel
+     EndModal(0);
+ }
+ void CAddressBookDialog::OnClose(wxCloseEvent& event)
+ {
+     // Close
+     EndModal(0);
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CMyTaskBarIcon
+ //
+ enum
+ {
+     ID_TASKBAR_RESTORE = 10001,
++    ID_TASKBAR_SEND,
+     ID_TASKBAR_OPTIONS,
+     ID_TASKBAR_GENERATE,
+     ID_TASKBAR_EXIT,
+ };
+ BEGIN_EVENT_TABLE(CMyTaskBarIcon, wxTaskBarIcon)
+     EVT_TASKBAR_LEFT_DCLICK(CMyTaskBarIcon::OnLeftButtonDClick)
+     EVT_MENU(ID_TASKBAR_RESTORE, CMyTaskBarIcon::OnMenuRestore)
++    EVT_MENU(ID_TASKBAR_SEND, CMyTaskBarIcon::OnMenuSend)
+     EVT_MENU(ID_TASKBAR_OPTIONS, CMyTaskBarIcon::OnMenuOptions)
 -void CMyTaskBarIcon::OnMenuGenerate(wxCommandEvent& event)
 -{
 -    GenerateBitcoins(event.IsChecked());
 -}
 -
+     EVT_UPDATE_UI(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnUpdateUIGenerate)
+     EVT_MENU(ID_TASKBAR_EXIT, CMyTaskBarIcon::OnMenuExit)
+ END_EVENT_TABLE()
+ void CMyTaskBarIcon::Show(bool fShow)
+ {
+     static char pszPrevTip[200];
+     if (fShow)
+     {
+         string strTooltip = _("Bitcoin");
+         if (fGenerateBitcoins)
+             strTooltip = _("Bitcoin - Generating");
+         if (fGenerateBitcoins && vNodes.empty())
+             strTooltip = _("Bitcoin - (not connected)");
+         // Optimization, only update when changed, using char array to be reentrant
+         if (strncmp(pszPrevTip, strTooltip.c_str(), sizeof(pszPrevTip)-1) != 0)
+         {
+             strlcpy(pszPrevTip, strTooltip.c_str(), sizeof(pszPrevTip));
+ #ifdef __WXMSW__
+             // somehow it'll choose the wrong size and scale it down if
+             // we use the main icon, so we hand it one with only 16x16
+             SetIcon(wxICON(favicon), strTooltip);
+ #else
+             SetIcon(bitcoin80_xpm, strTooltip);
+ #endif
+         }
+     }
+     else
+     {
+         strlcpy(pszPrevTip, "", sizeof(pszPrevTip));
+         RemoveIcon();
+     }
+ }
+ void CMyTaskBarIcon::Hide()
+ {
+     Show(false);
+ }
+ void CMyTaskBarIcon::OnLeftButtonDClick(wxTaskBarIconEvent& event)
+ {
+     Restore();
+ }
+ void CMyTaskBarIcon::OnMenuRestore(wxCommandEvent& event)
+ {
+     Restore();
+ }
++void CMyTaskBarIcon::OnMenuSend(wxCommandEvent& event)
++{
++    // Taskbar: Send
++    CSendDialog dialog(pframeMain);
++    dialog.ShowModal();
++}
++
+ void CMyTaskBarIcon::OnMenuOptions(wxCommandEvent& event)
+ {
+     // Since it's modal, get the main window to do it
+     wxCommandEvent event2(wxEVT_COMMAND_MENU_SELECTED, wxID_PREFERENCES);
+     pframeMain->GetEventHandler()->AddPendingEvent(event2);
+ }
+ void CMyTaskBarIcon::Restore()
+ {
+     pframeMain->Show();
+     wxIconizeEvent event(0, false);
+     pframeMain->GetEventHandler()->AddPendingEvent(event);
+     pframeMain->Iconize(false);
+     pframeMain->Raise();
+ }
 -    pmenu->AppendCheckItem(ID_TASKBAR_GENERATE, _("&Generate Coins"))->Check(fGenerateBitcoins);
+ void CMyTaskBarIcon::OnUpdateUIGenerate(wxUpdateUIEvent& event)
+ {
+     event.Check(fGenerateBitcoins);
+ }
+ void CMyTaskBarIcon::OnMenuExit(wxCommandEvent& event)
+ {
+     pframeMain->Close(true);
+ }
+ void CMyTaskBarIcon::UpdateTooltip()
+ {
+     if (IsIconInstalled())
+         Show(true);
+ }
+ wxMenu* CMyTaskBarIcon::CreatePopupMenu()
+ {
+     wxMenu* pmenu = new wxMenu;
+     pmenu->Append(ID_TASKBAR_RESTORE, _("&Open Bitcoin"));
++    pmenu->Append(ID_TASKBAR_SEND, _("&Send Bitcoins"));
+     pmenu->Append(ID_TASKBAR_OPTIONS, _("O&ptions..."));
 -#ifdef GUI
 -    wxImage::AddHandler(new wxPNGHandler);
 -#endif
+ #ifndef __WXMAC_OSX__ // Mac has built-in quit menu
+     pmenu->AppendSeparator();
+     pmenu->Append(ID_TASKBAR_EXIT, _("E&xit"));
+ #endif
+     return pmenu;
+ }
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // CMyApp
+ //
+ void CreateMainWindow()
+ {
+     pframeMain = new CMainFrame(NULL);
+     if (GetBoolArg("-min"))
+         pframeMain->Iconize(true);
+ #if defined(__WXGTK__) || defined(__WXMAC_OSX__)
+     if (!GetBoolArg("-minimizetotray"))
+         fMinimizeToTray = false;
+ #endif
+     pframeMain->Show(true);  // have to show first to get taskbar button to hide
+     if (fMinimizeToTray && pframeMain->IsIconized())
+         fClosedToTray = true;
+     pframeMain->Show(!fClosedToTray);
+     ptaskbaricon->Show(fMinimizeToTray || fClosedToTray);
+     CreateThread(ThreadDelayedRepaint, NULL);
+ }
+ // Define a new application
+ class CMyApp : public wxApp
+ {
+ public:
+     CMyApp(){};
+     ~CMyApp(){};
+     bool OnInit();
+     bool OnInit2();
+     int OnExit();
+     // Hook Initialize so we can start without GUI
+     virtual bool Initialize(int& argc, wxChar** argv);
+     // 2nd-level exception handling: we get all the exceptions occurring in any
+     // event handler here
+     virtual bool OnExceptionInMainLoop();
+     // 3rd, and final, level exception handling: whenever an unhandled
+     // exception is caught, this function is called
+     virtual void OnUnhandledException();
+     // and now for something different: this function is called in case of a
+     // crash (e.g. dereferencing null pointer, division by 0, ...)
+     virtual void OnFatalException();
+ };
+ IMPLEMENT_APP(CMyApp)
+ bool CMyApp::Initialize(int& argc, wxChar** argv)
+ {
+     for (int i = 1; i < argc; i++)
+         if (!IsSwitchChar(argv[i][0]))
+             fCommandLine = true;
+     if (!fCommandLine)
+     {
+         // wxApp::Initialize will remove environment-specific parameters,
+         // so it's too early to call ParseParameters yet
+         for (int i = 1; i < argc; i++)
+         {
+             wxString str = argv[i];
+             #ifdef __WXMSW__
+             if (str.size() >= 1 && str[0] == '/')
+                 str[0] = '-';
+             char pszLower[MAX_PATH];
+             strlcpy(pszLower, str.c_str(), sizeof(pszLower));
+             strlwr(pszLower);
+             str = pszLower;
+             #endif
+             if (str == "-daemon")
+                 fDaemon = true;
+         }
+     }
+ #ifdef __WXGTK__
+     if (fDaemon || fCommandLine)
+     {
+         // Call the original Initialize while suppressing error messages
+         // and ignoring failure.  If unable to initialize GTK, it fails
+         // near the end so hopefully the last few things don't matter.
+         {
+             wxLogNull logNo;
+             wxApp::Initialize(argc, argv);
+         }
+         if (fDaemon)
+         {
+             // Daemonize
+             pid_t pid = fork();
+             if (pid < 0)
+             {
+                 fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
+                 return false;
+             }
+             if (pid > 0)
+                 pthread_exit((void*)0);
+             pid_t sid = setsid();
+             if (sid < 0)
+                 fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
+         }
+         return true;
+     }
+ #endif
+     return wxApp::Initialize(argc, argv);
+ }
+ bool CMyApp::OnInit()
+ {
+ #if defined(__WXMSW__) && defined(__WXDEBUG__) && defined(GUI)
+     // Disable malfunctioning wxWidgets debug assertion
+     extern int g_isPainting;
+     g_isPainting = 10000;
+ #endif
+ #if defined(__WXMSW__ ) || defined(__WXMAC_OSX__)
+     SetAppName("Bitcoin");
+ #else
+     SetAppName("bitcoin");
+ #endif
+ #ifdef __WXMSW__
+ #if wxUSE_UNICODE
+     // Hack to set wxConvLibc codepage to UTF-8 on Windows,
+     // may break if wxMBConv_win32 implementation in strconv.cpp changes.
+     class wxMBConv_win32 : public wxMBConv
+     {
+     public:
+         long m_CodePage;
+         size_t m_minMBCharWidth;
+     };
+     if (((wxMBConv_win32*)&wxConvLibc)->m_CodePage == CP_ACP)
+         ((wxMBConv_win32*)&wxConvLibc)->m_CodePage = CP_UTF8;
+ #endif
+ #endif
+     // Load locale/<lang>/LC_MESSAGES/bitcoin.mo language file
+     g_locale.Init(wxLANGUAGE_DEFAULT, 0);
+     g_locale.AddCatalogLookupPathPrefix("locale");
+ #ifndef __WXMSW__
+     g_locale.AddCatalogLookupPathPrefix("/usr/share/locale");
+     g_locale.AddCatalogLookupPathPrefix("/usr/local/share/locale");
+ #endif
+     g_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any
+     g_locale.AddCatalog("bitcoin");
+     return AppInit(argc, argv);
+ }
+ int CMyApp::OnExit()
+ {
+     Shutdown(NULL);
+     return wxApp::OnExit();
+ }
+ bool CMyApp::OnExceptionInMainLoop()
+ {
+     try
+     {
+         throw;
+     }
+     catch (std::exception& e)
+     {
+         PrintException(&e, "CMyApp::OnExceptionInMainLoop()");
+         wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
+         Sleep(1000);
+         throw;
+     }
+     catch (...)
+     {
+         PrintException(NULL, "CMyApp::OnExceptionInMainLoop()");
+         wxLogWarning("Unknown exception");
+         Sleep(1000);
+         throw;
+     }
+     return true;
+ }
+ void CMyApp::OnUnhandledException()
+ {
+     // this shows how we may let some exception propagate uncaught
+     try
+     {
+         throw;
+     }
+     catch (std::exception& e)
+     {
+         PrintException(&e, "CMyApp::OnUnhandledException()");
+         wxLogWarning("Exception %s %s", typeid(e).name(), e.what());
+         Sleep(1000);
+         throw;
+     }
+     catch (...)
+     {
+         PrintException(NULL, "CMyApp::OnUnhandledException()");
+         wxLogWarning("Unknown exception");
+         Sleep(1000);
+         throw;
+     }
+ }
+ void CMyApp::OnFatalException()
+ {
+     wxMessageBox(_("Program has crashed and will terminate.  "), "Bitcoin", wxOK | wxICON_ERROR);
+ }
diff --cc src/ui.h
index 0000000000000000000000000000000000000000,af97d5abb1aff8f51f71ab59fcbd2d44cfc4a5f7..aff1f1e0eace13d6545d91bdf9bfa17ca57f2fdc
mode 000000,100644..100644
--- /dev/null
+++ b/src/ui.h
@@@ -1,0 -1,344 +1,343 @@@
 -    void OnMenuOptionsGenerate(wxCommandEvent& event);
+ // Copyright (c) 2009-2010 Satoshi Nakamoto
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file license.txt or http://www.opensource.org/licenses/mit-license.php.
+ DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
+ extern wxLocale g_locale;
+ void HandleCtrlA(wxKeyEvent& event);
+ void UIThreadCall(boost::function0<void>);
+ int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
+ bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
+ void CalledSetStatusBar(const string& strText, int nField);
+ void MainFrameRepaint();
+ void CreateMainWindow();
+ void SetStartOnSystemStartup(bool fAutoStart);
+ inline int MyMessageBox(const wxString& message, const wxString& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
+ {
+ #ifdef GUI
+     if (!fDaemon)
+         return wxMessageBox(message, caption, style, parent, x, y);
+ #endif
+     printf("wxMessageBox %s: %s\n", string(caption).c_str(), string(message).c_str());
+     fprintf(stderr, "%s: %s\n", string(caption).c_str(), string(message).c_str());
+     return wxOK;
+ }
+ #define wxMessageBox  MyMessageBox
+ class CMainFrame : public CMainFrameBase
+ {
+ protected:
+     // Event handlers
+     void OnNotebookPageChanged(wxNotebookEvent& event);
+     void OnClose(wxCloseEvent& event);
+     void OnIconize(wxIconizeEvent& event);
+     void OnMouseEvents(wxMouseEvent& event);
+     void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
+     void OnIdle(wxIdleEvent& event);
+     void OnPaint(wxPaintEvent& event);
+     void OnPaintListCtrl(wxPaintEvent& event);
+     void OnMenuFileExit(wxCommandEvent& event);
 -    void OnCheckBoxLimitProcessors(wxCommandEvent& event);
+     void OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event);
+     void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
+     void OnMenuOptionsOptions(wxCommandEvent& event);
+     void OnMenuHelpAbout(wxCommandEvent& event);
+     void OnButtonSend(wxCommandEvent& event);
+     void OnButtonAddressBook(wxCommandEvent& event);
+     void OnSetFocusAddress(wxFocusEvent& event);
+     void OnMouseEventsAddress(wxMouseEvent& event);
+     void OnButtonNew(wxCommandEvent& event);
+     void OnButtonCopy(wxCommandEvent& event);
+     void OnListColBeginDrag(wxListEvent& event);
+     void OnListItemActivated(wxListEvent& event);
+     void OnListItemActivatedProductsSent(wxListEvent& event);
+     void OnListItemActivatedOrdersSent(wxListEvent& event);
+     void OnListItemActivatedOrdersReceived(wxListEvent& event);
+       
+ public:
+     /** Constructor */
+     CMainFrame(wxWindow* parent);
+     ~CMainFrame();
+     // Custom
+     enum
+     {
+         ALL = 0,
+         SENTRECEIVED = 1,
+         SENT = 2,
+         RECEIVED = 3,
+     };
+     int nPage;
+     wxListCtrl* m_listCtrl;
+     bool fShowGenerated;
+     bool fShowSent;
+     bool fShowReceived;
+     bool fRefreshListCtrl;
+     bool fRefreshListCtrlRunning;
+     bool fOnSetFocusAddress;
+     unsigned int nListViewUpdated;
+     bool fRefresh;
+     void OnUIThreadCall(wxCommandEvent& event);
+     int GetSortIndex(const string& strSort);
+     void InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxColour& colour, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5);
+     bool DeleteLine(uint256 hashKey);
+     bool InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
+     void RefreshListCtrl();
+     void RefreshStatusColumn();
+ };
+ class CTxDetailsDialog : public CTxDetailsDialogBase
+ {
+ protected:
+     // Event handlers
+     void OnButtonOK(wxCommandEvent& event);
+ public:
+     /** Constructor */
+     CTxDetailsDialog(wxWindow* parent, CWalletTx wtx);
+     // State
+     CWalletTx wtx;
+ };
+ class COptionsDialog : public COptionsDialogBase
+ {
+ protected:
+     // Event handlers
+     void OnListBox(wxCommandEvent& event);
+     void OnKillFocusTransactionFee(wxFocusEvent& event);
+     void OnCheckBoxUseProxy(wxCommandEvent& event);
+     void OnKillFocusProxy(wxFocusEvent& event);
+     void OnButtonOK(wxCommandEvent& event);
+     void OnButtonCancel(wxCommandEvent& event);
+     void OnButtonApply(wxCommandEvent& event);
+ public:
+     /** Constructor */
+     COptionsDialog(wxWindow* parent);
+     // Custom
+     bool fTmpStartOnSystemStartup;
+     bool fTmpMinimizeOnClose;
+     void SelectPage(int nPage);
+     CAddress GetProxyAddr();
+ };
+ class CAboutDialog : public CAboutDialogBase
+ {
+ protected:
+     // Event handlers
+     void OnButtonOK(wxCommandEvent& event);
+ public:
+     /** Constructor */
+     CAboutDialog(wxWindow* parent);
+ };
+ class CSendDialog : public CSendDialogBase
+ {
+ protected:
+     // Event handlers
+     void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
+     void OnKillFocusAmount(wxFocusEvent& event);
+     void OnButtonAddressBook(wxCommandEvent& event);
+     void OnButtonPaste(wxCommandEvent& event);
+     void OnButtonSend(wxCommandEvent& event);
+     void OnButtonCancel(wxCommandEvent& event);
+       
+ public:
+     /** Constructor */
+     CSendDialog(wxWindow* parent, const wxString& strAddress="");
+     // Custom
+     bool fEnabledPrev;
+     string strFromSave;
+     string strMessageSave;
+ };
+ class CSendingDialog : public CSendingDialogBase
+ {
+ public:
+     // Event handlers
+     void OnClose(wxCloseEvent& event);
+     void OnButtonOK(wxCommandEvent& event);
+     void OnButtonCancel(wxCommandEvent& event);
+     void OnPaint(wxPaintEvent& event);
+       
+ public:
+     /** Constructor */
+     CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn);
+     ~CSendingDialog();
+     // State
+     CAddress addr;
+     int64 nPrice;
+     CWalletTx wtx;
+     wxDateTime start;
+     char pszStatus[10000];
+     bool fCanCancel;
+     bool fAbort;
+     bool fSuccess;
+     bool fUIDone;
+     bool fWorkDone;
+     void Close();
+     void Repaint();
+     bool Status();
+     bool Status(const string& str);
+     bool Error(const string& str);
+     void StartTransfer();
+     void OnReply2(CDataStream& vRecv);
+     void OnReply3(CDataStream& vRecv);
+ };
+ void SendingDialogStartTransfer(void* parg);
+ void SendingDialogOnReply2(void* parg, CDataStream& vRecv);
+ void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
+ class CAddressBookDialog : public CAddressBookDialogBase
+ {
+ protected:
+     // Event handlers
+     void OnNotebookPageChanged(wxNotebookEvent& event);
+     void OnListEndLabelEdit(wxListEvent& event);
+     void OnListItemSelected(wxListEvent& event);
+     void OnListItemActivated(wxListEvent& event);
+     void OnButtonDelete(wxCommandEvent& event);
+     void OnButtonCopy(wxCommandEvent& event);
+     void OnButtonEdit(wxCommandEvent& event);
+     void OnButtonNew(wxCommandEvent& event);
+     void OnButtonOK(wxCommandEvent& event);
+     void OnButtonCancel(wxCommandEvent& event);
+     void OnClose(wxCloseEvent& event);
+ public:
+     /** Constructor */
+     CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn);
+     // Custom
+     enum
+     {
+         SENDING = 0,
+         RECEIVING = 1,
+     };
+     int nPage;
+     wxListCtrl* m_listCtrl;
+     bool fDuringSend;
+     wxString GetAddress();
+     wxString GetSelectedAddress();
+     wxString GetSelectedSendingAddress();
+     wxString GetSelectedReceivingAddress();
+     bool CheckIfMine(const string& strAddress, const string& strTitle);
+ };
+ class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
+ {
+ protected:
+     // Event handlers
+     void OnButtonOK(wxCommandEvent& event)     { EndModal(true); }
+     void OnButtonCancel(wxCommandEvent& event) { EndModal(false); }
+     void OnClose(wxCloseEvent& event)          { EndModal(false); }
+     void OnKeyDown(wxKeyEvent& event)
+     {
+         if (event.GetKeyCode() == '\r' || event.GetKeyCode() == WXK_NUMPAD_ENTER)
+             EndModal(true);
+         else
+             HandleCtrlA(event);
+     }
+ public:
+     /** Constructor */
+     CGetTextFromUserDialog(wxWindow* parent,
+                            const string& strCaption,
+                            const string& strMessage1,
+                            const string& strValue1="",
+                            const string& strMessage2="",
+                            const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
+     {
+         int x = GetSize().GetWidth();
+         int y = GetSize().GetHeight();
+         m_staticTextMessage1->SetLabel(strMessage1);
+         m_textCtrl1->SetValue(strValue1);
+         y += wxString(strMessage1).Freq('\n') * 14;
+         if (!strMessage2.empty())
+         {
+             m_staticTextMessage2->Show(true);
+             m_staticTextMessage2->SetLabel(strMessage2);
+             m_textCtrl2->Show(true);
+             m_textCtrl2->SetValue(strValue2);
+             y += 46 + wxString(strMessage2).Freq('\n') * 14;
+         }
+ #ifndef __WXMSW__
+         x = x * 114 / 100;
+         y = y * 114 / 100;
+ #endif
+         SetSize(x, y);
+     }
+     // Custom
+     string GetValue()  { return (string)m_textCtrl1->GetValue(); }
+     string GetValue1() { return (string)m_textCtrl1->GetValue(); }
+     string GetValue2() { return (string)m_textCtrl2->GetValue(); }
+ };
+ class CMyTaskBarIcon : public wxTaskBarIcon
+ {
+ protected:
+     // Event handlers
+     void OnLeftButtonDClick(wxTaskBarIconEvent& event);
+     void OnMenuRestore(wxCommandEvent& event);
++    void OnMenuSend(wxCommandEvent& event);
+     void OnMenuOptions(wxCommandEvent& event);
+     void OnUpdateUIGenerate(wxUpdateUIEvent& event);
+     void OnMenuGenerate(wxCommandEvent& event);
+     void OnMenuExit(wxCommandEvent& event);
+ public:
+     CMyTaskBarIcon() : wxTaskBarIcon()
+     {
+         Show(true);
+     }
+     void Show(bool fShow=true);
+     void Hide();
+     void Restore();
+     void UpdateTooltip();
+     virtual wxMenu* CreatePopupMenu();
+ DECLARE_EVENT_TABLE()
+ };
diff --cc src/uibase.cpp
index 0000000000000000000000000000000000000000,41be5d75278280fcf2bb792a400ad7a41e2ba8bb..1b901a1edb87c9b91752a8cca14a8db6d60ca916
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1033 +1,1008 @@@
 -      wxMenuItem* m_menuOptionsGenerateBitcoins;
 -      m_menuOptionsGenerateBitcoins = new wxMenuItem( m_menuOptions, wxID_OPTIONSGENERATEBITCOINS, wxString( _("&Generate Coins") ) , wxEmptyString, wxITEM_CHECK );
 -      m_menuOptions->Append( m_menuOptionsGenerateBitcoins );
 -      
+ ///////////////////////////////////////////////////////////////////////////
+ // C++ code generated with wxFormBuilder (version Dec 21 2009)
+ // http://www.wxformbuilder.org/
+ //
+ // PLEASE DO "NOT" EDIT THIS FILE!
+ ///////////////////////////////////////////////////////////////////////////
+ #include "uibase.h"
+ #include "xpm/about.xpm"
+ #include "xpm/addressbook20.xpm"
+ #include "xpm/check.xpm"
+ #include "xpm/send20.xpm"
+ ///////////////////////////////////////////////////////////////////////////
+ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
+       
+       m_menubar = new wxMenuBar( 0 );
+       m_menuFile = new wxMenu();
+       wxMenuItem* m_menuFileExit;
+       m_menuFileExit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("E&xit") ) , wxEmptyString, wxITEM_NORMAL );
+       m_menuFile->Append( m_menuFileExit );
+       
+       m_menubar->Append( m_menuFile, _("&File") );
+       
+       m_menuOptions = new wxMenu();
 -      this->Connect( m_menuOptionsGenerateBitcoins->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsGenerate ) );
 -      this->Connect( m_menuOptionsGenerateBitcoins->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIOptionsGenerate ) );
+       wxMenuItem* m_menuOptionsChangeYourAddress;
+       m_menuOptionsChangeYourAddress = new wxMenuItem( m_menuOptions, wxID_ANY, wxString( _("&Your Receiving Addresses...") ) , wxEmptyString, wxITEM_NORMAL );
+       m_menuOptions->Append( m_menuOptionsChangeYourAddress );
+       
+       wxMenuItem* m_menuOptionsOptions;
+       m_menuOptionsOptions = new wxMenuItem( m_menuOptions, wxID_PREFERENCES, wxString( _("&Options...") ) , wxEmptyString, wxITEM_NORMAL );
+       m_menuOptions->Append( m_menuOptionsOptions );
+       
+       m_menubar->Append( m_menuOptions, _("&Settings") );
+       
+       m_menuHelp = new wxMenu();
+       wxMenuItem* m_menuHelpAbout;
+       m_menuHelpAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) , wxEmptyString, wxITEM_NORMAL );
+       m_menuHelp->Append( m_menuHelpAbout );
+       
+       m_menubar->Append( m_menuHelp, _("&Help") );
+       
+       this->SetMenuBar( m_menubar );
+       
+       m_toolBar = this->CreateToolBar( wxTB_FLAT|wxTB_HORZ_TEXT, wxID_ANY );
+       m_toolBar->SetToolBitmapSize( wxSize( 20,20 ) );
+       m_toolBar->SetToolSeparation( 1 );
+       m_toolBar->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
+       
+       m_toolBar->AddTool( wxID_BUTTONSEND, _("Send Coins"), wxBitmap( send20_xpm ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString );
+       m_toolBar->AddTool( wxID_BUTTONRECEIVE, _("Address Book"), wxBitmap( addressbook20_xpm ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString );
+       m_toolBar->Realize();
+       
+       m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
+       wxBoxSizer* bSizer2;
+       bSizer2 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer2->Add( 0, 2, 0, wxEXPAND, 5 );
+       
+       wxBoxSizer* bSizer85;
+       bSizer85 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_staticText32 = new wxStaticText( this, wxID_ANY, _("Your Bitcoin Address:"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText32->Wrap( -1 );
+       bSizer85->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
+       
+       m_textCtrlAddress = new wxTextCtrl( this, wxID_TEXTCTRLADDRESS, wxEmptyString, wxDefaultPosition, wxSize( 340,-1 ), wxTE_READONLY );
+       bSizer85->Add( m_textCtrlAddress, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
+       
+       m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New... "), wxDefaultPosition, wxSize( -1,-1 ), wxBU_EXACTFIT );
+       bSizer85->Add( m_buttonNew, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
+       
+       m_buttonCopy = new wxButton( this, wxID_BUTTONCOPY, _(" &Copy to Clipboard "), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
+       bSizer85->Add( m_buttonCopy, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+       
+       
+       bSizer85->Add( 0, 0, 0, wxEXPAND, 5 );
+       
+       bSizer2->Add( bSizer85, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
+       
+       wxBoxSizer* bSizer3;
+       bSizer3 = new wxBoxSizer( wxHORIZONTAL );
+       
+       wxBoxSizer* bSizer66;
+       bSizer66 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_staticText41 = new wxStaticText( this, wxID_ANY, _("Balance:"), wxDefaultPosition, wxSize( -1,15 ), 0 );
+       m_staticText41->Wrap( -1 );
+       bSizer66->Add( m_staticText41, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
+       
+       m_staticTextBalance = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 120,15 ), wxALIGN_RIGHT|wxST_NO_AUTORESIZE );
+       m_staticTextBalance->Wrap( -1 );
+       m_staticTextBalance->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) );
+       m_staticTextBalance->SetBackgroundColour( wxColour( 255, 255, 255 ) );
+       
+       bSizer66->Add( m_staticTextBalance, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       
+       bSizer3->Add( bSizer66, 1, wxEXPAND|wxALL, 5 );
+       
+       
+       bSizer3->Add( 0, 0, 0, wxEXPAND, 5 );
+       
+       wxString m_choiceFilterChoices[] = { _(" All"), _(" Sent"), _(" Received"), _(" In Progress") };
+       int m_choiceFilterNChoices = sizeof( m_choiceFilterChoices ) / sizeof( wxString );
+       m_choiceFilter = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxSize( 110,-1 ), m_choiceFilterNChoices, m_choiceFilterChoices, 0 );
+       m_choiceFilter->SetSelection( 0 );
+       m_choiceFilter->Hide();
+       
+       bSizer3->Add( m_choiceFilter, 0, wxALIGN_BOTTOM|wxTOP|wxRIGHT|wxLEFT, 5 );
+       
+       bSizer2->Add( bSizer3, 0, wxEXPAND, 5 );
+       
+       m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
+       m_panel9 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer11;
+       bSizer11 = new wxBoxSizer( wxVERTICAL );
+       
+       m_listCtrlAll = new wxListCtrl( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
+       bSizer11->Add( m_listCtrlAll, 1, wxEXPAND, 5 );
+       
+       m_panel9->SetSizer( bSizer11 );
+       m_panel9->Layout();
+       bSizer11->Fit( m_panel9 );
+       m_notebook->AddPage( m_panel9, _("All Transactions"), true );
+       m_panel91 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer111;
+       bSizer111 = new wxBoxSizer( wxVERTICAL );
+       
+       m_listCtrlSentReceived = new wxListCtrl( m_panel91, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
+       bSizer111->Add( m_listCtrlSentReceived, 1, wxEXPAND, 5 );
+       
+       m_panel91->SetSizer( bSizer111 );
+       m_panel91->Layout();
+       bSizer111->Fit( m_panel91 );
+       m_notebook->AddPage( m_panel91, _("Sent/Received"), false );
+       m_panel92 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer112;
+       bSizer112 = new wxBoxSizer( wxVERTICAL );
+       
+       m_listCtrlSent = new wxListCtrl( m_panel92, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
+       bSizer112->Add( m_listCtrlSent, 1, wxEXPAND, 5 );
+       
+       m_panel92->SetSizer( bSizer112 );
+       m_panel92->Layout();
+       bSizer112->Fit( m_panel92 );
+       m_notebook->AddPage( m_panel92, _("Sent"), false );
+       m_panel93 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer113;
+       bSizer113 = new wxBoxSizer( wxVERTICAL );
+       
+       m_listCtrlReceived = new wxListCtrl( m_panel93, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING );
+       bSizer113->Add( m_listCtrlReceived, 1, wxEXPAND, 5 );
+       
+       m_panel93->SetSizer( bSizer113 );
+       m_panel93->Layout();
+       bSizer113->Fit( m_panel93 );
+       m_notebook->AddPage( m_panel93, _("Received"), false );
+       
+       bSizer2->Add( m_notebook, 1, wxEXPAND, 5 );
+       
+       this->SetSizer( bSizer2 );
+       this->Layout();
+       
+       // Connect Events
+       this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CMainFrameBase::OnClose ) );
+       this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( CMainFrameBase::OnIconize ) );
+       this->Connect( wxEVT_IDLE, wxIdleEventHandler( CMainFrameBase::OnIdle ) );
+       this->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_MIDDLE_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_MOTION, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_MIDDLE_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaint ) );
+       this->Connect( m_menuFileExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuFileExit ) );
 -      this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsGenerate ) );
 -      this->Disconnect( wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIOptionsGenerate ) );
+       this->Connect( m_menuOptionsChangeYourAddress->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsChangeYourAddress ) );
+       this->Connect( m_menuOptionsOptions->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsOptions ) );
+       this->Connect( m_menuHelpAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuHelpAbout ) );
+       this->Connect( wxID_BUTTONSEND, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonSend ) );
+       this->Connect( wxID_BUTTONRECEIVE, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonAddressBook ) );
+       m_textCtrlAddress->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( CMainFrameBase::OnKeyDown ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_MIDDLE_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_MOTION, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_MIDDLE_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( CMainFrameBase::OnSetFocusAddress ), NULL, this );
+       m_buttonNew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonNew ), NULL, this );
+       m_buttonCopy->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonCopy ), NULL, this );
+       m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CMainFrameBase::OnNotebookPageChanged ), NULL, this );
+       m_listCtrlAll->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlAll->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlAll->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+       m_listCtrlSentReceived->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlSentReceived->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlSentReceived->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+       m_listCtrlSent->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlSent->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlSent->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+       m_listCtrlReceived->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlReceived->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlReceived->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+ }
+ CMainFrameBase::~CMainFrameBase()
+ {
+       // Disconnect Events
+       this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CMainFrameBase::OnClose ) );
+       this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( CMainFrameBase::OnIconize ) );
+       this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( CMainFrameBase::OnIdle ) );
+       this->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_MIDDLE_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_MOTION, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_MIDDLE_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
+       this->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaint ) );
+       this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuFileExit ) );
 -      wxBoxSizer* bSizer71;
 -      bSizer71 = new wxBoxSizer( wxHORIZONTAL );
 -      
 -      m_checkBoxLimitProcessors = new wxCheckBox( m_panelMain, wxID_ANY, _("&Limit coin generation to"), wxDefaultPosition, wxDefaultSize, 0 );
 -      bSizer71->Add( m_checkBoxLimitProcessors, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
 -      
 -      m_spinCtrlLimitProcessors = new wxSpinCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 48,-1 ), wxSP_ARROW_KEYS, 1, 999, 1 );
 -      bSizer71->Add( m_spinCtrlLimitProcessors, 0, wxALIGN_CENTER_VERTICAL, 5 );
 -      
 -      m_staticText35 = new wxStaticText( m_panelMain, wxID_ANY, _("processors"), wxDefaultPosition, wxDefaultSize, 0 );
 -      m_staticText35->Wrap( -1 );
 -      bSizer71->Add( m_staticText35, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
 -      
 -      bSizer69->Add( bSizer71, 0, 0, 5 );
 -      
+       this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsChangeYourAddress ) );
+       this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsOptions ) );
+       this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuHelpAbout ) );
+       this->Disconnect( wxID_BUTTONSEND, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonSend ) );
+       this->Disconnect( wxID_BUTTONRECEIVE, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonAddressBook ) );
+       m_textCtrlAddress->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( CMainFrameBase::OnKeyDown ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_MIDDLE_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_MOTION, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_MIDDLE_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( CMainFrameBase::OnSetFocusAddress ), NULL, this );
+       m_buttonNew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonNew ), NULL, this );
+       m_buttonCopy->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonCopy ), NULL, this );
+       m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CMainFrameBase::OnNotebookPageChanged ), NULL, this );
+       m_listCtrlAll->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlAll->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlAll->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+       m_listCtrlSentReceived->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlSentReceived->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlSentReceived->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+       m_listCtrlSent->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlSent->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlSent->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+       m_listCtrlReceived->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
+       m_listCtrlReceived->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
+       m_listCtrlReceived->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
+ }
+ CTxDetailsDialogBase::CTxDetailsDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer64;
+       bSizer64 = new wxBoxSizer( wxVERTICAL );
+       
+       wxBoxSizer* bSizer66;
+       bSizer66 = new wxBoxSizer( wxVERTICAL );
+       
+       m_htmlWin = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
+       bSizer66->Add( m_htmlWin, 1, wxALL|wxEXPAND, 5 );
+       
+       bSizer64->Add( bSizer66, 1, wxEXPAND, 5 );
+       
+       wxBoxSizer* bSizer65;
+       bSizer65 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer65->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       bSizer64->Add( bSizer65, 0, wxALIGN_RIGHT, 5 );
+       
+       this->SetSizer( bSizer64 );
+       this->Layout();
+       
+       // Connect Events
+       m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CTxDetailsDialogBase::OnButtonOK ), NULL, this );
+ }
+ CTxDetailsDialogBase::~CTxDetailsDialogBase()
+ {
+       // Disconnect Events
+       m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CTxDetailsDialogBase::OnButtonOK ), NULL, this );
+ }
+ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer55;
+       bSizer55 = new wxBoxSizer( wxVERTICAL );
+       
+       wxBoxSizer* bSizer66;
+       bSizer66 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_listBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( 110,-1 ), 0, NULL, wxLB_NEEDED_SB|wxLB_SINGLE ); 
+       bSizer66->Add( m_listBox, 0, wxEXPAND|wxRIGHT, 5 );
+       
+       m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
+       m_scrolledWindow->SetScrollRate( 5, 5 );
+       wxBoxSizer* bSizer63;
+       bSizer63 = new wxBoxSizer( wxVERTICAL );
+       
+       m_panelMain = new wxPanel( m_scrolledWindow, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer69;
+       bSizer69 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer69->Add( 0, 16, 0, wxEXPAND, 5 );
+       
 -      m_checkBoxLimitProcessors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxLimitProcessors ), NULL, this );
+       m_checkBoxStartOnSystemStartup = new wxCheckBox( m_panelMain, wxID_ANY, _("&Start Bitcoin on system startup"), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_checkBoxStartOnSystemStartup, 0, wxALL, 5 );
+       
+       m_checkBoxMinimizeToTray = new wxCheckBox( m_panelMain, wxID_ANY, _("&Minimize to the tray instead of the taskbar"), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_checkBoxMinimizeToTray, 0, wxALL, 5 );
+       
+       m_checkBoxUseUPnP = new wxCheckBox( m_panelMain, wxID_ANY, _("Map port using &UPnP"), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_checkBoxUseUPnP, 0, wxALL, 5 );
+       
+       m_checkBoxMinimizeOnClose = new wxCheckBox( m_panelMain, wxID_ANY, _("M&inimize to the tray on close"), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_checkBoxMinimizeOnClose, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+       
+       wxBoxSizer* bSizer102;
+       bSizer102 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_checkBoxUseProxy = new wxCheckBox( m_panelMain, wxID_ANY, _("&Connect through socks4 proxy: "), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer102->Add( m_checkBoxUseProxy, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+       
+       bSizer69->Add( bSizer102, 1, wxEXPAND, 5 );
+       
+       wxBoxSizer* bSizer103;
+       bSizer103 = new wxBoxSizer( wxHORIZONTAL );
+       
+       
+       bSizer103->Add( 18, 0, 0, 0, 5 );
+       
+       m_staticTextProxyIP = new wxStaticText( m_panelMain, wxID_ANY, _("Proxy &IP:"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticTextProxyIP->Wrap( -1 );
+       bSizer103->Add( m_staticTextProxyIP, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+       
+       m_textCtrlProxyIP = new wxTextCtrl( m_panelMain, wxID_PROXYIP, wxEmptyString, wxDefaultPosition, wxSize( 140,-1 ), 0 );
+       m_textCtrlProxyIP->SetMaxLength( 15 ); 
+       bSizer103->Add( m_textCtrlProxyIP, 0, wxALIGN_CENTER_VERTICAL, 5 );
+       
+       m_staticTextProxyPort = new wxStaticText( m_panelMain, wxID_ANY, _(" &Port:"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticTextProxyPort->Wrap( -1 );
+       bSizer103->Add( m_staticTextProxyPort, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+       
+       m_textCtrlProxyPort = new wxTextCtrl( m_panelMain, wxID_PROXYPORT, wxEmptyString, wxDefaultPosition, wxSize( 55,-1 ), 0 );
+       m_textCtrlProxyPort->SetMaxLength( 5 ); 
+       bSizer103->Add( m_textCtrlProxyPort, 0, wxALIGN_CENTER_VERTICAL, 5 );
+       
+       bSizer69->Add( bSizer103, 1, wxEXPAND, 5 );
+       
+       
+       bSizer69->Add( 0, 1, 0, 0, 5 );
+       
+       m_staticText32 = new wxStaticText( m_panelMain, wxID_ANY, _("Optional transaction fee per KB that helps make sure your transactions are processed quickly.  Most transactions are 1KB.  Fee 0.01 recommended."), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText32->Wrap( 365 );
+       bSizer69->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
+       
+       wxBoxSizer* bSizer56;
+       bSizer56 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_staticText31 = new wxStaticText( m_panelMain, wxID_ANY, _("Pay transaction fee:"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText31->Wrap( -1 );
+       bSizer56->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
+       
+       m_textCtrlTransactionFee = new wxTextCtrl( m_panelMain, wxID_TRANSACTIONFEE, wxEmptyString, wxDefaultPosition, wxSize( 70,-1 ), 0 );
+       bSizer56->Add( m_textCtrlTransactionFee, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       
+       bSizer69->Add( bSizer56, 0, wxEXPAND, 5 );
+       
+       m_panelMain->SetSizer( bSizer69 );
+       m_panelMain->Layout();
+       bSizer69->Fit( m_panelMain );
+       bSizer63->Add( m_panelMain, 0, wxEXPAND, 5 );
+       
+       m_panelTest2 = new wxPanel( m_scrolledWindow, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer64;
+       bSizer64 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer64->Add( 0, 16, 0, wxEXPAND, 5 );
+       
+       m_staticText321 = new wxStaticText( m_panelTest2, wxID_ANY, _("// [don't translate] Test panel 2 for future expansion"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText321->Wrap( -1 );
+       bSizer64->Add( m_staticText321, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       
+       m_staticText69 = new wxStaticText( m_panelTest2, wxID_ANY, _("// [don't translate] Let's not start multiple pages until the first page is filled up"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText69->Wrap( -1 );
+       bSizer64->Add( m_staticText69, 0, wxALL, 5 );
+       
+       m_panelTest2->SetSizer( bSizer64 );
+       m_panelTest2->Layout();
+       bSizer64->Fit( m_panelTest2 );
+       bSizer63->Add( m_panelTest2, 0, wxEXPAND, 5 );
+       
+       m_scrolledWindow->SetSizer( bSizer63 );
+       m_scrolledWindow->Layout();
+       bSizer63->Fit( m_scrolledWindow );
+       bSizer66->Add( m_scrolledWindow, 1, wxEXPAND|wxLEFT, 5 );
+       
+       bSizer55->Add( bSizer66, 1, wxEXPAND|wxALL, 9 );
+       
+       wxBoxSizer* bSizer58;
+       bSizer58 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer58->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer58->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonApply = new wxButton( this, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer58->Add( m_buttonApply, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       bSizer55->Add( bSizer58, 0, wxALIGN_RIGHT, 5 );
+       
+       this->SetSizer( bSizer55 );
+       this->Layout();
+       
+       // Connect Events
+       m_listBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this );
 -      m_checkBoxLimitProcessors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxLimitProcessors ), NULL, this );
+       m_checkBoxMinimizeToTray->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxMinimizeToTray ), NULL, this );
+       m_checkBoxUseProxy->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxUseProxy ), NULL, this );
+       m_textCtrlProxyIP->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
+       m_textCtrlProxyPort->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
+       m_textCtrlTransactionFee->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
+       m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonCancel ), NULL, this );
+       m_buttonApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonApply ), NULL, this );
+ }
+ COptionsDialogBase::~COptionsDialogBase()
+ {
+       // Disconnect Events
+       m_listBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this );
+       m_checkBoxMinimizeToTray->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxMinimizeToTray ), NULL, this );
+       m_checkBoxUseProxy->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxUseProxy ), NULL, this );
+       m_textCtrlProxyIP->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
+       m_textCtrlProxyPort->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
+       m_textCtrlTransactionFee->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
+       m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonCancel ), NULL, this );
+       m_buttonApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonApply ), NULL, this );
+ }
+ CAboutDialogBase::CAboutDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer63;
+       bSizer63 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_bitmap = new wxStaticBitmap( this, wxID_ANY, wxBitmap( about_xpm ), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer63->Add( m_bitmap, 0, 0, 5 );
+       
+       wxBoxSizer* bSizer60;
+       bSizer60 = new wxBoxSizer( wxVERTICAL );
+       
+       wxBoxSizer* bSizer62;
+       bSizer62 = new wxBoxSizer( wxHORIZONTAL );
+       
+       wxBoxSizer* bSizer631;
+       bSizer631 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer631->Add( 0, 65, 0, wxEXPAND, 5 );
+       
+       wxBoxSizer* bSizer64;
+       bSizer64 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_staticText40 = new wxStaticText( this, wxID_ANY, _("Bitcoin "), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText40->Wrap( -1 );
+       m_staticText40->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) );
+       
+       bSizer64->Add( m_staticText40, 0, wxALIGN_BOTTOM|wxTOP|wxBOTTOM|wxLEFT, 5 );
+       
+       m_staticTextVersion = new wxStaticText( this, wxID_ANY, _("version"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticTextVersion->Wrap( -1 );
+       m_staticTextVersion->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
+       
+       bSizer64->Add( m_staticTextVersion, 0, wxALIGN_BOTTOM|wxTOP|wxBOTTOM|wxRIGHT, 5 );
+       
+       bSizer631->Add( bSizer64, 0, wxEXPAND, 5 );
+       
+       
+       bSizer631->Add( 0, 4, 0, wxEXPAND, 5 );
+       
+       m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2011 Bitcoin Developers\n\nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young ([email protected]) and UPnP software written by Thomas Bernard."), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticTextMain->Wrap( -1 );
+       bSizer631->Add( m_staticTextMain, 0, wxALL, 5 );
+       
+       
+       bSizer631->Add( 0, 0, 0, wxEXPAND, 5 );
+       
+       bSizer62->Add( bSizer631, 1, wxEXPAND, 5 );
+       
+       bSizer60->Add( bSizer62, 1, wxEXPAND, 5 );
+       
+       wxBoxSizer* bSizer61;
+       bSizer61 = new wxBoxSizer( wxHORIZONTAL );
+       
+       
+       bSizer61->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer61->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 6 );
+       
+       bSizer60->Add( bSizer61, 0, wxALIGN_RIGHT|wxEXPAND|wxRIGHT, 2 );
+       
+       bSizer63->Add( bSizer60, 1, wxEXPAND|wxLEFT, 5 );
+       
+       this->SetSizer( bSizer63 );
+       this->Layout();
+       
+       // Connect Events
+       m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAboutDialogBase::OnButtonOK ), NULL, this );
+ }
+ CAboutDialogBase::~CAboutDialogBase()
+ {
+       // Disconnect Events
+       m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAboutDialogBase::OnButtonOK ), NULL, this );
+ }
+ CSendDialogBase::CSendDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer21;
+       bSizer21 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer21->Add( 0, 5, 0, wxEXPAND, 5 );
+       
+       wxFlexGridSizer* fgSizer1;
+       fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
+       fgSizer1->AddGrowableCol( 1 );
+       fgSizer1->SetFlexibleDirection( wxBOTH );
+       fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+       
+       
+       fgSizer1->Add( 0, 0, 0, wxEXPAND, 5 );
+       
+       m_staticTextInstructions = new wxStaticText( this, wxID_ANY, _("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticTextInstructions->Wrap( -1 );
+       fgSizer1->Add( m_staticTextInstructions, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
+       
+       wxBoxSizer* bSizer47;
+       bSizer47 = new wxBoxSizer( wxHORIZONTAL );
+       
+       bSizer47->SetMinSize( wxSize( 70,-1 ) ); 
+       
+       bSizer47->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_bitmapCheckMark = new wxStaticBitmap( this, wxID_ANY, wxBitmap( check_xpm ), wxDefaultPosition, wxSize( 16,16 ), 0 );
+       bSizer47->Add( m_bitmapCheckMark, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+       
+       m_staticText36 = new wxStaticText( this, wxID_ANY, _("Pay &To:"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_RIGHT );
+       m_staticText36->Wrap( -1 );
+       bSizer47->Add( m_staticText36, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
+       
+       fgSizer1->Add( bSizer47, 1, wxEXPAND|wxLEFT, 5 );
+       
+       wxBoxSizer* bSizer19;
+       bSizer19 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_textCtrlAddress = new wxTextCtrl( this, wxID_TEXTCTRLPAYTO, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer19->Add( m_textCtrlAddress, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       
+       wxBoxSizer* bSizer66;
+       bSizer66 = new wxBoxSizer( wxHORIZONTAL );
+       
+       m_buttonPaste = new wxButton( this, wxID_BUTTONPASTE, _("&Paste"), wxDefaultPosition, wxSize( -1,-1 ), wxBU_EXACTFIT );
+       bSizer66->Add( m_buttonPaste, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, 5 );
+       
+       m_buttonAddress = new wxButton( this, wxID_BUTTONADDRESSBOOK, _(" Address &Book..."), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer66->Add( m_buttonAddress, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, 5 );
+       
+       bSizer19->Add( bSizer66, 0, wxALIGN_CENTER_VERTICAL, 5 );
+       
+       fgSizer1->Add( bSizer19, 1, wxEXPAND|wxRIGHT, 5 );
+       
+       m_staticText19 = new wxStaticText( this, wxID_ANY, _("&Amount:"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_RIGHT );
+       m_staticText19->Wrap( -1 );
+       fgSizer1->Add( m_staticText19, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT, 5 );
+       
+       m_textCtrlAmount = new wxTextCtrl( this, wxID_TEXTCTRLAMOUNT, wxEmptyString, wxDefaultPosition, wxSize( 145,-1 ), 0 );
+       m_textCtrlAmount->SetMaxLength( 20 ); 
+       m_textCtrlAmount->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
+       
+       fgSizer1->Add( m_textCtrlAmount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       
+       m_staticText20 = new wxStaticText( this, wxID_ANY, _("T&ransfer:"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_RIGHT );
+       m_staticText20->Wrap( -1 );
+       m_staticText20->Hide();
+       
+       fgSizer1->Add( m_staticText20, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
+       
+       wxString m_choiceTransferTypeChoices[] = { _(" Standard") };
+       int m_choiceTransferTypeNChoices = sizeof( m_choiceTransferTypeChoices ) / sizeof( wxString );
+       m_choiceTransferType = new wxChoice( this, wxID_CHOICETRANSFERTYPE, wxDefaultPosition, wxDefaultSize, m_choiceTransferTypeNChoices, m_choiceTransferTypeChoices, 0 );
+       m_choiceTransferType->SetSelection( 0 );
+       m_choiceTransferType->Hide();
+       
+       fgSizer1->Add( m_choiceTransferType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       
+       
+       fgSizer1->Add( 0, 3, 0, wxEXPAND, 5 );
+       
+       
+       fgSizer1->Add( 0, 0, 0, wxEXPAND, 5 );
+       
+       bSizer21->Add( fgSizer1, 0, wxEXPAND|wxLEFT, 5 );
+       
+       wxBoxSizer* bSizer672;
+       bSizer672 = new wxBoxSizer( wxHORIZONTAL );
+       
+       bSizer21->Add( bSizer672, 0, wxEXPAND, 5 );
+       
+       wxBoxSizer* bSizer23;
+       bSizer23 = new wxBoxSizer( wxHORIZONTAL );
+       
+       
+       bSizer23->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_buttonSend = new wxButton( this, wxID_BUTTONSEND, _("&Send"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       m_buttonSend->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
+       
+       bSizer23->Add( m_buttonSend, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer23->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       bSizer21->Add( bSizer23, 0, wxEXPAND, 5 );
+       
+       this->SetSizer( bSizer21 );
+       this->Layout();
+       
+       // Connect Events
+       m_textCtrlAddress->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( CSendDialogBase::OnKeyDown ), NULL, this );
+       m_textCtrlAddress->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( CSendDialogBase::OnTextAddress ), NULL, this );
+       m_buttonPaste->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonPaste ), NULL, this );
+       m_buttonAddress->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonAddressBook ), NULL, this );
+       m_textCtrlAmount->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( CSendDialogBase::OnKeyDown ), NULL, this );
+       m_textCtrlAmount->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( CSendDialogBase::OnKillFocusAmount ), NULL, this );
+       m_buttonSend->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonSend ), NULL, this );
+       m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CSendDialogBase::~CSendDialogBase()
+ {
+       // Disconnect Events
+       m_textCtrlAddress->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( CSendDialogBase::OnKeyDown ), NULL, this );
+       m_textCtrlAddress->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( CSendDialogBase::OnTextAddress ), NULL, this );
+       m_buttonPaste->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonPaste ), NULL, this );
+       m_buttonAddress->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonAddressBook ), NULL, this );
+       m_textCtrlAmount->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( CSendDialogBase::OnKeyDown ), NULL, this );
+       m_textCtrlAmount->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( CSendDialogBase::OnKillFocusAmount ), NULL, this );
+       m_buttonSend->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonSend ), NULL, this );
+       m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CSendingDialogBase::CSendingDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer68;
+       bSizer68 = new wxBoxSizer( wxVERTICAL );
+       
+       m_staticTextSending = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,14 ), 0 );
+       m_staticTextSending->Wrap( -1 );
+       bSizer68->Add( m_staticTextSending, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
+       
+       m_textCtrlStatus = new wxTextCtrl( this, wxID_ANY, _("\n\nConnecting..."), wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY|wxNO_BORDER );
+       m_textCtrlStatus->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
+       
+       bSizer68->Add( m_textCtrlStatus, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
+       
+       wxBoxSizer* bSizer69;
+       bSizer69 = new wxBoxSizer( wxHORIZONTAL );
+       
+       
+       bSizer69->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_buttonOK = new wxButton( this, wxID_ANY, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_buttonOK->Enable( false );
+       
+       bSizer69->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer69->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       bSizer68->Add( bSizer69, 0, wxEXPAND, 5 );
+       
+       this->SetSizer( bSizer68 );
+       this->Layout();
+       
+       // Connect Events
+       this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CSendingDialogBase::OnClose ) );
+       this->Connect( wxEVT_PAINT, wxPaintEventHandler( CSendingDialogBase::OnPaint ) );
+       m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendingDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendingDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CSendingDialogBase::~CSendingDialogBase()
+ {
+       // Disconnect Events
+       this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CSendingDialogBase::OnClose ) );
+       this->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CSendingDialogBase::OnPaint ) );
+       m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendingDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CSendingDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CYourAddressDialogBase::CYourAddressDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer68;
+       bSizer68 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer68->Add( 0, 5, 0, wxEXPAND, 5 );
+       
+       m_staticText45 = new wxStaticText( this, wxID_ANY, _("These are your Bitcoin addresses for receiving payments.  You may want to give a different one to each sender so you can keep track of who is paying you.  The highlighted address is displayed in the main window."), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText45->Wrap( 590 );
+       bSizer68->Add( m_staticText45, 0, wxALL, 5 );
+       
+       m_listCtrl = new wxListCtrl( this, wxID_LISTCTRL, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING );
+       bSizer68->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 );
+       
+       wxBoxSizer* bSizer69;
+       bSizer69 = new wxBoxSizer( wxHORIZONTAL );
+       
+       
+       bSizer69->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_buttonRename = new wxButton( this, wxID_BUTTONRENAME, _("&Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_buttonRename, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New Address... "), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer69->Add( m_buttonNew, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCopy = new wxButton( this, wxID_BUTTONCOPY, _(" &Copy to Clipboard "), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer69->Add( m_buttonCopy, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       m_buttonCancel->Hide();
+       
+       bSizer69->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       bSizer68->Add( bSizer69, 0, wxEXPAND, 5 );
+       
+       this->SetSizer( bSizer68 );
+       this->Layout();
+       
+       // Connect Events
+       this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CYourAddressDialogBase::OnClose ) );
+       m_listCtrl->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CYourAddressDialogBase::OnListEndLabelEdit ), NULL, this );
+       m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CYourAddressDialogBase::OnListItemActivated ), NULL, this );
+       m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CYourAddressDialogBase::OnListItemSelected ), NULL, this );
+       m_buttonRename->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonRename ), NULL, this );
+       m_buttonNew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonNew ), NULL, this );
+       m_buttonCopy->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonCopy ), NULL, this );
+       m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CYourAddressDialogBase::~CYourAddressDialogBase()
+ {
+       // Disconnect Events
+       this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CYourAddressDialogBase::OnClose ) );
+       m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CYourAddressDialogBase::OnListEndLabelEdit ), NULL, this );
+       m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CYourAddressDialogBase::OnListItemActivated ), NULL, this );
+       m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CYourAddressDialogBase::OnListItemSelected ), NULL, this );
+       m_buttonRename->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonRename ), NULL, this );
+       m_buttonNew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonNew ), NULL, this );
+       m_buttonCopy->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonCopy ), NULL, this );
+       m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CYourAddressDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CAddressBookDialogBase::CAddressBookDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer58;
+       bSizer58 = new wxBoxSizer( wxVERTICAL );
+       
+       m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
+       m_panelSending = new wxPanel( m_notebook, wxID_PANELSENDING, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer68;
+       bSizer68 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer68->Add( 0, 0, 0, wxEXPAND, 5 );
+       
+       m_staticText55 = new wxStaticText( m_panelSending, wxID_ANY, _("Bitcoin Address"), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText55->Wrap( -1 );
+       m_staticText55->Hide();
+       
+       bSizer68->Add( m_staticText55, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
+       
+       m_listCtrlSending = new wxListCtrl( m_panelSending, wxID_LISTCTRLSENDING, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING );
+       bSizer68->Add( m_listCtrlSending, 1, wxALL|wxEXPAND, 5 );
+       
+       m_panelSending->SetSizer( bSizer68 );
+       m_panelSending->Layout();
+       bSizer68->Fit( m_panelSending );
+       m_notebook->AddPage( m_panelSending, _("Sending"), false );
+       m_panelReceiving = new wxPanel( m_notebook, wxID_PANELRECEIVING, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+       wxBoxSizer* bSizer681;
+       bSizer681 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer681->Add( 0, 0, 0, wxEXPAND, 5 );
+       
+       m_staticText45 = new wxStaticText( m_panelReceiving, wxID_ANY, _("These are your Bitcoin addresses for receiving payments.  You can give a different one to each sender to keep track of who is paying you.  The highlighted address will be displayed in the main window."), wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticText45->Wrap( 570 );
+       bSizer681->Add( m_staticText45, 0, wxTOP|wxRIGHT|wxLEFT, 6 );
+       
+       
+       bSizer681->Add( 0, 2, 0, wxEXPAND, 5 );
+       
+       m_listCtrlReceiving = new wxListCtrl( m_panelReceiving, wxID_LISTCTRLRECEIVING, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING );
+       bSizer681->Add( m_listCtrlReceiving, 1, wxALL|wxEXPAND, 5 );
+       
+       m_panelReceiving->SetSizer( bSizer681 );
+       m_panelReceiving->Layout();
+       bSizer681->Fit( m_panelReceiving );
+       m_notebook->AddPage( m_panelReceiving, _("Receiving"), true );
+       
+       bSizer58->Add( m_notebook, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
+       
+       wxBoxSizer* bSizer69;
+       bSizer69 = new wxBoxSizer( wxHORIZONTAL );
+       
+       
+       bSizer69->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_buttonDelete = new wxButton( this, wxID_BUTTONDELETE, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_buttonDelete, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCopy = new wxButton( this, wxID_BUTTONCOPY, _(" &Copy to Clipboard "), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer69->Add( m_buttonCopy, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonEdit = new wxButton( this, wxID_BUTTONEDIT, _("&Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_buttonEdit, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New Address... "), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer69->Add( m_buttonNew, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer69->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer69->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       bSizer58->Add( bSizer69, 0, wxEXPAND, 5 );
+       
+       this->SetSizer( bSizer58 );
+       this->Layout();
+       
+       // Connect Events
+       this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) );
+       m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CAddressBookDialogBase::OnNotebookPageChanged ), NULL, this );
+       m_listCtrlSending->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
+       m_listCtrlSending->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
+       m_listCtrlSending->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
+       m_listCtrlReceiving->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
+       m_listCtrlReceiving->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
+       m_listCtrlReceiving->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
+       m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonDelete ), NULL, this );
+       m_buttonCopy->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCopy ), NULL, this );
+       m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonEdit ), NULL, this );
+       m_buttonNew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonNew ), NULL, this );
+       m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CAddressBookDialogBase::~CAddressBookDialogBase()
+ {
+       // Disconnect Events
+       this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) );
+       m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CAddressBookDialogBase::OnNotebookPageChanged ), NULL, this );
+       m_listCtrlSending->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
+       m_listCtrlSending->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
+       m_listCtrlSending->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
+       m_listCtrlReceiving->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
+       m_listCtrlReceiving->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
+       m_listCtrlReceiving->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
+       m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonDelete ), NULL, this );
+       m_buttonCopy->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCopy ), NULL, this );
+       m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonEdit ), NULL, this );
+       m_buttonNew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonNew ), NULL, this );
+       m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CGetTextFromUserDialogBase::CGetTextFromUserDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
+ {
+       this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+       
+       wxBoxSizer* bSizer79;
+       bSizer79 = new wxBoxSizer( wxVERTICAL );
+       
+       wxBoxSizer* bSizer81;
+       bSizer81 = new wxBoxSizer( wxVERTICAL );
+       
+       
+       bSizer81->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_staticTextMessage1 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticTextMessage1->Wrap( -1 );
+       bSizer81->Add( m_staticTextMessage1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
+       
+       m_textCtrl1 = new wxTextCtrl( this, wxID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
+       bSizer81->Add( m_textCtrl1, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
+       
+       m_staticTextMessage2 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+       m_staticTextMessage2->Wrap( -1 );
+       m_staticTextMessage2->Hide();
+       
+       bSizer81->Add( m_staticTextMessage2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
+       
+       m_textCtrl2 = new wxTextCtrl( this, wxID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
+       m_textCtrl2->Hide();
+       
+       bSizer81->Add( m_textCtrl2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
+       
+       
+       bSizer81->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       bSizer79->Add( bSizer81, 1, wxEXPAND|wxALL, 10 );
+       
+       wxBoxSizer* bSizer80;
+       bSizer80 = new wxBoxSizer( wxHORIZONTAL );
+       
+       
+       bSizer80->Add( 0, 0, 1, wxEXPAND, 5 );
+       
+       m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
+       bSizer80->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
+       bSizer80->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+       
+       bSizer79->Add( bSizer80, 0, wxEXPAND, 5 );
+       
+       this->SetSizer( bSizer79 );
+       this->Layout();
+       
+       // Connect Events
+       this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CGetTextFromUserDialogBase::OnClose ) );
+       m_textCtrl1->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( CGetTextFromUserDialogBase::OnKeyDown ), NULL, this );
+       m_textCtrl2->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( CGetTextFromUserDialogBase::OnKeyDown ), NULL, this );
+       m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CGetTextFromUserDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CGetTextFromUserDialogBase::OnButtonCancel ), NULL, this );
+ }
+ CGetTextFromUserDialogBase::~CGetTextFromUserDialogBase()
+ {
+       // Disconnect Events
+       this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CGetTextFromUserDialogBase::OnClose ) );
+       m_textCtrl1->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( CGetTextFromUserDialogBase::OnKeyDown ), NULL, this );
+       m_textCtrl2->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( CGetTextFromUserDialogBase::OnKeyDown ), NULL, this );
+       m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CGetTextFromUserDialogBase::OnButtonOK ), NULL, this );
+       m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CGetTextFromUserDialogBase::OnButtonCancel ), NULL, this );
+ }
diff --cc src/uibase.h
index 0000000000000000000000000000000000000000,c5da8f50816b632dd2c12476658d33250501fd04..78f3d1b385cd685e9562c1eb4400ea8ca2bb56ee
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,429 +1,421 @@@
 -#include <wx/spinctrl.h>
+ ///////////////////////////////////////////////////////////////////////////
+ // C++ code generated with wxFormBuilder (version Dec 21 2009)
+ // http://www.wxformbuilder.org/
+ //
+ // PLEASE DO "NOT" EDIT THIS FILE!
+ ///////////////////////////////////////////////////////////////////////////
+ #ifndef __uibase__
+ #define __uibase__
+ #include <wx/intl.h>
+ #include <wx/string.h>
+ #include <wx/bitmap.h>
+ #include <wx/image.h>
+ #include <wx/icon.h>
+ #include <wx/menu.h>
+ #include <wx/gdicmn.h>
+ #include <wx/font.h>
+ #include <wx/colour.h>
+ #include <wx/settings.h>
+ #include <wx/toolbar.h>
+ #include <wx/statusbr.h>
+ #include <wx/stattext.h>
+ #include <wx/textctrl.h>
+ #include <wx/button.h>
+ #include <wx/sizer.h>
+ #include <wx/choice.h>
+ #include <wx/listctrl.h>
+ #include <wx/panel.h>
+ #include <wx/notebook.h>
+ #include <wx/frame.h>
+ #include <wx/html/htmlwin.h>
+ #include <wx/dialog.h>
+ #include <wx/listbox.h>
+ #include <wx/checkbox.h>
 -#define wxID_OPTIONSGENERATEBITCOINS 1001
 -#define wxID_BUTTONSEND 1002
 -#define wxID_BUTTONRECEIVE 1003
 -#define wxID_TEXTCTRLADDRESS 1004
 -#define wxID_BUTTONNEW 1005
 -#define wxID_BUTTONCOPY 1006
 -#define wxID_PROXYIP 1007
 -#define wxID_PROXYPORT 1008
 -#define wxID_TRANSACTIONFEE 1009
 -#define wxID_TEXTCTRLPAYTO 1010
 -#define wxID_BUTTONPASTE 1011
 -#define wxID_BUTTONADDRESSBOOK 1012
 -#define wxID_TEXTCTRLAMOUNT 1013
 -#define wxID_CHOICETRANSFERTYPE 1014
 -#define wxID_LISTCTRL 1015
 -#define wxID_BUTTONRENAME 1016
 -#define wxID_PANELSENDING 1017
 -#define wxID_LISTCTRLSENDING 1018
 -#define wxID_PANELRECEIVING 1019
 -#define wxID_LISTCTRLRECEIVING 1020
 -#define wxID_BUTTONDELETE 1021
 -#define wxID_BUTTONEDIT 1022
 -#define wxID_TEXTCTRL 1023
+ #include <wx/scrolwin.h>
+ #include <wx/statbmp.h>
+ ///////////////////////////////////////////////////////////////////////////
+ #define wxID_MAINFRAME 1000
 -              virtual void OnMenuOptionsGenerate( wxCommandEvent& event ) { event.Skip(); }
 -              virtual void OnUpdateUIOptionsGenerate( wxUpdateUIEvent& event ) { event.Skip(); }
++#define wxID_BUTTONSEND 1001
++#define wxID_BUTTONRECEIVE 1002
++#define wxID_TEXTCTRLADDRESS 1003
++#define wxID_BUTTONNEW 1004
++#define wxID_BUTTONCOPY 1005
++#define wxID_PROXYIP 1006
++#define wxID_PROXYPORT 1007
++#define wxID_TRANSACTIONFEE 1008
++#define wxID_TEXTCTRLPAYTO 1009
++#define wxID_BUTTONPASTE 1010
++#define wxID_BUTTONADDRESSBOOK 1011
++#define wxID_TEXTCTRLAMOUNT 1012
++#define wxID_CHOICETRANSFERTYPE 1013
++#define wxID_LISTCTRL 1014
++#define wxID_BUTTONRENAME 1015
++#define wxID_PANELSENDING 1016
++#define wxID_LISTCTRLSENDING 1017
++#define wxID_PANELRECEIVING 1018
++#define wxID_LISTCTRLRECEIVING 1019
++#define wxID_BUTTONDELETE 1020
++#define wxID_BUTTONEDIT 1021
++#define wxID_TEXTCTRL 1022
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CMainFrameBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CMainFrameBase : public wxFrame 
+ {
+       private:
+       
+       protected:
+               wxMenuBar* m_menubar;
+               wxMenu* m_menuFile;
+               wxMenu* m_menuHelp;
+               wxToolBar* m_toolBar;
+               
+               wxStaticText* m_staticText32;
+               wxButton* m_buttonNew;
+               wxButton* m_buttonCopy;
+               
+               wxStaticText* m_staticText41;
+               wxStaticText* m_staticTextBalance;
+               
+               wxChoice* m_choiceFilter;
+               wxNotebook* m_notebook;
+               wxPanel* m_panel9;
+               wxPanel* m_panel91;
+               wxPanel* m_panel92;
+               wxPanel* m_panel93;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
+               virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
+               virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
+               virtual void OnMouseEvents( wxMouseEvent& event ) { event.Skip(); }
+               virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
+               virtual void OnMenuFileExit( wxCommandEvent& event ) { event.Skip(); }
 -              wxCheckBox* m_checkBoxLimitProcessors;
 -              wxSpinCtrl* m_spinCtrlLimitProcessors;
 -              wxStaticText* m_staticText35;
+               virtual void OnMenuOptionsChangeYourAddress( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnMenuOptionsOptions( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnMenuHelpAbout( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonSend( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonAddressBook( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnKeyDown( wxKeyEvent& event ) { event.Skip(); }
+               virtual void OnMouseEventsAddress( wxMouseEvent& event ) { event.Skip(); }
+               virtual void OnSetFocusAddress( wxFocusEvent& event ) { event.Skip(); }
+               virtual void OnButtonNew( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCopy( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnNotebookPageChanged( wxNotebookEvent& event ) { event.Skip(); }
+               virtual void OnListColBeginDrag( wxListEvent& event ) { event.Skip(); }
+               virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
+               virtual void OnPaintListCtrl( wxPaintEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               wxMenu* m_menuOptions;
+               wxStatusBar* m_statusBar;
+               wxTextCtrl* m_textCtrlAddress;
+               wxListCtrl* m_listCtrlAll;
+               wxListCtrl* m_listCtrlSentReceived;
+               wxListCtrl* m_listCtrlSent;
+               wxListCtrl* m_listCtrlReceived;
+               
+               CMainFrameBase( wxWindow* parent, wxWindowID id = wxID_MAINFRAME, const wxString& title = _("Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 723,484 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
+               ~CMainFrameBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CTxDetailsDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CTxDetailsDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               wxHtmlWindow* m_htmlWin;
+               wxButton* m_buttonOK;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               
+               CTxDetailsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Transaction Details"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 620,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+               ~CTxDetailsDialogBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class COptionsDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class COptionsDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               wxListBox* m_listBox;
+               wxScrolledWindow* m_scrolledWindow;
+               wxPanel* m_panelMain;
+               
 -              virtual void OnCheckBoxLimitProcessors( wxCommandEvent& event ) { event.Skip(); }
+               wxCheckBox* m_checkBoxStartOnSystemStartup;
+               wxCheckBox* m_checkBoxMinimizeToTray;
+               wxCheckBox* m_checkBoxUseUPnP;
+               wxCheckBox* m_checkBoxMinimizeOnClose;
+               wxCheckBox* m_checkBoxUseProxy;
+               
+               wxStaticText* m_staticTextProxyIP;
+               wxTextCtrl* m_textCtrlProxyIP;
+               wxStaticText* m_staticTextProxyPort;
+               wxTextCtrl* m_textCtrlProxyPort;
+               
+               wxStaticText* m_staticText32;
+               wxStaticText* m_staticText31;
+               wxTextCtrl* m_textCtrlTransactionFee;
+               wxPanel* m_panelTest2;
+               
+               wxStaticText* m_staticText321;
+               wxStaticText* m_staticText69;
+               wxButton* m_buttonOK;
+               wxButton* m_buttonCancel;
+               wxButton* m_buttonApply;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnListBox( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnCheckBoxMinimizeToTray( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnCheckBoxUseProxy( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnKillFocusProxy( wxFocusEvent& event ) { event.Skip(); }
+               virtual void OnKillFocusTransactionFee( wxFocusEvent& event ) { event.Skip(); }
+               virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonApply( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               
+               COptionsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 540,360 ), long style = wxDEFAULT_DIALOG_STYLE );
+               ~COptionsDialogBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CAboutDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CAboutDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               wxStaticBitmap* m_bitmap;
+               
+               wxStaticText* m_staticText40;
+               
+               wxStaticText* m_staticTextMain;
+               
+               
+               wxButton* m_buttonOK;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               wxStaticText* m_staticTextVersion;
+               
+               CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,333 ), long style = wxDEFAULT_DIALOG_STYLE );
+               ~CAboutDialogBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CSendDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CSendDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               
+               
+               wxStaticText* m_staticTextInstructions;
+               
+               wxStaticBitmap* m_bitmapCheckMark;
+               wxStaticText* m_staticText36;
+               wxTextCtrl* m_textCtrlAddress;
+               wxButton* m_buttonPaste;
+               wxButton* m_buttonAddress;
+               wxStaticText* m_staticText19;
+               wxTextCtrl* m_textCtrlAmount;
+               wxStaticText* m_staticText20;
+               wxChoice* m_choiceTransferType;
+               
+               
+               
+               wxButton* m_buttonSend;
+               wxButton* m_buttonCancel;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnKeyDown( wxKeyEvent& event ) { event.Skip(); }
+               virtual void OnTextAddress( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonPaste( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonAddressBook( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnKillFocusAmount( wxFocusEvent& event ) { event.Skip(); }
+               virtual void OnButtonSend( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               
+               CSendDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Send Coins"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 498,157 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+               ~CSendDialogBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CSendingDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CSendingDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               wxStaticText* m_staticTextSending;
+               wxTextCtrl* m_textCtrlStatus;
+               
+               wxButton* m_buttonOK;
+               wxButton* m_buttonCancel;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
+               virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
+               virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               
+               CSendingDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sending..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 442,151 ), long style = wxDEFAULT_DIALOG_STYLE );
+               ~CSendingDialogBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CYourAddressDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CYourAddressDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               
+               wxStaticText* m_staticText45;
+               wxListCtrl* m_listCtrl;
+               
+               wxButton* m_buttonRename;
+               wxButton* m_buttonNew;
+               wxButton* m_buttonCopy;
+               wxButton* m_buttonOK;
+               wxButton* m_buttonCancel;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
+               virtual void OnListEndLabelEdit( wxListEvent& event ) { event.Skip(); }
+               virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
+               virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
+               virtual void OnButtonRename( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonNew( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCopy( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               
+               CYourAddressDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Your Bitcoin Addresses"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+               ~CYourAddressDialogBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CAddressBookDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CAddressBookDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               wxNotebook* m_notebook;
+               wxPanel* m_panelSending;
+               
+               wxStaticText* m_staticText55;
+               wxListCtrl* m_listCtrlSending;
+               wxPanel* m_panelReceiving;
+               
+               wxStaticText* m_staticText45;
+               
+               wxListCtrl* m_listCtrlReceiving;
+               
+               wxButton* m_buttonDelete;
+               wxButton* m_buttonCopy;
+               wxButton* m_buttonEdit;
+               wxButton* m_buttonNew;
+               wxButton* m_buttonOK;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
+               virtual void OnNotebookPageChanged( wxNotebookEvent& event ) { event.Skip(); }
+               virtual void OnListEndLabelEdit( wxListEvent& event ) { event.Skip(); }
+               virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
+               virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
+               virtual void OnButtonDelete( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCopy( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonEdit( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonNew( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               wxButton* m_buttonCancel;
+               
+               CAddressBookDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Address Book"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+               ~CAddressBookDialogBase();
+       
+ };
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Class CGetTextFromUserDialogBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class CGetTextFromUserDialogBase : public wxDialog 
+ {
+       private:
+       
+       protected:
+               
+               wxStaticText* m_staticTextMessage1;
+               wxTextCtrl* m_textCtrl1;
+               wxStaticText* m_staticTextMessage2;
+               wxTextCtrl* m_textCtrl2;
+               
+               
+               wxButton* m_buttonOK;
+               wxButton* m_buttonCancel;
+               
+               // Virtual event handlers, overide them in your derived class
+               virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
+               virtual void OnKeyDown( wxKeyEvent& event ) { event.Skip(); }
+               virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
+               virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
+               
+       
+       public:
+               
+               CGetTextFromUserDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 440,138 ), long style = wxDEFAULT_DIALOG_STYLE );
+               ~CGetTextFromUserDialogBase();
+       
+ };
+ #endif //__uibase__
This page took 0.653528 seconds and 4 git commands to generate.