Skip to content

Commit

Permalink
Netbox.Wallet v3.3.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
NetboxGlobal-Team committed Dec 26, 2019
1 parent a2abe6e commit ee2f0e8
Show file tree
Hide file tree
Showing 42 changed files with 1,673 additions and 83 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Dockerfile*
Makefile_docker
.dockerignore
docker-compose.yml
/output
.gitignore
.gitattributes
.gitlab-ci.yml
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ set(SERVER_SOURCES
./src/pow.cpp
./src/rest.cpp
./src/rpc/blockchain.cpp
./src/rpc/dappstore.cpp
./src/rpc/masternode.cpp
./src/rpc/budget.cpp
./src/rpc/mining.cpp
Expand Down Expand Up @@ -339,6 +340,9 @@ endif()
set(WALLET_SOURCES
./src/activemasternode.cpp
./src/bip38.cpp
./src/dappstore/dapp.cpp
./src/dappstore/dappstore.cpp
./src/dappstore/dappstoredb.cpp
./src/denomination_functions.cpp
./src/obfuscation.cpp
./src/obfuscation-relay.cpp
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile_osx
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ RUN CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site ./configure
RUN make -j$(nproc)

RUN $PWD/depends/x86_64-apple-darwin11/native/bin/x86_64-apple-darwin11-strip $PWD/src/qt/netboxwallet $PWD/src/nbxd $PWD/src/nbx-cli $PWD/src/nbx-tx

ENTRYPOINT ["/bin/bash", "-c", "cp /netboxwallet/src/{qt/netboxwallet,nbxd,nbx-cli,nbx-tx} /netboxwallet/output/mac64/"]
2 changes: 2 additions & 0 deletions Dockerfile_static
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ RUN CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure
RUN make -j$(nproc)

RUN strip $PWD/src/qt/netboxwallet $PWD/src/nbxd $PWD/src/nbx-cli $PWD/src/nbx-tx

ENTRYPOINT ["/bin/bash", "-c", "cp /netboxwallet/src/{qt/netboxwallet,nbxd,nbx-cli,nbx-tx} /netboxwallet/output/lin64/"]
2 changes: 2 additions & 0 deletions Dockerfile_windows
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ RUN make -j$(nproc)
#RUN make install

RUN strip $PWD/src/qt/netboxwallet.exe $PWD/src/nbxd.exe $PWD/src/nbx-cli.exe $PWD/src/nbx-tx.exe

ENTRYPOINT ["/bin/bash", "-c", "cp /netboxwallet/src/{qt/netboxwallet.exe,nbxd.exe,nbx-cli.exe,nbx-tx.exe} /netboxwallet/output/win32/"]
2 changes: 2 additions & 0 deletions Dockerfile_windows_x64
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ RUN make -j$(nproc)
#RUN make install

RUN strip $PWD/src/qt/netboxwallet.exe $PWD/src/nbxd.exe $PWD/src/nbx-cli.exe $PWD/src/nbx-tx.exe

ENTRYPOINT ["/bin/bash", "-c", "cp /netboxwallet/src/{qt/netboxwallet.exe,nbxd.exe,nbx-cli.exe,nbx-tx.exe} /netboxwallet/output/win64/"]
8 changes: 4 additions & 4 deletions Makefile_docker
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ build_windows:
docker build -f Dockerfile_windows --compress --force-rm --pull -t "${APP}-windows:${TAG}" .

run_windows:
docker run --rm -it --name "${APP}-windows" "${APP}-windows:${TAG}"
docker run --rm -v "$(shell pwd)/output/win32:/netboxwallet/output/win32" "${APP}-windows:${TAG}"

build_windows_x64:
docker build -f Dockerfile_windows_x64 --compress --force-rm --pull -t "${APP}-windows-x64:${TAG}" .

run_windows_x64:
docker run --rm -it --name "${APP}-windows-x64" "${APP}-windows-x64:${TAG}"
docker run --rm -v "$(shell pwd)/output/win64:/netboxwallet/output/win64" "${APP}-windows-x64:${TAG}"

build_static:
docker build -f Dockerfile_static --compress --force-rm --pull -t "${APP}-static:${TAG}" .

run_static:
docker run --rm -it --name "${APP}-static" "${APP}-static:${TAG}"
docker run --rm -v "$(shell pwd)/output/lin64:/netboxwallet/output/lin64" "${APP}-static:${TAG}"

build_osx:
docker build -f Dockerfile_osx --compress --force-rm --pull -t "${APP}-osx:${TAG}" .

run_osx:
docker run --rm -it --name "${APP}-osx" "${APP}-osx:${TAG}"
docker run --rm -v "$(shell pwd)/output/mac64:/netboxwallet/output/mac64" "${APP}-osx:${TAG}"
10 changes: 7 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 3)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 8)
define(_CLIENT_VERSION_BUILD, 10)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
AC_INIT([Netbox.Global],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[netbox.global],[nbx])
Expand Down Expand Up @@ -1017,8 +1017,9 @@ if test x$use_pkgconfig = xyes; then
m4_ifdef(
[PKG_CHECK_MODULES],
[
PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)])
PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)])
PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)])
PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)])
PKG_CHECK_MODULES([ZLIB], [zlib],,[AC_MSG_ERROR(libz not found.)])
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])])
if test x$use_qr != xno; then
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
Expand Down Expand Up @@ -1048,6 +1049,9 @@ else
AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),)
AC_CHECK_LIB([ssl], [main],SSL_LIBS=-lssl, AC_MSG_ERROR(libssl missing))

