diff --git a/config_me.sh b/config_me.sh
new file mode 100644
index 0000000..19e9a1b
--- /dev/null
+++ b/config_me.sh
@@ -0,0 +1 @@
+./configure --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc --without-bdb --enable-debug --disable-wallet --without-utils
diff --git a/configure.ac b/configure.ac
index 5debd21..3bfc59e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,12 @@ AC_ARG_ENABLE([reduce-exports],
   [use_reduce_exports=$enableval],
   [use_reduce_exports=no])

+AC_ARG_ENABLE([daemonlib],
+  [AS_HELP_STRING([--enable-daemonlib],
+  [compile all of bitcoind as a library (default is no)])],
+  [use_daemonlib=$enableval],
+  [use_daemonlib=no])
+
 AC_ARG_ENABLE([ccache],
   [AS_HELP_STRING([--enable-ccache],
   [use ccache for building (default is yes if ccache is found)])],
@@ -402,6 +408,9 @@ fi
 if test x$use_hardening != xno; then
   AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
   AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
+  if test x$use_daemonlib = xno; then
+    AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"])
+  fi

   AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[
     AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[
@@ -415,7 +424,7 @@ if test x$use_hardening != xno; then
   AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"])
   AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"])

-  if test x$TARGET_OS != xwindows; then
+  if test x$TARGET_OS != xwindows -a x$use_daemonlib = xno; then
     # All windows code is PIC, forcing it on just adds useless compile warnings
     AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"])
     AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"])
@@ -433,6 +442,17 @@ if test x$use_hardening != xno; then
   OBJCXXFLAGS="$CXXFLAGS"
 fi

+AC_DEFINE([ENABLE_DAEMONLIB],[0],[Enable daemonlib.])
+AM_CONDITIONAL([ENABLE_DAEMONLIB],[false])
+if test x$use_daemonlib != xno; then
+  AX_CHECK_COMPILE_FLAG([-fPIC],[DAEMONLIB_CXXFLAGS="$DAEMONLIB_CXXFLAGS -fPIC"])
+  AC_DEFINE([ENABLE_DAEMONLIB],[1],[Enable daemonlib.])
+  AM_CONDITIONAL([ENABLE_DAEMONLIB],[true])
+  CXXFLAGS="$CXXFLAGS $DAEMONLIB_CXXFLAGS"
+  CPPFLAGS="$CPPFLAGS $DAEMONLIB_CPPFLAGS"
+  OBJCXXFLAGS="$CXXFLAGS"
+fi
+
 dnl this flag screws up non-darwin gcc even when the check fails. special-case it.
 if test x$TARGET_OS = xdarwin; then
   AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"])
@@ -483,11 +503,18 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
   ]
 )

-if test x$use_reduce_exports = xyes; then
+if test x$use_reduce_exports = xyes -a x$use_daemonlib = xno; then
   AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"],
   [AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduce-exports.])])
 fi

+AC_MSG_CHECKING([whether to compile as daemonlib])
+if test x$use_daemonlib != xno; then
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
+fi
+
 LEVELDB_CPPFLAGS=
 LIBLEVELDB=
 LIBMEMENV=
diff --git a/depends/hosts/linux.mk b/depends/hosts/linux.mk
index b13a0f1..0513394 100644
--- a/depends/hosts/linux.mk
+++ b/depends/hosts/linux.mk
@@ -10,15 +10,15 @@ linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)
 linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

 ifeq (86,$(findstring 86,$(build_arch)))
-i686_linux_CC=gcc -m32
-i686_linux_CXX=g++ -m32
+i686_linux_CC=${CC} -m32
+i686_linux_CXX=${CXX} -m32
 i686_linux_AR=ar
 i686_linux_RANLIB=ranlib
 i686_linux_NM=nm
 i686_linux_STRIP=strip

-x86_64_linux_CC=gcc -m64
-x86_64_linux_CXX=g++ -m64
+x86_64_linux_CC=${CC} -m64
+x86_64_linux_CXX=${CXX} -m64
 x86_64_linux_AR=ar
 x86_64_linux_RANLIB=ranlib
 x86_64_linux_NM=nm
diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk
index 68841af..65a105b 100644
--- a/depends/packages/bdb.mk
+++ b/depends/packages/bdb.mk
@@ -9,6 +9,7 @@ define $(package)_set_vars
 $(package)_config_opts=--disable-shared --enable-cxx --disable-replication
 $(package)_config_opts_mingw32=--enable-mingw
 $(package)_config_opts_linux=--with-pic
+$(package)_cxxflags_darwin=-stdlib=libc++
 endef

 define $(package)_preprocess_cmds
diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk
index e7aa48d..df0f7ae 100644
--- a/depends/packages/boost.mk
+++ b/depends/packages/boost.mk
@@ -1,9 +1,8 @@
 package=boost
-$(package)_version=1_55_0
-$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.55.0
+$(package)_version=1_57_0
+$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.57.0
 $(package)_file_name=$(package)_$($(package)_version).tar.bz2
