diff --git a/Unb654enan8nt.png b/Unb654enan8nt.png deleted file mode 100644 index b614f9a..0000000 Binary files a/Unb654enan8nt.png and /dev/null differ diff --git a/Unb654enannt.png b/Unb654enannt.png deleted file mode 100644 index 8e4aedd..0000000 Binary files a/Unb654enannt.png and /dev/null differ diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 79652be..885c247 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -1,6 +1,6 @@ TEMPLATE = app -TARGET = X2-S4C-x-Public-Codename-Hydra -VERSION = 3.1.0 +TARGET = X2-Public-Codename-Hydra +VERSION = 3.2.0 INCLUDEPATH += src src/json src/qt QT += core gui network DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE @@ -286,7 +286,8 @@ HEADERS += src/qt/bitcoingui.h \ src/qt/blockbrowser.h \ src/qt/serveur.h \ src/qt/chatwindow.h \ - src/qt/statisticspage.h + src/qt/statisticspage.h \ + src/qt/stakereportdialog.h SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ src/qt/transactiontablemodel.cpp \ @@ -350,6 +351,7 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ src/qt/qtipcserver.cpp \ src/qt/rpcconsole.cpp \ src/qt/multisenddialog.cpp \ + src/qt/stakereportdialog.cpp \ src/noui.cpp \ src/kernel.cpp \ src/scrypt-arm.S \ @@ -388,10 +390,11 @@ FORMS += \ src/qt/forms/sendcoinsentry.ui \ src/qt/forms/askpassphrasedialog.ui \ src/qt/forms/rpcconsole.ui \ - src/qt/forms/optionsdialog.ui \ + src/qt/forms/optionsdialog.ui \ src/qt/forms/blockbrowser.ui \ src/qt/forms/chatwindow.ui \ - src/qt/forms/statisticspage.ui + src/qt/forms/statisticspage.ui \ + src/qt/forms/stakereportdialog.ui contains(USE_QRCODE, 1) { HEADERS += src/qt/qrcodedialog.h diff --git a/doc/Build Windows Compile-Enviroment/1.0-Zz.md b/doc/Build Windows Compile-Enviroment/1.0-Zz.md new file mode 100644 index 0000000..3143634 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.0-Zz.md @@ -0,0 +1,9 @@ + + +1.0 Install 7z +-------------- +a) http://downloads.sourceforge.net/sevenzip/7z920.msi (32-bit) + +OR + +http://downloads.sourceforge.net/sevenzip/7z920-x64.msi (64-bit) diff --git a/doc/Build Windows Compile-Enviroment/1.0.1-Notepad++.md b/doc/Build Windows Compile-Enviroment/1.0.1-Notepad++.md new file mode 100644 index 0000000..fbfede6 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.0.1-Notepad++.md @@ -0,0 +1,7 @@ + + + +1.0.1 Install Notepad ++ +-------------- +a) http://download.tuxfamily.org/notepadplus/6.5.3/npp.6.5.3.Installer.exe + diff --git a/doc/Build Windows Compile-Enviroment/1.0.2-Git.md b/doc/Build Windows Compile-Enviroment/1.0.2-Git.md new file mode 100644 index 0000000..959b083 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.0.2-Git.md @@ -0,0 +1,11 @@ + + + +1.0.2 Install Git +-------------- +a) http://git-scm.com/downloads + +b) Select the following options during installation: +* Run Git From Windows Command Prompt +* Check out Windows-style, commit Unix-style + diff --git a/doc/Build Windows Compile-Enviroment/1.1-msys.md b/doc/Build Windows Compile-Enviroment/1.1-msys.md new file mode 100644 index 0000000..375771a --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.1-msys.md @@ -0,0 +1,11 @@ + + + +1.1 Install msys: +-------------- +a) http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download + +b) When the installer loads, click "Install" and/or "Continue" until you're presented with a list on the left hand side of the screen that starts with "Basic Setup". Click Basic Setup and on the list to the right scroll all the way down and click the checkbox for ONLY the "msys-base" package. Select "Mark for installation", then click "Installation" from the top menu and "Apply Changes". + +c) Then click "Install" or "Continue" or "Close" until you're back to the lists again and then exit the Installation Manager by clicking "Installation" and "Quit". + diff --git a/doc/Build Windows Compile-Enviroment/1.2-Perl.md b/doc/Build Windows Compile-Enviroment/1.2-Perl.md new file mode 100644 index 0000000..83b8447 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.2-Perl.md @@ -0,0 +1,10 @@ + + + +1.2 Install Perl: +-------------- +a) http://downloads.activestate.com/ActivePerl/releases/5.18.1.1800/ActivePerl-5.18.1.1800-MSWin32-x64-297570.msi + +b) Run the installer ("Next", "Next", "Next", "Install", blah blah blah). If it asks to make changes to your computer, say "Yes". +You can exclude Perl Script, PPM, documentation and examples if you don't need them for other purposes. + diff --git a/doc/Build Windows Compile-Enviroment/1.3-Python.md b/doc/Build Windows Compile-Enviroment/1.3-Python.md new file mode 100644 index 0000000..d204ee7 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.3-Python.md @@ -0,0 +1,8 @@ + + +1.3 Install Python: +-------------- +a) http://www.python.org/ftp/python/3.3.3/python-3.3.3.amd64.msi + +b) Same deal, install the software. However, make sure the "Add Python to Path" option is selected. + diff --git a/doc/Build Windows Compile-Enviroment/1.4-GCC.md b/doc/Build Windows Compile-Enviroment/1.4-GCC.md new file mode 100644 index 0000000..dbc5d14 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.4-GCC.md @@ -0,0 +1,16 @@ + + + +1.4 Install GCC from MinGW-builds project: +-------------- +a) Download and unpack i686-4.8.2-release-posix-dwarf-rt_v3-rev2.7z +http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev2.7z/download + +b) Open Explorer and go to the download location, right click on the file and select "7-Zip" -> "Extract to i686-4.8.2-release-posix-dwarf-rt_v3-rev2/" + +c) Double click on the i686-4.8.2-release-posix-dwarf-rt_v3-rev2 directory and copy the folder "mingw32" to Local Disk (C:) + +d) Click on Local Disk (C:) + +e) Copy the "mingw32" folder into the "MinGW" folder + diff --git a/doc/Build Windows Compile-Enviroment/1.5-check.md b/doc/Build Windows Compile-Enviroment/1.5-check.md new file mode 100644 index 0000000..e1cea59 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/1.5-check.md @@ -0,0 +1,25 @@ + + + +1.5 Verify your paths are correct: +-------------- +a) In Explorer, right click on "Computer" and select "Properties". + +b) Select "Advanced System Settings" + +c) Click "Environment Variables" + +d) In the box labeled "System Variables", locate "Path" and double click it. + +e) In the box that comes up, scroll through the "Variable Value" and make sure you see the words "Perl" and "Python" and "MinGW" +* IF YOU DON'T SEE "PERL": +* * Go to the beginning of the text and ADD TO THE BEGINNING "C:\Perl64\site\bin;C:\Perl64\bin;" +* IF YOU DON'T SEE "PYTHON": +* * Go to the beginning of the text and ADD TO THE BEGINNING "C:\Python33;" +* IF YOU DON'T SEE "MINGW": +* * Go to the beginning of the text and ADD TO THE BEGINNING "C:\MinGW\mingw32\bin;" + +Click "Ok", "Ok", "Ok", etc to close the Control Panel. + +Having fun yet? We haven't even gotten started. + diff --git a/doc/Build Windows Compile-Enviroment/2.0-depencies.md b/doc/Build Windows Compile-Enviroment/2.0-depencies.md new file mode 100644 index 0000000..68d1cb5 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/2.0-depencies.md @@ -0,0 +1,9 @@ + + + +2. Download, unpack and build required dependencies. +-------------- +a) Create a folder called "deps" on Local Disk (C:) [C:\deps] +b) In Explorer, navigate to C:\MinGW\msys\1.0\ and find "msys.bat". Double click it to run it. A window will open that looks like a command prompt. +c) In this section, download all of the files to the C:\deps folder. + diff --git a/doc/Build Windows Compile-Enviroment/2.1-OpenSSL.md b/doc/Build Windows Compile-Enviroment/2.1-OpenSSL.md new file mode 100644 index 0000000..6427913 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/2.1-OpenSSL.md @@ -0,0 +1,22 @@ + + + +2.1 Download OpenSSL: http://www.openssl.org/source/openssl-1.0.1e.tar.gz + +a) From a MinGw shell (that window we opened), unpack the source archive with tar (this will avoid symlink issues) then configure and make (one command per line): + cd /c/deps/ + + tar xvfz openssl-1.0.1e.tar.gz + + cd openssl-1.0.1e + + Configure mingw + + make + +Ta da! You just compiled OpenSSL! + +IF THIS FAILS... IF YOU SEE THE WORD "ERROR" OR "WHATEVER OF THE SORT... GO BACK TO STEP 1.5 AND TRY AGAIN. + +If it works it doesn't pat you on the back. It just stops without saying "ERROR". Welcome to software development. + diff --git a/doc/Build Windows Compile-Enviroment/2.2-BerkleyDB.md b/doc/Build Windows Compile-Enviroment/2.2-BerkleyDB.md new file mode 100644 index 0000000..320f5c0 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/2.2-BerkleyDB.md @@ -0,0 +1,19 @@ + + + +2.2 Berkeley DB: http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz + +I used Berkeley DB 4.8.30 because it worked. No other reason. + +a)From the MinGW shell, unpack the source archive, configure and make: + + cd /c/deps/ + + tar xvfz db-4.8.30.NC.tar.gz + + cd db-4.8.30.NC/build_unix + + ../dist/configure --disable-replication --enable-mingw --enable-cxx + + make + diff --git a/doc/Build Windows Compile-Enviroment/2.3-Boost.md b/doc/Build Windows Compile-Enviroment/2.3-Boost.md new file mode 100644 index 0000000..54edac8 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/2.3-Boost.md @@ -0,0 +1,18 @@ + + + +2.3 Boost: http://sourceforge.net/projects/boost/files/boost/1.55.0/ +-------------- +Some of the coddling stops here. If you've made it this far successfully, you don't need me to hold your hand. + +a) Unpack boost inside your C:\deps folder. +b) Then open a command prompt (CMD.EXE), and: + + cd C:\deps\boost_1_55_0\ + + bootstrap.bat mingw + + b2 --build-type=complete --with-chrono --with-filesystem --with-program_options --with-system --with-thread toolset=gcc stage + +This will compile the required boost libraries and put them into the stage folder (C:\deps\boost_1_55_0\stage). + diff --git a/doc/Build Windows Compile-Enviroment/2.4-Miniupnc.md b/doc/Build Windows Compile-Enviroment/2.4-Miniupnc.md new file mode 100644 index 0000000..c139c9f --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/2.4-Miniupnc.md @@ -0,0 +1,21 @@ + + + +2.4 Miniupnpc: http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.tar.gz +-------------- +a) From the MSYS window (remember that?), type: + + tar xvfz miniupnpc-1.8.tar.gz + +b) Using Explorer, rename containing folder from "miniupnpc-1.8" to "miniupnpc" +c) Change to the "miniupnpc" directory and find the file named "Makefile.mingw" and open in it Notepad ++ +d) Go to line 61 and change "-enable-stdcall-fixup" to "--enable-stdcall-fixup" +e) Save the file +f) then from a Windows command prompt: + + cd C:\deps\miniupnpc + + mingw32-make -f Makefile.mingw init upnpc-static + +IF THIS STEP FAILS, REPEAT STEP 1.5! + diff --git a/doc/Build Windows Compile-Enviroment/QT.txt b/doc/Build Windows Compile-Enviroment/QT.txt new file mode 100644 index 0000000..821b5b7 --- /dev/null +++ b/doc/Build Windows Compile-Enviroment/QT.txt @@ -0,0 +1,66 @@ + +3.0 Download the Spacecash source code +-------------- +a) From a MSYS type: + + cd /c/ + + git clone https://github.com/Tillkoeln/Spacecash + + cd /c/Spacecash/src/leveldb + + TARGET_OS=NATIVE_WINDOWS make libleveldb.a libmemenv.a + + + +Now... for the graphical wallet... and we're going to go really fast because you're a f'in pro now. + +4. Compiling Qt 5.2.0 libraries and Spacecash-Qt +-------------- +4.1 Download and unpack Qt base and tools sources: + +a) http://download.qt-project.org/official_releases/qt/5.2/5.2.0/submodules/qtbase-opensource-src-5.2.0.7z +* Make a directory called C:\Qt +* Unpack the contents of the file into C:\Qt +* Rename the directory from qtbase-opensource-src-5.2.0 to 5.2.0 + +b) http://download.qt-project.org/official_releases/qt/5.2/5.2.0/submodules/qttools-opensource-src-5.2.0.7z +* Unpack the contents of the file into C:\Qt + +c) Open a command prompt and type: + + cd\Qt\5.2.0 + + configure.bat -release -opensource -confirm-license -static -make libs -no-sql-sqlite -no-opengl -qt-zlib -qt-pcre -no-icu -no-gif -qt-libpng -qt-libjpeg -no-angle -no-vcproj -no-openssl -no-dbus -no-audio-backend -no-wmf-backend -no-qml-debug + + mingw32-make + +e) Remember when we had to check the Path variable before? We need to do that again. Reference the instructions above on how to access it. Add the following path to the beginning: + + C:\Qt\5.2.0\bin; + +f) close and reopen the command prompt window so the new path will take effect. + +g) Type: + + cd C:\Qt\qttools-opensource-src-5.2.0 + + qmake qttools.pro + + mingw32-make + +5. Compiling the Spacecash-Qt client +-------------- + + +5.1 In the command prompt type: + + cd\Spacecash + + qmake Spacecash-qt.pro + + mingw32-make -f Makefile.Release + +YOU DID IT! + +Don't forget to create your .conf files! diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 2d8e691..2fc7f9e 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -2,7 +2,9 @@ // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. - +// September 2018 StakeReport added, any Questions ? feel free to ask +// Twitter/Tillkoeln .. Youtube/Tillkoeln ... Bitcointalk/Tillkoeln +// https://yobit.net/en/pm/create/Tillkoeln #include "init.h" #include "util.h" #include "sync.h" @@ -307,6 +309,7 @@ static const CRPCCommand vRPCCommands[] = { "makekeypair", &makekeypair, false, true}, { "sendalert", &sendalert, false, false}, { "multisend", &multisend, false, false }, + { "getstakereport", &getstakereport, false, false}, }; CRPCTable::CRPCTable() diff --git a/src/bitcoinrpc.h b/src/bitcoinrpc.h index c30c251..c71b22c 100644 --- a/src/bitcoinrpc.h +++ b/src/bitcoinrpc.h @@ -2,6 +2,10 @@ // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +// +// September 2018 StakeReport added, any Questions ? feel free to ask +// Twitter/Tillkoeln .. Youtube/Tillkoeln ... Bitcointalk/Tillkoeln +// https://yobit.net/en/pm/create/Tillkoeln #ifndef _BITCOINRPC_H_ #define _BITCOINRPC_H_ 1 @@ -218,5 +222,6 @@ extern json_spirit::Value getblockhash(const json_spirit::Array& params, bool fH extern json_spirit::Value getblock(const json_spirit::Array& params, bool fHelp); extern json_spirit::Value getblockbynumber(const json_spirit::Array& params, bool fHelp); extern json_spirit::Value getcheckpoint(const json_spirit::Array& params, bool fHelp); +extern json_spirit::Value getstakereport(const json_spirit::Array& params, bool fHelp); #endif diff --git a/src/net.cpp b/src/net.cpp index 0e7560d..ce6bc31 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1132,12 +1132,10 @@ void MapPort() // The first name is used as information source for addrman. // The second name should resolve to a list of seed addresses. static const char *strDNSSeed[][2] = { - {"Node-0", "5.146.140.4"}, {"Node-1", "x2team2017.ddns.net"}, - {"Node-2", "185.61.151.109"}, - {"Node-3", "185.61.151.132"}, {"Node-1", "stratumtest.ddns.net"}, - + {"Node-1", "185.82.203.178"}, + {"Node-1", "185.106.121.130"}, }; void ThreadDNSAddressSeed(void* parg) @@ -1208,14 +1206,7 @@ void ThreadDNSAddressSeed2(void* parg) unsigned int pnSeed[] = { - 0xdf4bd379, 0x7934d29b, 0x26bc02ad, 0x7ab743ad, 0x0ab3a7bc, - 0x375ab5bc, 0xc90b1617, 0x5352fd17, 0x5efc6c18, 0xccdc7d18, - 0x443d9118, 0x84031b18, 0x347c1e18, 0x86512418, 0xfcfe9031, - 0xdb5eb936, 0xef8d2e3a, 0xcf51f23c, 0x18ab663e, 0x36e0df40, - 0xde48b641, 0xad3e4e41, 0xd0f32b44, 0x09733b44, 0x6a51f545, - 0xe593ef48, 0xc5f5ef48, 0x96f4f148, 0xd354d34a, 0x36206f4c, - 0xceefe953, 0x50468c55, 0x89d38d55, 0x65e61a5a, 0x16b1b95d, - 0x702b135e, 0x0f57245e, 0xdaab5f5f, 0xba15ef63, + }; void DumpAddresses() diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 41a8eec..68de73f 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -30,6 +30,7 @@ #include "blockbrowser.h" #include "statisticspage.h" #include "chatwindow.h" +#include "stakereportdialog.h" #ifdef Q_OS_MAC #include "macdockiconhandler.h" @@ -324,6 +325,9 @@ void BitcoinGUI::createActions() signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); + stakeReportAction = new QAction(QIcon(":/icons/minting"), tr("Show stake report"), this); + stakeReportAction->setToolTip(tr("Open the Stake Report Box")); + exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this); exportAction->setToolTip(tr("Export the data in the current tab to a file")); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); @@ -341,6 +345,7 @@ void BitcoinGUI::createActions() connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); + connect(stakeReportAction, SIGNAL(triggered()), this, SLOT(stakeReportClicked())); } void BitcoinGUI::createMenuBar() @@ -371,6 +376,9 @@ void BitcoinGUI::createMenuBar() settings->addSeparator(); settings->addAction(optionsAction); + QMenu *information = appMenuBar->addMenu(tr("Information")); + information->addAction(stakeReportAction); + QMenu *help = appMenuBar->addMenu(tr("&Help")); help->addAction(openRPCConsoleAction); help->addSeparator(); @@ -546,6 +554,14 @@ void BitcoinGUI::multiSendClicked(QString addr) disconnect(exportAction, SIGNAL(triggered()), 0, 0); } +// Stake report dialog +void BitcoinGUI::stakeReportClicked() +{ + static StakeReportDialog dlg; + dlg.setModel(walletModel); + dlg.show(); +} + void BitcoinGUI::setNumConnections(int count) { diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 5514b63..d0e0c1c 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -108,7 +108,8 @@ class BitcoinGUI : public QMainWindow QAction *aboutQtAction; QAction *openRPCConsoleAction; QAction * multiSendAction; - + QAction *stakeReportAction; + QSystemTrayIcon *trayIcon; Notificator *notificator; TransactionView *transactionView; @@ -196,7 +197,10 @@ private slots: void unlockWallet(); void lockWallet(); - + + /** Open stake report dialog */ + void stakeReportClicked(); + /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */ void showNormalIfMinimized(bool fToggleHidden = false); /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */ diff --git a/src/qt/forms/stakereportdialog.ui b/src/qt/forms/stakereportdialog.ui new file mode 100644 index 0000000..fbb8f5a --- /dev/null +++ b/src/qt/forms/stakereportdialog.ui @@ -0,0 +1,938 @@ + + + StakeReportDialog + + + + 0 + 0 + 823 + 560 + + + + + 823 + 560 + + + + + 823 + 582 + + + + Stake Report + + + false + + + + + + + 460 + 560 + + + + + 460 + 560 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 200 + 0 + + + + + 12 + 75 + true + + + + Earnings made by stake over time + + + QFrame::NoFrame + + + QFrame::Sunken + + + 2 + + + 3 + + + Stake Report + + + Qt::AlignHCenter|Qt::AlignTop + + + + + + + Qt::Horizontal + + + + + + + 5 + + + + + + 9 + 75 + true + + + + Coin SubTotal + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 75 + true + + + + Blocks Staked + + + Stakes + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + + + + + + + Last 24 Hours + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Coin Earned in last 24H + + + 0.00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Stake Made in last 24H + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + + + + + + + Last 7 Days + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Coin Earned in last 7 Days + + + 0.00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Stake Made in last 7 Days + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + + + + + + + Last 30 Days + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Coin Earned in last 30 Days + + + 0.00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Stake Made in last 30 Days + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + + + + + + + Last 365 Days + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Coin Earned in last 365 Days + + + 0.00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + false + + + + Stake Made in last 365 Days + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + + Qt::Horizontal + + + + + + + QLayout::SetDefaultConstraint + + + 35 + + + + + + 0 + 0 + + + + + 9 + 50 + false + + + + Date of the last mature Stake + + + Never + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 2 + + + + + + + + 0 + 0 + + + + + 9 + 50 + false + false + + + + Coin Earned in last mature Stake + + + 0.00 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 2 + + + + + + + + + + 1 + 0 + + + + + 50 + false + + + + true + + + true + + + 30 + + + 3 + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Date + + + + 9 + 75 + true + + + + AlignLeft|AlignVCenter + + + + + Amount + + + + 9 + 75 + true + + + + AlignRight|AlignVCenter + + + + + Stakes + + + + 9 + 75 + true + + + + AlignRight|AlignVCenter + + + + + + + + + 9 + + + + ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled + + + + + 0 + + + + + + + 9 + + + + AlignRight|AlignVCenter + + + ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled + + + + + 0 + + + + 9 + + + + AlignRight|AlignVCenter + + + ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled + + + + + + + + 35 + + + + + + 9 + 50 + false + + + + Time took to retrieve the data + + + Wait please... + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + + + + Time took to refresh dialog + + + Wait please... + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + 9 + 50 + false + + + + Total Stakes Analyzed + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 4 + + + + + + + + + + 9 + 50 + false + + + + Data of the current block. + + + Current Chain Block : + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 2 + + + + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + Refresh the data + + + Refresh + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + Copy Report to ClipBoard + + + Copy to clipboard + + + + + + + + 0 + 0 + + + + Close the dialog + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + true + + + + + + + + + + + + + 263 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 276 + 161 + + + + + 276 + 161 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://yobit.net/en/trade/PROFIT/BTC/?bonus=QEOmT"><img src=":/images/res/images/yobit.png" /></a></p></body></html> + + + true + + + + + + + + 276 + 161 + + + + + 276 + 161 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://www.youtube.com/channel/UC-x4N9JU3Aoi8RyBlPQc75Q"><img src=":/images/res/images/youtube.png" /></a></p></body></html> + + + true + + + + + + + + 276 + 161 + + + + + 276 + 161 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/Tillkoeln"><img src=":/images/res/images/twitter.png" /></a></p></body></html> + + + true + + + + + + + + + + + + + + buttonBox + clicked(QAbstractButton*) + StakeReportDialog + close() + + + 338 + 524 + + + 215 + 276 + + + + + diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index b0a08c8..b59a157 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -428,6 +428,7 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) : " -lang= " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + " -min " + tr("Start minimized") + "\n" + " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; + " -disablereportupdate " + tr("Disable auto update of stake report window (default: 0)") + "\n"; setWindowTitle(tr("X2-Qt")); setTextFormat(Qt::PlainText); diff --git a/src/qt/res/images/twitter.png b/src/qt/res/images/twitter.png new file mode 100644 index 0000000..56742f6 Binary files /dev/null and b/src/qt/res/images/twitter.png differ diff --git a/src/qt/res/images/yobit.png b/src/qt/res/images/yobit.png new file mode 100644 index 0000000..33c02f5 Binary files /dev/null and b/src/qt/res/images/yobit.png differ diff --git a/src/qt/res/images/youtube.png b/src/qt/res/images/youtube.png new file mode 100644 index 0000000..55f1666 Binary files /dev/null and b/src/qt/res/images/youtube.png differ diff --git a/src/qt/stakereportdialog.cpp b/src/qt/stakereportdialog.cpp new file mode 100644 index 0000000..598082d --- /dev/null +++ b/src/qt/stakereportdialog.cpp @@ -0,0 +1,281 @@ +//***************************************************** +// +// Dialog which report the earning made with stake over time +// Original coding by Remy5 +// + +#include "stakereportdialog.h" +#include "ui_stakereportdialog.h" + +#include "guiconstants.h" +#include "walletmodel.h" +#include "bitcoinunits.h" +#include "bitcoinrpc.h" +#include "optionsmodel.h" +#include "main.h" // for hashBestChain + +#include +#include +#include +#include + +using namespace json_spirit; +using namespace boost; +using namespace std; + +struct StakePeriodRange_T { + int64_t Start; + int64_t End; + int64_t Total; + int Count; + string Name; +}; + +typedef vector vStakePeriodRange_T; + +extern vStakePeriodRange_T PrepareRangeForStakeReport(); +extern int GetsStakeSubTotal(vStakePeriodRange_T& aRange); + +StakeReportDialog::StakeReportDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::StakeReportDialog) +{ + ui->setupUi(this); + + QTableWidget *TableW = ui->StakeReportTable; + + alreadyConnected = false; + + // fill the table with clone of row 0 + for(int y=TableW->rowCount(); --y >= 1;) + for(int x=TableW->columnCount(); --x >= 0;) + TableW->setItem(y, x, + TableW->item(0, x)->clone()); + + TableW->horizontalHeader()->resizeSection(1,160); + + QApplication::processEvents(); + + updateStakeReportNow(); // 1st update +} + +StakeReportDialog::~StakeReportDialog() +{ + delete ui; +} + +void StakeReportDialog::setModel(WalletModel *model) +{ + this->ex_model = model; + + if(ex_model && ex_model->getOptionsModel() && !alreadyConnected) + { + alreadyConnected = true; + + connect(ex_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit(int))); + connect(ui->button_Refresh, SIGNAL(clicked()), this, SLOT(updateStakeReportNow())); + connect(ui->CopytoClipboard, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard())); + + disablereportupdate = GetBoolArg("-disablereportupdate"); + + if (!disablereportupdate) + { + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(updateStakeReportTimer())); + connect(ex_model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64)), this, SLOT(updateStakeReportbalanceChanged(qint64, qint64, qint64, qint64))); + + timer->start(MODEL_UPDATE_DELAY*5); + } + } +} + +void StakeReportDialog::updateStakeReportbalanceChanged(qint64, qint64, qint64, qint64) +{ + StakeReportDialog::updateStakeReportNow(); +} + +void StakeReportDialog::updateDisplayUnit(int) +{ + StakeReportDialog::updateStakeReportNow(); +} + +void StakeReportDialog::updateStakeReportTimer() +{ + static int lastBest = 0 ; + if (lastBest != nBestHeight) + { + lastBest = nBestHeight; + StakeReportDialog::updateStakeReport(false); + } +} + +void StakeReportDialog::showEvent( QShowEvent* event ) +{ + QWidget::showEvent( event ); + StakeReportDialog::updateStakeReportNow(); +} + +// Extendable localtime format +QString HalfDate(int64_t nTime, QString TimeMode="") +{ + QDateTime OrigDate = QDateTime::fromTime_t((qint32)nTime); + QString LocalDate = OrigDate.date().toString("yyyy-MM-dd"); + if (TimeMode != "") + LocalDate += " " + OrigDate.toString(TimeMode); + + return LocalDate; +} + +// format Bitcoinvalue with all trailing zero +QString Coin_0Pad(int nUnit, int64_t amount) +{ + QString result = BitcoinUnits::format(nUnit, amount); + + int poin = result.indexOf(".") + 1; + poin += BitcoinUnits::decimals(nUnit); + + return result.leftJustified(poin, '0'); +} + +void StakeReportDialog::updateStakeReportNow() +{ + updateStakeReport(true); +} + +void StakeReportDialog::updateStakeReport(bool fImmediate=false) +{ + static vStakePeriodRange_T aRange; + int nItemCounted=0; + + if (fImmediate) nLastReportUpdate = 0; + + if (this->isHidden()) + return; + + int64_t nTook = GetTimeMillis(); + + // Skip report recalc if not immediate or before 5 minutes from last + if (GetTime() - nLastReportUpdate > 300) + { + QApplication::processEvents(); + + ui->TimeTook->setText(tr("Please wait...")); + ui->TimeTook->repaint(); + QApplication::processEvents(); + + aRange = PrepareRangeForStakeReport(); + + // get subtotal calc + nItemCounted = GetsStakeSubTotal(aRange); + + nLastReportUpdate = GetTime(); + + nTook = GetTimeMillis() - nTook; + + } + + int64_t nTook2 = GetTimeMillis(); + + // actually update labels + int nDisplayUnit = BitcoinUnits::BTC; + if (ex_model && ex_model->getOptionsModel()) + nDisplayUnit = ex_model->getOptionsModel()->getDisplayUnit(); + + ui->L_Coin->setText(BitcoinUnits::name(nDisplayUnit) + " " + tr("SubTotal")); + + QTableWidget *TableW = ui->StakeReportTable; + + TableW->horizontalHeaderItem(1)->setText(BitcoinUnits::name(nDisplayUnit) + " " +tr("Amount")); + + int i=30; + + TableW->setSortingEnabled(false); + for(int y=0; yitem(y,0)->setText(HalfDate(aRange[y].Start)); + TableW->item(y,1)->setText(Coin_0Pad(nDisplayUnit, aRange[y].Total)); + TableW->item(y,2)->setText(QString::number(aRange[y].Count)); + } + TableW->setSortingEnabled(true); + + ui->Amount_24H->setText(Coin_0Pad(nDisplayUnit, aRange[i].Total) + tr(" [PROFIT]")); + ui->Stake_24H->setText(QString::number(aRange[i++].Count)); + ui->Amount_7D->setText(Coin_0Pad(nDisplayUnit, aRange[i].Total) + tr(" [PROFIT]")); + ui->Stake_7D->setText(QString::number(aRange[i++].Count)); + ui->Amount_30D->setText(Coin_0Pad(nDisplayUnit, aRange[i].Total) + tr(" [PROFIT]")); + ui->Stake_30D->setText(QString::number(aRange[i++].Count)); + ui->Amount_365D->setText(Coin_0Pad(nDisplayUnit, aRange[i].Total) + tr(" [PROFIT]")); + ui->Stake_365D->setText(QString::number(aRange[i++].Count)); + + ui->Amount_Last->setText(tr("Amount: ") + Coin_0Pad(nDisplayUnit, aRange[i].Total) + tr(" [PROFIT]")); + ui->L_LastStakeTime->setText(tr("Latest stake date: ") + HalfDate(aRange[i].Start, "hh:mm")); + + ui->Stake_Counted->setText(tr("Stakes analysed: ") + QString::number(nItemCounted)); + if (nItemCounted) + ui->TimeTook->setText(tr("Last Recalc took ") + QString::number(nTook) + "ms"); + + ui->TimeTook_2->setText(tr("Refresh took ") + QString::number(GetTimeMillis() -nTook2) + "ms"); + + string sRefreshType = disablereportupdate ? "Manual refresh" : "Auto refresh"; + + string strCurr_block_info = strprintf("%s - %s : %6d @ %s\nhash %s\n", + sRefreshType.c_str(), "Current Block", nBestHeight, + HalfDate(pindexBest->GetBlockTime(), "hh:mm:ss").toStdString().c_str(), + hashBestChain.GetHex().c_str()); + + ui->L_CurrentBlock->setText(strCurr_block_info.c_str() ); + +} + +QString GridGetLabelTextAt(QGridLayout * Grid, int row, int column, QString Empty = "") +{ + if (Grid && Grid->itemAtPosition(row, column) && + Grid->itemAtPosition(row, column)->widget()) + return ((QLabel *) Grid->itemAtPosition(row, column)->widget())->text(); + else + return Empty; +} + +void StakeReportDialog::CopyAllToClipboard() +{ + QString Repo; + + Repo += " Stake Mini Report\n"; + Repo += " ---------------------\n"; + + QString RowForm = "%1 %2 %3\n"; + + for(int y=0; ygridLayout->rowCount(); y++) + { + if (y == 5) + Repo += "\n"; // separator line + else + Repo += RowForm + .arg(GridGetLabelTextAt(ui->gridLayout, y,0), -16) + .arg(GridGetLabelTextAt(ui->gridLayout, y,1), 16) + .arg(GridGetLabelTextAt(ui->gridLayout, y,2), 7); + } + + Repo += "\n"; + + QTableWidget *TableW = ui->StakeReportTable; + RowForm = "%1, %2, %3\n"; + + Repo += RowForm + .arg(TableW->horizontalHeaderItem(0)->text(), -10) + .arg(TableW->horizontalHeaderItem(1)->text(), 16) + .arg(TableW->horizontalHeaderItem(2)->text(), 7); + + for(int y=0; y<30; y++) + { + Repo += RowForm + .arg(TableW->item(y,0)->text(), -10) + .arg(TableW->item(y,1)->text(), 16) + .arg(TableW->item(y,2)->text(), 7); + } + + Repo += "\n" + ui->L_CurrentBlock->text() + "\n"; + + QApplication::clipboard()->setText(Repo); + +} diff --git a/src/qt/stakereportdialog.h b/src/qt/stakereportdialog.h new file mode 100644 index 0000000..775ce12 --- /dev/null +++ b/src/qt/stakereportdialog.h @@ -0,0 +1,49 @@ +//***************************************************** +// +// Dialog which report the earning made with stake over time +// Original coding by Remy5 +// + +#ifndef STAKEREPORTDIALOG_H +#define STAKEREPORTDIALOG_H + +#include + +namespace Ui { +class StakeReportDialog; +} + +class WalletModel; + +class StakeReportDialog : public QDialog +{ + Q_OBJECT + +public: + explicit StakeReportDialog(QWidget *parent = 0); + ~StakeReportDialog(); + + void setModel(WalletModel *model); + void showEvent(QShowEvent* event); + +private: + Ui::StakeReportDialog *ui; + WalletModel *ex_model; + + qint64 nLastReportUpdate; + bool disablereportupdate; + bool alreadyConnected; + + void updateStakeReport(bool fImmediate); + +private slots: + void updateStakeReportTimer(); + +public slots: + void updateStakeReportbalanceChanged(qint64, qint64, qint64, qint64); + void updateStakeReportNow(); + void updateDisplayUnit(int); + void CopyAllToClipboard(); +}; + +#endif // STAKEREPORTDIALOG_H diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index b0ff8c5..68ecbc1 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -2,6 +2,9 @@ // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +// September 2018 StakeReport added, any Questions ? feel free to ask +// Twitter/Tillkoeln .. Youtube/Tillkoeln ... Bitcointalk/Tillkoeln +// https://yobit.net/en/pm/create/Tillkoeln #include "wallet.h" #include "walletdb.h" @@ -2023,4 +2026,133 @@ Value multisend(const Array ¶ms, bool fHelp) } } return printMultiSend(); +} + // getstakereport +struct StakePeriodRange_T { + int64_t Start; + int64_t End; + int64_t Total; + int Count; + string Name; +}; + typedef vector vStakePeriodRange_T; + // **em52: Get total coins staked on given period + // inspired from CWallet::GetStake() + // Parameter aRange = Vector with given limit date, and result + // return int = Number of Wallet's elements analyzed +int GetsStakeSubTotal(vStakePeriodRange_T& aRange) +{ + int nElement = 0; + int64_t nAmount = 0; + const CWalletTx* pcoin; + vStakePeriodRange_T::iterator vIt; + // scan the entire wallet transactions + for (map::const_iterator it = pwalletMain->mapWallet.begin(); + it != pwalletMain->mapWallet.end(); + ++it) + { + pcoin = &(*it).second; + // skip orphan block or immature + if ((!pcoin->GetDepthInMainChain()) || (pcoin->GetBlocksToMaturity()>0)) + continue; + // skip transaction other than POS block + if (!(pcoin->IsCoinStake())) + continue; + nElement++; + // use the cached amount if available + if (pcoin->fCreditCached && pcoin->fDebitCached) + nAmount = pcoin->nCreditCached - pcoin->nDebitCached; + else + nAmount = pcoin->GetCredit() - pcoin->GetDebit(); + // scan the range + for(vIt=aRange.begin(); vIt != aRange.end(); vIt++) + { + if (pcoin->nTime >= vIt->Start) + { + if (! vIt->End) + { // Manage Special case + vIt->Start = pcoin->nTime; + vIt->Total = nAmount; + } + else if (pcoin->nTime <= vIt->End) + { + vIt->Count++; + vIt->Total += nAmount; + } + } + } + } + return nElement; +} + // prepare range for stake report +vStakePeriodRange_T PrepareRangeForStakeReport() +{ + vStakePeriodRange_T aRange; + StakePeriodRange_T x; + struct tm Loc_MidNight; + int64_t n1Hour = 60*60; + int64_t n1Day = 24 * n1Hour; + int64_t nToday = GetTime(); + time_t CurTime = nToday; + localtime_r(&CurTime, &Loc_MidNight); + Loc_MidNight.tm_hour = 0; + Loc_MidNight.tm_min = 0; + Loc_MidNight.tm_sec = 0; // set midnight + x.Start = mktime(&Loc_MidNight); + x.End = nToday; + x.Count = 0; + x.Total = 0; + // prepare last single 30 day Range + for(int i=0; i<30; i++) + { + x.Name = DateTimeStrFormat(x.Start); + aRange.push_back(x); + x.End = x.Start - 1; + x.Start -= n1Day; + } + // prepare subtotal range of last 24H, 1 week, 30 days, 1 years + int GroupDays[4][2] = { {1 ,0}, {7 ,0 }, {30, 0}, {365, 0}}; + string sGroupName[] = {"24H", "7 Days", "30 Days", "365 Days" }; + nToday = GetTime(); + for(int i=0; i<4; i++) + { + x.Start = nToday - GroupDays[i][0] * n1Day; + x.End = nToday - GroupDays[i][1] * n1Day; + x.Name = "Last " + sGroupName[i]; + aRange.push_back(x); + } + // Special case. not a subtotal, but last stake + x.End = 0; + x.Start = 0; + x.Name = "Latest Stake"; + aRange.push_back(x); + return aRange; +} + // getstakereport: return SubTotal of the staked coin in last 24H, 7 days, etc.. of all owns address +Value getstakereport(const Array& params, bool fHelp) +{ + if ((params.size()>0) || (fHelp)) + throw runtime_error( + "getstakereport\n" + "List last single 30 day stake subtotal and last 24h, 7, 30, 365 day subtotal.\n"); + vStakePeriodRange_T aRange = PrepareRangeForStakeReport(); + // get subtotal calc + int64_t nTook = GetTimeMillis(); + int nItemCounted = GetsStakeSubTotal(aRange); + nTook = GetTimeMillis() - nTook; + Object result; + vStakePeriodRange_T::iterator vIt; + // report it + for(vIt = aRange.begin(); vIt != aRange.end(); vIt++) + { + result.push_back(Pair(vIt->Name, FormatMoney(vIt->Total).c_str())); + } + vIt--; + result.push_back(Pair("Latest Time", + vIt->Start ? DateTimeStrFormat(vIt->Start).c_str() : + "Never")); + // report element counted / time took + result.push_back(Pair("Stake counted", nItemCounted)); + result.push_back(Pair("time took (ms)", nTook )); + return result; } \ No newline at end of file diff --git a/src/version.cpp b/src/version.cpp index ff94148..82ffc8d 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -8,7 +8,7 @@ // Name of client reported in the 'version' message. Report the same name // for both bitcoind and bitcoin-qt, to make it harder for attackers to // target servers or GUI users specifically. -const std::string CLIENT_NAME("X2-S4C-Public-Codename-Hydra"); +const std::string CLIENT_NAME("X2-Codename-Hydra"); // Client version number #define CLIENT_VERSION_SUFFIX ""