AC_CHECK_HEADER([zlib.h],, AC_MSG_ERROR(libz headers missing),)
AC_CHECK_LIB([z], [main],ZLIB_LIBS=-lz, AC_MSG_ERROR(libz missing))

if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests != xnononono; then
AC_CHECK_HEADER([event2/event.h],, AC_MSG_ERROR(libevent headers missing),)
AC_CHECK_LIB([event],[main],EVENT_LIBS=-levent,AC_MSG_ERROR(libevent missing))
Expand Down
6 changes: 6 additions & 0 deletions contrib/nbx-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ HEADERS += src/activemasternode.h \
src/obfuscation.h \
src/nbx-config.h \
src/db.h \
src/dappstore/dappstore.h \
src/dappstore/dappstoredb.h \
src/eccryptoverify.h \
src/ecwrapper.h \
src/hash.h \
Expand Down Expand Up @@ -372,6 +374,9 @@ SOURCES += src/activemasternode.cpp \
src/core_read.cpp \
src/core_write.cpp \
src/crypter.cpp \
src/dappstore/dapp.cpp \
src/dappstore/dappstore.cpp \
src/dappstore/dappstoredb.cpp \
src/obfuscation.cpp \
src/nbx-cli.cpp \
src/nbx-tx.cpp \
Expand Down Expand Up @@ -407,6 +412,7 @@ SOURCES += src/activemasternode.cpp \
src/rest.cpp \
src/rpcblockchain.cpp \
src/rpcclient.cpp \
src/rpcdappstore.cpp \
src/rpcmasternode.cpp \
src/rpcmining.cpp \
src/rpcmisc.cpp \
Expand Down
2 changes: 2 additions & 0 deletions output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
9 changes: 8 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ BITCOIN_CORE_H = \
compat/endian.h \
compat/sanity.h \
compressor.h \
dappstore\dapp.h \
dappstore\dappstore.h \
dappstore\dappstoredb.h \
primitives/block.h \
primitives/transaction.h \
core_io.h \
Expand Down Expand Up @@ -206,6 +209,7 @@ libbitcoin_server_a_SOURCES = \
pow.cpp \
rest.cpp \
rpc/blockchain.cpp \
rpc/dappstore.cpp \
rpc/masternode.cpp \
rpc/mining.cpp \
rpc/misc.cpp \
Expand Down Expand Up @@ -239,6 +243,9 @@ libbitcoin_wallet_a_SOURCES = \
obfuscation.cpp \
wallet/db.cpp \
crypter.cpp \
dappstore/dapp.cpp \
dappstore/dappstore.cpp \
dappstore/dappstoredb.cpp \
swifttx.cpp \
masternode.cpp \
masternode-payments.cpp \
Expand Down Expand Up @@ -385,7 +392,7 @@ nbxd_LDADD = \
$(LIBMEMENV) \
$(LIBSECP256K1)

nbxd_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
nbxd_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(ZLIB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)

# nbx-cli binary #
nbx_cli_SOURCES = nbx-cli.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test_test_nbx_LDADD += $(LIBBITCOIN_WALLET)
endif
test_test_nbx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

test_test_nbx_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS)
test_test_nbx_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(ZLIB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS)
test_test_nbx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static

if ENABLE_ZMQ
Expand Down
2 changes: 2 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class CMainParams : public CChainParams

activityAddress = "NV8C9AYfmoiU8Sd2dBPCsqWchmnh8F6yry";
teamAddress = "NYkDC3hHouRaCSAMNsSxFj5Xv1h5etPzGT";
dAppAddress = "Ncx5oHTq7B2eZ1deLfn9XBGBbiZ5tEs3wu";
}