-$(package)_sha256_hash=fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52
-$(package)_patches=darwin_boost_atomic-1.patch darwin_boost_atomic-2.patch gcc_5_no_cxx11.patch
+$(package)_sha256_hash=910c8c022a33ccec7f088bd65d4f14b466588dda94ba2124e78b8c57db264967

 define $(package)_set_vars
 $(package)_config_opts_release=variant=release
@@ -11,7 +10,7 @@ $(package)_config_opts_debug=variant=debug
 $(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
 $(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
 $(package)_config_opts_linux=threadapi=pthread runtime-link=shared
-$(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared
+$(package)_config_opts_darwin=--toolset=clang runtime-link=shared
 $(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
 $(package)_config_opts_x86_64_mingw32=address-model=64
 $(package)_config_opts_i686_mingw32=address-model=32
@@ -20,15 +19,14 @@ $(package)_toolset_$(host_os)=gcc
 $(package)_archiver_$(host_os)=$($(package)_ar)
 $(package)_toolset_darwin=darwin
 $(package)_archiver_darwin=$($(package)_libtool)
-$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test
-$(package)_cxxflags=-fvisibility=hidden
-$(package)_cxxflags_linux=-fPIC
+$(package)_config_libraries=chrono,filesystem,program_options,system,thread
+$(package)_cxxflags=-fvisibility=default -fPIC
+$(package)_cxxflags_darwin=-std=c++11 -stdlib=libc++
+$(package)_linkflags=-stdlib=libc++
 endef

+
 define $(package)_preprocess_cmds
-  patch -p2 < $($(package)_patch_dir)/darwin_boost_atomic-1.patch && \
-  patch -p2 < $($(package)_patch_dir)/darwin_boost_atomic-2.patch && \
-  patch -p2 < $($(package)_patch_dir)/gcc_5_no_cxx11.patch && \
   echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STRIP)\"  <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
 endef

diff --git a/src/Makefile.am b/src/Makefile.am
index 2461f82..e7e9ecf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,10 @@
 DIST_SUBDIRS = secp256k1
 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)

+noinst_LTLIBRARIES =
+libbitcoind_la_LIBADD =
+libbitcoind_la_LDFLAGS = -no-undefined
+STATIC_EXTRA_LIBS = $(LIBLEVELDB) $(LIBMEMENV)

 if EMBEDDED_LEVELDB
 LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
@@ -49,16 +53,16 @@ BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
 EXTRA_LIBRARIES += libbitcoin_wallet.a
 endif

-if BUILD_BITCOIN_LIBS
-lib_LTLIBRARIES = libbitcoinconsensus.la
-LIBBITCOIN_CONSENSUS=libbitcoinconsensus.la
-else
-LIBBITCOIN_CONSENSUS=
-endif
-
+LIBBITCOIN_CONSENSUS =
 bin_PROGRAMS =
 TESTS =

+if BUILD_BITCOIN_LIBS
+noinst_LTLIBRARIES += libbitcoinconsensus.la
+LIBBITCOIN_CONSENSUS += libbitcoinconsensus.la
+endif
+
+if !ENABLE_DAEMONLIB
 if BUILD_BITCOIND
   bin_PROGRAMS += bitcoind
 endif
@@ -66,6 +70,9 @@ endif
 if BUILD_BITCOIN_UTILS
   bin_PROGRAMS += bitcoin-cli bitcoin-tx
 endif
+else
+noinst_LTLIBRARIES += libbitcoind.la
+endif

 .PHONY: FORCE
 # bitcoin core #
@@ -170,8 +177,11 @@ obj/build.h: FORCE
 	@$(MKDIR_P) $(builddir)/obj
 	@$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
 	  $(abs_top_srcdir)
-libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h

+ARCH_PLATFORM = $(shell ../../bin/variables.sh host)
+
+libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
+clientversion.cpp: obj/build.h
 # server: shared between bitcoind and bitcoin-qt
 libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
 libbitcoin_server_a_SOURCES = \
@@ -310,9 +320,18 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
 bitcoind_SOURCES = bitcoind.cpp
 bitcoind_CPPFLAGS = $(BITCOIN_INCLUDES)
 bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
+libbitcoind_la_SOURCES = bitcoind.cpp
+libbitcoind_la_SOURCES += $(libbitcoin_util_a_SOURCES)
+libbitcoind_la_SOURCES += $(libbitcoin_univalue_a_SOURCES)
+libbitcoind_la_SOURCES += $(libbitcoin_crypto_a_SOURCES)
+libbitcoind_la_SOURCES += $(libbitcoin_common_a_SOURCES)
+libbitcoind_la_SOURCES += $(libbitcoin_server_a_SOURCES)
+libbitcoind_la_SOURCES += $(crypto_libbitcoin_crypto_a_SOURCES)
+libbitcoind_la_SOURCES += $(univalue_libbitcoin_univalue_a_SOURCES)

 if TARGET_WINDOWS
 bitcoind_SOURCES += bitcoind-res.rc
+libbitcoind_la_SOURCES += bitcoind-res.rc
 endif

 bitcoind_LDADD = \
@@ -327,10 +346,17 @@ bitcoind_LDADD = \

 if ENABLE_WALLET
 bitcoind_LDADD += libbitcoin_wallet.a
+libbitcoind_la_SOURCES += $(libbitcoin_wallet_a_SOURCES)
 endif

 bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS)
-#
+libbitcoind_la_LIBADD += $(SSL_LIBS) $(LIBSECP256K1) $(CRYPTO_LIBS) $(STATIC_EXTRA_LIBS)
+libbitcoind_la_CPPFLAGS = $(BITCOIN_INCLUDES)
+if TARGET_DARWIN
+libbitcoind_la_LDFLAGS += -Wl,-all_load
+else
+libbitcoind_la_LDFLAGS += -Wl,--whole-archive $(STATIC_EXTRA_LIBS) -Wl,--no-whole-archive
+endif

 # bitcoin-cli binary #
 bitcoin_cli_SOURCES = bitcoin-cli.cpp
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index 6e2758a..0352a9d 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -33,6 +33,10 @@

 static bool fDaemon;

+#if ENABLE_DAEMONLIB
+extern void WaitForShutdown(boost::thread_group* threadGroup);
+#endif
+
 void WaitForShutdown(boost::thread_group* threadGroup)
 {
     bool fShutdown = ShutdownRequested();
@@ -166,6 +170,7 @@ bool AppInit(int argc, char* argv[])
     return fRet;
 }

+#if !ENABLE_DAEMONLIB
 int main(int argc, char* argv[])
 {
     SetupEnvironment();
@@ -175,3 +180,4 @@ int main(int argc, char* argv[])

     return (AppInit(argc, argv) ? 0 : 1);
 }
+#endif
diff --git a/src/init.cpp b/src/init.cpp
index a04e4e0..33d0bc7 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -638,21 +638,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
         umask(077);
     }