const Checkpoints::CCheckpointData& Checkpoints() const
Expand Down Expand Up @@ -228,6 +229,7 @@ class CTestNetParams : public CMainParams

activityAddress = "n5q6183ZL3FJsYQfR4NLwRQqP1oas2SdZw";
teamAddress = "nEnRsJtxh9k4fTtiQrt7TKpphT42asgLhZ";
dAppAddress = "nFFVKie4qhKd9zwrxCBCnQyM1FhfAV4k51";
}
const Checkpoints::CCheckpointData& Checkpoints() const
{
Expand Down
4 changes: 3 additions & 1 deletion src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class CChainParams
std::string ObfuscationPoolDummyAddress() const { return strObfuscationPoolDummyAddress; }

std::string ActivityAddress() const { return activityAddress; }
std::string TeamAddress() const { return teamAddress; }
std::string TeamAddress() const { return teamAddress; }
std::string DAppAddress() const { return dAppAddress; }

CBaseChainParams::Network NetworkID() const { return networkID; }

Expand Down Expand Up @@ -134,6 +135,7 @@ class CChainParams
std::string strObfuscationPoolDummyAddress;
std::string activityAddress;
std::string teamAddress;
std::string dAppAddress;
};

/**
Expand Down
5 changes: 5 additions & 0 deletions src/core_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ CScript ParseScript(std::string s)
// Raw hex data, inserted NOT pushed onto stack:
std::vector<unsigned char> raw = ParseHex(string(w->begin() + 2, w->end()));
result.insert(result.end(), raw.begin(), raw.end());
} else if (w->size() >= 4 && starts_with(*w, "'0x") && ends_with(*w, "'")) {
// Single-quoted string, pushed as hex data. NOTE: this is poor-man's
// parsing, spaces/tabs/newlines in single-quoted strings won't work.
std::vector<unsigned char> raw = ParseHex(string(w->begin() + 3, w->end() - 1));
result << raw;
} else if (w->size() >= 2 && starts_with(*w, "'") && ends_with(*w, "'")) {
// Single-quoted string, pushed as data. NOTE: this is poor-man's
// parsing, spaces/tabs/newlines in single-quoted strings won't work.
Expand Down
91 changes: 91 additions & 0 deletions src/dappstore/dapp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright (c) 2018-2019 Netbox.Global
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "dapp.h"

#include <vector>

#include "univalue/lib/univalue_utffilter.h"
#include "utilstrencodings.h"

bool isBase64png(const std::string &data) {
bool fInvalid = false;
std::vector<unsigned char> tmpImg = DecodeBase64(data.c_str(), &fInvalid);
if (fInvalid)
return false;
if (tmpImg.size() <= 8 || memcmp(tmpImg.data(), "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8))
return false;
return true;
}

bool isValidUtf8(const std::string &data) {
std::string str;
JSONUTF8StringFilter filter(str);
for (const char &c : data)
filter.push_back(c);
if (!filter.finalize())
return false;
return true;
}

bool DApp::CheckData(std::string *errorStr) const {
if (!CheckField(name, errorStr)) {
if (errorStr)
*errorStr = "dApp name " + *errorStr;
return false;
}
if (!CheckField(url, errorStr)) {
if (errorStr)
*errorStr = "dApp url " + *errorStr;
return false;
}
if (!CheckField(blockchain, errorStr)) {
if (errorStr)
*errorStr = "dApp blockchain " + *errorStr;
return false;
}
if (!CheckField(description, errorStr)) {
if (errorStr)
*errorStr = "dApp description " + *errorStr;
return false;
}
if (!CheckImage(image, errorStr)) {
if (errorStr)
*errorStr = "dApp image " + *errorStr;
return false;
}
return true;
}

bool DApp::IsEmpty() const {
return name.empty() && url.empty() && blockchain.empty() && description.empty() && image.empty();
}

bool DApp::CheckField(const std::string &str, std::string *errorStr) {
if (str.empty()) {
if (errorStr)
*errorStr = "is empty";
return false;
}
if (!isValidUtf8(str)) {
if (errorStr)
*errorStr = "is not in UTF-8";
return false;
}
return true;
}

bool DApp::CheckImage(const std::string &str, std::string *errorStr) {
if (str.empty()) {
if (errorStr)
*errorStr = "is empty";
return false;
}
if (!isBase64png(str)) {
if (errorStr)
*errorStr = "is not Base64-encoded PNG";
return false;
}
return true;
}
Loading

0 comments on commit ee2f0e8

Please sign in to comment.