-    // 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);
-
-    // Reopen debug.log on SIGHUP
-    struct sigaction sa_hup;
-    sa_hup.sa_handler = HandleSIGHUP;
-    sigemptyset(&sa_hup.sa_mask);
-    sa_hup.sa_flags = 0;
-    sigaction(SIGHUP, &sa_hup, NULL);
-
 #if defined (__SVR4) && defined (__sun)
     // ignore SIGPIPE on Solaris
     signal(SIGPIPE, SIG_IGN);
diff --git a/src/init.h b/src/init.h
index dcb2b29..5ce68ba 100644
--- a/src/init.h
+++ b/src/init.h
@@ -18,6 +18,11 @@ class thread_group;

 extern CWallet* pwalletMain;

+#if ENABLE_DAEMONLIB
+#include <boost/filesystem/path.hpp>
+#include <boost/thread/mutex.hpp>
+#endif
+
 void StartShutdown();
 bool ShutdownRequested();
 void Shutdown();
diff --git a/src/main.cpp b/src/main.cpp
index fe072ec..9f677cf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1105,6 +1105,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa

         // Store transaction in memory
         pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
+        GetNodeSignals().TxToMemPool(tx);
     }

     SyncWithWallets(tx, NULL);
diff --git a/src/net.cpp b/src/net.cpp
index e4b22f9..33fe6f9 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -432,8 +432,10 @@ void CNode::PushVersion()
         LogPrint("net", "send version message: version %d, blocks=%d, us=%s, them=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), addrYou.ToString(), id);
     else
         LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
+    std::vector<std::string> bitcore;
+    bitcore.push_back("bitcore"); //the dash character is removed from the comments section
     PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
-                nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight, true);
+                nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, bitcore), nBestHeight, true);
 }


diff --git a/src/net.h b/src/net.h
index 17502b9..c9ae1b2 100644
--- a/src/net.h
+++ b/src/net.h
@@ -99,6 +99,8 @@ struct CNodeSignals
 {
     boost::signals2::signal<int ()> GetHeight;
     boost::signals2::signal<bool (CNode*), CombinerAll> ProcessMessages;
+    boost::signals2::signal<bool (const CTransaction&)> TxToMemPool;
+    boost::signals2::signal<bool (const CTransaction&)> TxLeaveMemPool;
     boost::signals2::signal<bool (CNode*, bool), CombinerAll> SendMessages;
     boost::signals2::signal<void (NodeId, const CNode*)> InitializeNode;
     boost::signals2::signal<void (NodeId)> FinalizeNode;
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index c3d1b60..03e265d 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -133,6 +133,7 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem
             if (!mapTx.count(hash))
                 continue;
             const CTransaction& tx = mapTx[hash].GetTx();
+            GetNodeSignals().TxLeaveMemPool(tx);
             if (fRecursive) {
                 for (unsigned int i = 0; i < tx.vout.size(); i++) {
                     std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i));
