Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] [Model] New Wallet UI #954

Merged
merged 373 commits into from
Sep 10, 2019

Conversation

furszy
Copy link

@furszy furszy commented Jul 16, 2019

This PR encompasses the past 5 months of extensive work toward a brand new wallet.

Starting from the entire creation of a brand new UI / UX flow for the wallet as a whole, and for every current available feature, to the addition of new functionalities (front-end and back-end) were made to be in-line with the wallet that was envisioned in the design phase.

This new wallet was designed by Krubit, UI / UX professional designers and front-end developers that worked side by side with me in this long adventure.

Thanks to everyone that have been part of it, especially the PIVX governance system, and private investors for making this possible.

A walkthrough video of the new wallet running can be found here: LINK


PR Release Notes

*New splash screen.
*Intro screen revamped.

*New initial wallet setup walkthrough tutorial wizard!
*Language selection.

*New Dashboard screen!

  • New transactions list.
  • One click receive QR address.
  • Wallet balances always visible in the top bar.

*New stakes chart!

  • A brand new chart that let you know how many stakes were received in the past year, month, days!
  • Easy single click operation.

*New top status bar!

  • Important information organized at the top of your wallet, always visible and updated in real-time.
  • New wallet lock/unlock dialog.

*Two brand new themes supported!

  • Dark and White theme!!

*Newly designed Send screen!

  • PIV/zPIV supported on the same screen.
  • Multi-outputs, remaining balance, total balance.
  • Parse PIVX URI & Payment Request.
  • Custom transaction options!
  • Autocomplete send to address with contacts.
  • Autocomplete URI in "send to" editable box.

*Newly designed Receive screen!

  • Create PIVX URI & Payment request wizard. Easy payment request creation.
  • My address QR always visible.
  • Set and modify the address label.
  • Create new addresses on-demand.
  • My addresses list information lot more understandable (creation date included).
  • Single click copy/edit addresses.

*New Contacts screen!

  • Create contacts and don't forget who sent you money, storing an address and label for them.
  • Copy, edit and delete contacts visually.
  • Every editable box address input contains a contacts auto-completable dialog.

*New Privacy screen!

  • Mint and Convert PIV to zPIV on the same screen.
  • View your past mints and conversions in an organized list.
  • Select the coin inputs.
  • See zPIV denominations.

*New Master Nodes screen!

  • New Master Nodes list view.
  • New Master Nodes creation wizard! (Controller creation wizard dialog).
  • Start, edit, delete master node from a single click!.
  • Export master node for remote setup.
  • Master nodes in-wallet FAQ.

*New Settings screen!

  • All of the previous functions have been better organized and improved on the UI.
  • In-Wallet FAQ covering most commonly asked topics.
  • BIP38 encrypt and decrypt addresses flow revamped.
  • MultiSend flow revamped. Now much more visually understandable.
  • Easy Sign/Verify messages.
  • Wallet options layout improved.

*New Notifications

  • New snackbar (popup) notification.
  • New default dialogs.

Pending work (Not forget):

*Remove old UI code that it's not used anymore (can be done in a subsequent PR, this one is really big).
*Update build docs.
*Continue cleaning the PR.

@furszy furszy added this to the 4.0.0 milestone Jul 16, 2019
@furszy furszy self-assigned this Jul 17, 2019
@CaveSpectre11
Copy link

CaveSpectre11 commented Jul 17, 2019

Initial quick glance comment before delving in to give constructive feedback...

Perhaps add the pivx-new-gui.* QT files into the .gitignore so they aren't added into the repo?

@Fuzzbawls Fuzzbawls changed the title [WIP] [GUI] [Model] New Wallet 4.0 [WIP] [GUI] [Model] New Wallet UI Jul 17, 2019
@Fuzzbawls Fuzzbawls added the GUI label Jul 17, 2019
@furszy
Copy link
Author

furszy commented Jul 18, 2019

Initial quick glance comment before delving in to give constructive feedback...

Perhaps add the pivx-new-gui.* QT files into the .gitignore so they aren't added into the repo?

Actually, those are not needed and were added by mistake. Will remove them, we have the pivx-qt.pro file in contrib/ covering the same purpose. Good.

Copy link

@CaveSpectre11 CaveSpectre11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primarily nits; but also check labelContent7; as I believe the title of the second section should be "To Stake zPiv"

src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
src/qt/pivx/settings/forms/settingsfaqwidget.ui Outdated Show resolved Hide resolved
@CaveSpectre11
Copy link

CaveSpectre11 commented Jul 20, 2019

System: Ubuntu 18.04
Display: 1366x768

Some UI feedback.

  • There seems to be a little lag between changing the theme and it changing. It would be nice to have feedback to the user; either a change in color or tone until the switch occurs, or perhaps a temporary "switching" or some sense that clicking on it did anything.

  • Address display field in the receive tab is slightly too small for the address on my display (qr code page is fine)
    image

  • Contacts Tab:

    • should probably prevent duplicate contact names
    • would be nice to be able to sort by address or name
  • Settings->Options->Wallet - Wallet section:

    • Show Masternodes tab isn't checked by default; but the masternodes tab exists. Selection doesn't seem to have any effect on the existence of the masternodes tab
    • "reset to default" doesn't seem to do anything.

Fixed

  • When adding the new payment request address to the list of addresses; the label entered should be applied. Currently the Label is in the url, but the address is added to your address list as "(no label)" (Fixed)

  • Stake split threshold doesn't go above 99. Also doesn't appear to read the value (when I change it through cli to something small (like 20), it doesn't seem to reflect in the wallet settings (fixed in 6627bac)

  • Contacts Tab: the example implies the entry field can have spaces, but it won't accept spaces. However I can edit the record and put spaces in. (fixed)

  • Receive Tab: New Request Payment Screen: Info window is cut off (fixed)

  • Contacts Tab. The arrow to the right of "New Contact" seems to imply that the entry boxes can roll up, but the arrow doesn't seem to have live action. (Fixed 0d36337)

  • In Settings->Debug->Info Wallet Conf button is too small for the text (Fixed)

  • Privacy Tab: Rescan mints and Reset Zerocoin pop up windows have title "PIVX Core". Should probably be "Rescan Mints" and "Reset Zerocoin" (respectively). (Looked at the code and I see it's being set, but it's not working for some reason) (Fixed with 15c50cd)

  • Masternode tab: "What is a Master Node?" Should pop to that section of the Faq, not the top of the faq. (Fixed)

@CaveSpectre11
Copy link

Will "Split UTXO" be supported in the new wallet?

@furszy
Copy link
Author

furszy commented Jul 21, 2019

Great feedback @CaveSpectre11 👌 , doing the corrections first.

@CaveSpectre11
Copy link

@furszy ; check the PR I pushed to your branch. I think I removed the ones I took care of from the above list; but just in case... check that PR and merge if you're okay with the parts I did.

furszy#9

@furszy
Copy link
Author

furszy commented Jul 21, 2019

Ok, didn't see it, will check it 👍 . Just try to not overlap work, no need to be doing things twice.

@CaveSpectre11
Copy link

Ok, didn't see it, will check it . Just try to not overlap work, no need to do be doing things twice.

As you'll (you've) seen, they were trivial nits that was easier for me to just tweak and test rather than me taking the time to communicate them and you taking the time from real issues.

@furszy
Copy link
Author

furszy commented Jul 21, 2019

Ok, didn't see it, will check it . Just try to not overlap work, no need to do be doing things twice.

As you'll (you've) seen, they were trivial nits that was easier for me to just tweak and test rather than me taking the time to communicate them and you taking the time from real issues.

yeah sure, just checked and answered there. All good, always better to be sync and organized in the work that it's being done. If we are sync and know what we are doing, we will move faster.

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that static text is used for the navmenu's version label (likely for promotional purposes). Simple reminder to revert to using the derived/calculated version.

src/qt/pivx/navmenuwidget.cpp Outdated Show resolved Hide resolved
@furszy furszy force-pushed the new_gui_rebased_final branch 2 times, most recently from b1e39f1 to c65fcca Compare July 23, 2019 02:26
@furszy
Copy link
Author

furszy commented Jul 23, 2019

@CaveSpectre11 list completed. The remaining points are not issues, more feature request. Double check them when you can and let me know.

@CaveSpectre11
Copy link

@CaveSpectre11 list completed. The remaining points are not issues, more feature request. Double check them when you can and let me know.

Sounds good. I'll run a build tonight and cross 'em off as I verify. Then clean up the list to separate the fixed vs. feature requests so it's more readable after all the crossouts.

@CaveSpectre11
Copy link

New issue:

  • The behavior of the home screen staking rewards graph is inconsistent. Changing "filter by" has action to change the graph when clearing, but not populating.
    1. Home screen, Staking Rewards pane; Staking statistics.:
    2. Sort by: Days. Filter by July. Statistics for 19th through 27th are shown.
    3. Select Filter By: August. Graph clears.
    4. Select Filter By: July. Graph doesn't populate
    5. click "Days", graph comes back.

@Fuzzbawls
Copy link
Collaborator

Needs Rebase

@Fuzzbawls Fuzzbawls added the Needs Release Notes Placeholder tag for anything needing mention in the "Notable Changes" section of release notes label Jul 28, 2019
@furszy
Copy link
Author

furszy commented Aug 2, 2019

hey @CaveSpectre11 the refresh chart issue in linux was solved too. Give another look when you can, lot of new commits :) .

@furszy
Copy link
Author

furszy commented Sep 6, 2019

Testnet flag reverted, WIP PR tag removed, travis passing.

[Trivial] pivxgui and addressfilterproxymodel filenames to lowercase refactor.
random-zebra
random-zebra previously approved these changes Sep 6, 2019
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After extensive testing and review, as already discussed, I think this is at a stage where it can be merged safely into master.

Impressive work furszyfer 🍺

From my side, ACK b19cbaf

@borris345
Copy link

Is governance tab that's being worked on 4.0? Even just a basic one. On the list of suggested features was proposal creation wizard to but I assume that is later? Either way great work!

@furszy
Copy link
Author

furszy commented Sep 7, 2019

@borris345 at the moment, priority is get this huge PR merged, it's touching and including so many files that almost every new PR merge ends up with me rebasing this, over and over.

About governance tab, a basic one will be finished for 4.0 (momentally without Krubit team, just myself). Will finish it and push it in a subsequent clean PR after this merge.
About the proposal creation wizard for now yes. It's on my todo list.

…ets focused.

     - Privacy screen, zPIV minting disabled.
[UI] FormatVersionFriendly method created, friendly app's version string to be displayed on the UI.
…w so often when node is syncing.

     - Try chart refresh when the wallet is synced.
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ca046aa

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ca046aa
and merging...

random-zebra added a commit that referenced this pull request Sep 10, 2019
ca046aa [UI] - Dashboard chart load, min update time interval, not update view so often when node is syncing.      - Try chart refresh when the wallet is synced. (furszy)
3c711ef [Trivial] transactionTableModel foreach using const variable instead of create a copy of the object. (furszy)
c07c9b3 [UI] NavMenu, app's version connected. (furszy)
1e0a347 [UI] - When clicking unlock/lock wallet, the password get edit text gets focused.      - Privacy screen, zPIV minting disabled. (furszy)
06ee910 [Trivial] Compiler warnings, not used variables. (furszy)
c812429 [GUI] Abstract background thread process flow created, dashboard chart load connected to it. (furszy)
b19cbaf [Revert] bad method name change reverted, debug console enter button was not recognized. (furszy)
8029464 [refactor] lowercase files (furszy)
30e7c1e [Refactor] * Capitalized PIVXGUI and AddressFilterProxyModel filenames renamed to lower case. * TransactionRecord initialization warning, size initialized after xxx, fixed. (furszy)
e40ea11 [UI] Forced reset to activate the settings options custom values connected. (furszy)
56074a2 [Helpers] Invalid conversion from ‘const char*’ to ‘uint {aka unsigned int}’ in some OSs standardized. (furszy)
4f6c6cb [Travis] qrencode no longer optional added to host x86_64-unknown-linux-gnu. (furszy)
07d5a6e testnet flag disabled (furszy)
dcbfe17 [Build][UI] Provisional move of the QTCharts library to optional dependency for local build. (furszy)
f23a8f9 [UI] Open uri dialog, invalid place holder text removed. (furszy)
bb1a743 [GUI] Cleanup build warnings (Cave Spectre)
85dc691 [GUI] Fix connectSlotsByName errors (Cave Spectre)
62e06f2 [UI] Wallet sync state, pending icon and style added to the transactionRecords with "Other" type. (furszy)
fb9b7e6 [GUI] welcome tutorial, typo fixed + privacy and MN text changed. (furszy)
3675f2e [GUI] * processNewTransaction method connected to dashboard screen, pushing a baloon notification when a new tx arrive to the wallet. (furszy)
6698d0b [GUI] Settings multiSend, request wallet unlock before add or delete any recipient. (furszy)
891f64d [GUI] Settings trailing spaces + minimize layout vertical expansion. (furszy)
d89de01 [Trivial] Cleanup UI compile warnings (Cave Spectre)
05594c8 [REFACTOR] Code refactor forced by #949. "Using namespaces" statement removed from the new GUI. (furszy)
b233081 [GUI] Settings multisend, list missing container style. (furszy)
57ca1b4 [GUI] Linux QComboBox listView items internal invalid focus square removed. (furszy)
9cb8f64 [GUI] Update coin control style when the theme changes. (furszy)
1d07968 [GUI] Hack to re paint the chart view for linux. The chart was not updating the screen even when the internal data was changed (qtchart 5.9 issue) (furszy)
680d2dd [GUI] notify user when the system doesn't have a predetermined text editor or navigator to open the file/folder. (furszy)
70dd159 [GUI] AskPassphraseDialog, missing opaque background on dialog popup added. (furszy)
9809f00 [GUI][Model] Masternodes screen, verify if masternode collateral tx was accepted before try to broadcast the create message. (furszy)
f3a6e2c [GUI] Dashboard screen, hide tx filters when the wallet doesn't have any transaction. (furszy)
d4bc144 [GUI] tx detail dialog closing delay solved + cleanup. (furszy)
3d54f90 [GUI][Model] Masternodes screen: * Get collateral tx status method and validation connected. * MN Controller port validation. * Delay closing dialog solved. (furszy)
eea027a [GUI][Model] Masternodes screen, export Masternode data for remote server setup functionality added and connected. (furszy)
1732ad3 [GUI] Dashboard screen: * filter transactions by type control and functionality added. * filter transactions by date and amount in descending and ascending order improved. (furszy)
79d131d [Model] isCoinStakeMine method validating against the tx input instead of the output. (furszy)
866415e [GUI] Send screen, total remaining label modified to show the coin control selected UTXO amount sum. (furszy)
0f80422 [GUI] dashboard staking chart, prevent series added twice. (furszy)
1ebb669 [Wallet][Model] Badly nStakeSplitThreshold set in optionsModel fixed + value moved to constant STAKE_SPLIT_THRESHOLD. (furszy)
9aa97f1 [GUI][Model] Settings options, mechanism to discard options that were not saved. (furszy)
8f935d1 [GUI] Contacts screen, update list view and empty screen when contacts are deleted. (furszy)
4a66dd1 [GUI] Master node screen improvements: * In-wallet FAQ MN controller explanation. * MN controller creation dialog data validation + code cleanup. * MN info code refactor + cleanup. (furszy)
0e8eff1 [Model][MasterNodes] Master node MISSING status added, only happens when the Master Node has been created on the controller side, added to the masternode.conf and not started.  It's not added to the vMasternodes list or any other network list, only lives locally on the masternodeConfig. (furszy)
78979f2 [GUI] FAQ rounded btns. (furszy)
ac69ee4 [Model] isTestnet method created, abstracting the UI from backend dependencies. (furszy)
239b599 [GUI][Model] Settings options reset. (furszy)
173a833 [GUI] open/close option button arrow icon connected. (furszy)
f855afc [GUI] Master nodes screen, FAQ opening MN section. (furszy)
365f9fe [GUI] settings display options show display unit fix, settings information show db version. (furszy)
1af2b07 [GUI] stake spin box range + settings console not returning values fixed. (furszy)
404059d [Trivial] Further small wording tweaks (Cave Spectre)
d4a7316 [GUI] Show dialog correct title +  MN show/hide screen checkbox removed. (furszy)
45cbe2c [Model] Only look for the creation time for internal addresses (furszy)
5850de0 [GUI] Settings information minor layout fix + code reorg and refactor using the setCssProperty method. (furszy)
6abfe3a [GUI] My address row set date if exists. (furszy)
c477e9b [Wallet][Model] GetKeyCreationTime moved from walletModel into the wallet object + addressTableModel new field for the address creation time. (furszy)
3c94867 [GUI] Request dialog storing address label + description text layout modified to not disappear for the padding. (furszy)
57a1b60 [Build] gitian-qt (furszy)
e3cbae3 [Doc] New dependencies for ubuntu QT build added. (furszy)
950524a [Trivial] PIVX license header. (furszy)
dad5c97 [UI] series removal not cleaning the charts pointer fix. (furszy)
0e5070e [Model] Invalid iterator position crash fix. (furszy)
387d83e [Build] qt missing-img-files, fixing rebase inserted issues. (furszy)
ed1515e [Build] travis new wallet dependencies added. (furszy)
911966b [Build] build system QT fixes + duplicated moc object fix. (furszy)
b9f6d43 [GUI] styling improvements, css class property set cleanup. (furszy)
7d2820e [GUI] payment request dropdown style fix. (furszy)
238e276 [REBASE] rebase fixes. (furszy)
1745fae [GUI] topbar lock, not perform any action if the wallet is already on the requested state. (furszy)
460489f [GUI] receive address padding overlapping text fix. (furszy)
2126b04 [GUI][Model] MultiSend functionality fully revamped and connected. (furszy)
65c93b0 [GUI] settings/tools bip38 decrypt connected. (furszy)
6825fab [GUI] Master nodes wizard input validations + code cleanup. (furszy)
639d14d [GUI] Master nodes wizard creation, only controller flow. (furszy)
f83ad71 [GUI] enabled/disabled editable status added. (furszy)
f4ce128 [GUI] send row hover style minor fix and smart fee update connected. (furszy)
db73d9e [GUI] Intro dialog minor corrections. (furszy)
db994e9 [GUI] Intro dialog new style finished. (furszy)
0b84005 Background and layout changed (Gregory Solarte)
7010862 Layout intro app changed (Gregory Solarte)
d217799 [GUI] Contacts screen, add contact -> notify about an already existent address. Minor duplicated methods refactored. (furszy)
1ba730d [Cleanup] Continuing with the final cleanup, setProperty methods moved to the new setCssProperty. (furszy)
b21956d [GUI] Minor layout corrections in custom fee dialog and tools sign message. (furszy)
fb70996 [GUI] Custom fee option connected on send screen. (furszy)
2b8ea8d [WalletModel] set wallet default fee method created. (furszy)
f7be74e [GUI] dashboard, update chart only with own stakes + cleanup. (furszy)
84668f5 [GUI] Default dialog visible when the screen is not visible. (furszy)
621198d Layout settings main changed, texto style added (Gregory Solarte)
336e3f9 [GUI] settings options re organization. (furszy)
afe44bc [GUI] About and commands dialog connected. (furszy)
014e2e6 [GUI] tx detail, title correction. (furszy)
f85d1f6 [GUI] settings duplicate option name changed. (furszy)
235e23d [GUI] settings options, re organization + code cleanup. (furszy)
7c7035b [GUI] settings widget, only one option checked at time. (furszy)
494afeb [GUI] askpassphrase dialog wrap title. (furszy)
cf59e12 [GUI] faq + multisend layout minor reorg (furszy)
bb19862 [GUI] Send screen, open URI from file connected. (furszy)
38ebf90 [GUI] settings tools sign/verify completed. (furszy)
661904c [GUI] settings wallet, multiSend layout organization improved. (furszy)
c762cc3 [GUI] settings tools, bip38 layout and encription. (furszy)
9e92e10 [GUI] MN wizard mode texts included. (furszy)
4c9a162 [GUI] settings widget layout improvements. (furszy)
5cebcfd [GUI] Sign/Verify flow fully connected. (furszy)
85ef032 [GUI] send screen, multi outputs validations (furszy)
2719ddf [GUI] Send, add new entry validation. (furszy)
97546ad [Cleanup] not used zpiv coin control dialog removed. (furszy)
e08cf3b [GUI] send screen, parse URI. (furszy)
3014d9b [GUI] payment request dialog open fix + copy URI connected. (furszy)
e386b66 [GUI] dashboard staking chart, change theme y axis color. (furszy)
e4d17b6 FAQ icon added (Gregory Solarte)
8824a19 [GUI] minor snackbar dialog delete. (furszy)
0d911df [GUI] Master node list update timer. (furszy)
b40d05d [GUI] Master nodes flow, MN info dialog created and connected. (furszy)
3610af1 [GUI] MN model, update list + get master node internal data. (furszy)
ebb43fb [GUI] openFaq method created. (furszy)
ec70fed [GUI] FAQ, MN description added. (furszy)
137aa2e [REBASE] rebase issues solved. (furszy)
5efbba2 [GUI] master nodes model and creation wizard. (furszy)
aeeef1c [Model] no swiftTx by default. (furszy)
dc24786 [GUI] dashboard change theme, staking graph fix. (furszy)
259e367 [GUI] verifyWalletUnlocked method implemented. (furszy)
53c199f [GUI] navmenu code better abstracted. (furszy)
9006da9 [GUI] receive address screen, change address label dialog text corrected. (furszy)
775053d [GUI] topbar lock btn open non perfect opening fixed. (furszy)
cf9f8e9 [GUI] master nodes screen, subtitle and MN info. (furszy)
8230a44 [GUI] Delete single master node implemented. (furszy)
42337ad [GUI] master nodes model + new screen implemented. (furszy)
6f1992b [GUI] tooltip texts generalized. (furszy)
14816c4 [GUI] MN screens ui coded (not connected) + pwidget constructor cleanup. (furszy)
d8335c4 Receive error fixed (Gregory Solarte)
1447ef0 [GUI] FAQ resizable. (furszy)
ac865b1 style dark mode style settings fixed (Gregory Solarte)
d031f68 [GUI] dashboard chart arrow style. (furszy)
d83b1b1 [GUI] layout reorg, duplicate arrow on comboBox fix. (furszy)
e2cd6c8 [GUI] dark theme invalid icons name fix. (furszy)
aaf98e5 Arrow back chart added (Gregory Solarte)
c5bc680 [GUI] chart sort by buttons expanded. (furszy)
39c5bbb layout chart, and style buttons changed (Gregory Solarte)
a22c487 [GUI] dashboard hasStakes method. (furszy)
d9e79be Chart buttons style changed (Gregory Solarte)
45d0471 [GUI] dashboard, only update chart when stakes arrive. (furszy)
059d39f [WalletModel] isCoinStake method added. (furszy)
4d5ff36 [Tx Model] tx arrive signal, tx hash added. (furszy)
d67df85 [GUI] dashboard staking chart, move chart position flow. (furszy)
9444e85 [GUI] dashboard, staking chart style margin fix. (furszy)
8aaf00f [GUI] chart sort and filter controls style improved. (furszy)
3ef02a9 style combo-secundary added, group title added (Gregory Solarte)
47520da [GUI] chart combobox rounded borders. (furszy)
c02499e style combobox chart changed (Gregory Solarte)
5ec1e79 Style chart added (Gregory Solarte)
37f2f44 [GUI] dashboard staking chart, year and month filters + chart logic. (furszy)
6f15b52 [WalletModel] wallet first key creation time method implemented. (furszy)
40f084c [Model] block zpiv mints from the ui. (furszy)
e1c1014 [GUI] contacts dropdown change theme. (furszy)
bccaebd [Deployment] fix bad link order. (furszy)
90f107d [GUI] hide multi outputs for zPIV spend + dashboard refresh chart on tx arrive. (furszy)
1f2e36a Style combobox settings changed (Gregory Solarte)
000b82c [GUI] openuridialog buttons style, code cleanup + encryptionStatus event connected. (furszy)
12e7906 Combobox arrow style and (Gregory Solarte)
014df06 [GUI] dashboard chart, days in months connected. (furszy)
c74e884 style changes (Gregory Solarte)
b1efc22 [GUI] dashboard chart re organization. (furszy)
98eab47 [GUI] win stake tx amount color fix. (furszy)
bdebe41 [GUI] comma char replaced thin space on html formatted balance. (furszy)
fd63c44 [GUI] privacy widget cleanup + no coin inputs notifications. (furszy)
676b48d [GUI] request dialog address not updated fix + layout reorg. (furszy)
c1446ba [GUI] empty view when no zc txes. (furszy)
ba8634d [GUI] Store size of zc txes. (furszy)
ac1cfb5 [GUI] styles fixed from a bad rebase. (furszy)
3032c83 [GUI] send confirmation dialog, not show outputs when there is only one. (furszy)
9d42541 [GUI] dashboard txes sort fixed. (furszy)
ec300f4 [GUI] request dialog layout organization + send layout change (furszy)
7ea6798 Style and layout changes (Gregory Solarte)
e8f1ea6 layout request changed (Gregory Solarte)
317b7be Layout space changes (Gregory Solarte)
8147fc2 Send layout changed (Gregory Solarte)
271d0f1 [GUI] welcome tutorial texts changed. (furszy)
68edadb [GUI] Address table model update amount of send/receive address. (furszy)
ed9702b [GUI] check if the wallet is unlocked to perform certain actions + UI cleanup. (furszy)
84ffada [Model] isWalletUnlocked method created. (furszy)
1bbf8c4 zPiv coincontrol layout changed (Gregory Solarte)
77462d8 Layout coincontrol changed (Gregory Solarte)
49fd73b [GUI] information and warning standard qt dialog in askpassphrasedialog changed for the new styled dialog. (furszy)
54a240b [GUI] loading text animation. (furszy)
a26563a [GUI] hide dialog on loading action. (furszy)
d11d1b7 [GUI] bip38 encrypt screen connected. (furszy)
a7b7041 [GUI] welcome tutorial go back between screens fixed (furszy)
213637d Send layout changed (Gregory Solarte)
d4a4c39 [GUI] QLineEdit selection color and background changed. (furszy)
72cb7cf [GUI] settings sign screen addresses dropdown connected. (furszy)
cefcd9f Sign layout changed (Gregory Solarte)
1599a40 [GUI] settings sign message connected. (furszy)
c6bb3db [GUI] dashboard stakes PIV chart color. (furszy)
d1a7107 [GUI] snackbar generalized + txDetailDialog copy id event connected. (furszy)
f1fa289 [GUI] txdetail dialog inputs organized in grid layout. (furszy)
7e40e4f Icon copy changed (Gregory Solarte)
465b055 Layout confirmation changed, copy button added (Gregory Solarte)
d60bfbb layout send changed (Gregory Solarte)
ca7d069 [GUI] coincontrol dialog ok button style. (furszy)
b4b0215 [GUI] tx detail dialog outputs connected. (furszy)
915ca4d Loading resources added (Gregory Solarte)
1927ca7 null chart change theme fix (furszy)
09e87cc tx detail, show inputs connected. (furszy)
0c18316 amount entry max range. (furszy)
c48a417 update send screen balance on every entry. (furszy)
4af6af8 backup screen, texts changed. (furszy)
766426f send screen, tooltip menu width and remove one by one entry fix (furszy)
ca834b0 create/update contact from the send multi screen fully functional. (furszy)
3b97499 transaction size calculation method created + connected to the tx record and GUI. (furszy)
1fef880 passphrase dialog edit line echo mode on click change fixed + dashboard text minor changes. (furszy)
2371229 wallet sync warning visible/invisible + minor UI modifications. (furszy)
b862f6a dashboard stakes chart connected (main logic left) (furszy)
1304c66 tx row, use tx model flow instead of direct access. (furszy)
c3455f9 console update theme (furszy)
1b0a804 qtcharts lib integrated. (furszy)
81d5a72 background loading crash fixed. (furszy)
316977a signal changeTheme name changed to not override parent slot (furszy)
c75ffb7 Icons darkmode added (Gregory Solarte)
e6efef9 Icons console changed (Gregory Solarte)
062403c Style dark changes (Gregory Solarte)
1605e65 wallet sync signal connected to dashboard warning, askkpassphrasedialog title changes on every action. (furszy)
4eb1ee5 dark mode improvements all over the UI. (furszy)
d5c592d coincontrol dark mode fixed (Gregory Solarte)
96915f8 style dark mode changed (Gregory Solarte)
f21fd8f privacy image added (Gregory Solarte)
13650d3 button show password (Gregory Solarte)
03e12d3 css style dark. (furszy)
cacce31 change theme, dark mode initial connection. (furszy)
229a59f move encrypt wallet to background task. (furszy)
196da4c loading dialog + runnable tasks object (furszy)
7eb575f topbar generalized to pwidget. (furszy)
bca6b66 loading dialog created. (furszy)
208ba52 topbar progress bar connected to sync widget. (furszy)
021a44d Progress sync added (Gregory Solarte)
3c7cde5 dashboard warning icon. (furszy)
4169e8a Layout warning changed (Gregory Solarte)
7aedcbf Layout changes, in main window, address and privacy view (Gregory Solarte)
384c028 send screen, contacts dropdown position on multi output fix (furszy)
4cec67e send multi outputs, tooltip menu + delete row connected. (furszy)
4bc2b59 status warninng sync dashboard added, warning layouts removed (Gregory Solarte)
602a692 tooltip menu generalization. (furszy)
a601eea Layout fixes in send, settings display and resources warning fixes (Gregory Solarte)
950ee47 pixelated pixmap icons fixed. (furszy)
ab61f2a dashboard unconfirmed row icon (furszy)
350b168 style options button changed (Gregory Solarte)
125888e coin control tree widget root decoration (furszy)
e4ba616 style and elements tree widget added (Gregory Solarte)
42edeff topbar icons connected to the backend. (furszy)
4a5531e coin control focus and alternate color removed. (furszy)
f949c66 style tree widget list changed (Gregory Solarte)
46480c4 Style changes, in coincontrol, tables, topbar, icon transactions inactive added (Gregory Solarte)
3f126ce dashboard inherit from correct abstract class now + uri dialog fix in send screen. (furszy)
f44878d Unconfirmed transactions status connected (style). (furszy)
a589c7d zpiv coin selection dialog connected to send screen + bad coupled code cleanup. (furszy)
24b9e64 UI Events abstraction, use inherited methods. (furszy)
7004a36 Style hover nav changed (Gregory Solarte)
501c21a Shadow dashboard hidden (Gregory Solarte)
636e729 message event, bool ret added. (furszy)
94cb4ff minor cleanup + shadow in empty view (furszy)
64f3272 Style check buttons changed, coincontrol buttons changed (Gregory Solarte)
e400e78 splash jpg image removed. (furszy)
ddb8be2 Dialog coin control style changed (Gregory Solarte)
0c17bb9 send confirm dialog signal not found fixed, askpassphrasedialog layout improvements. (furszy)
30f94f2 Splash and dialog layout changes (Gregory Solarte)
8ee0a98 send custom fee checkbox events. (furszy)
0c62a4d frameless splash. (furszy)
0cc8757 option button active visual indicator connected + splash progress indeterminate. (furszy)
9dee3da Show indicator method added (Gregory Solarte)
218bbfd Active button style added (Gregory Solarte)
891cb10 layout and style changes (Gregory Solarte)
eddfb3c splash ui + settingsDisplayOption ui layout modifications. (furszy)
d966c79 tx holder, row index invalid data fix (furszy)
cb8eefe format balance moved to GUIUtils + privacy widget zPIV wallet supply connected. (furszy)
7a52d81 zPIV balance name modified. (furszy)
80fb254 label completion by known address input. (furszy)
6f5db73 editLine style initialization + minor cleanup. (furszy)
a44b563 qtutils, init editline + shadow method created. (furszy)
b82802f expandable button cleanup (furszy)
205fd25 zpiv spend, change address added. (furszy)
f0c1df6 privacy widget reset mint and reset spends connected. (furszy)
31a5676 jpg images removed (furszy)
c9aa953 UI default text payment request and change address changed + address filter row count method. (furszy)
5d6ecc3 key creation time connected. (furszy)
9698481 get address/key creation time method. (furszy)
b213f21 dashboard sort tx by amount or date. (furszy)
9509843 splash centered. (furszy)
e61ae7b receive widget, address label added. (furszy)
05ac15b layout settings changed (Gregory Solarte)
ad16c43 settings options connected. (furszy)
de1ebed Styles improvements. (furszy)
8daf7a4 wallet backup and change passphrase connected. (furszy)
566ccb2 dialog and opaque background signal. (furszy)
b49199c askkpassphrase dialog new style (furszy)
7d979bc tx detail dialog 85% connected to send screen and dashboard. (furszy)
8a84ff8 getWalletTx for tx detail dialog usage. (furszy)
c611aac zPIV balance. (furszy)
d66ce59 transaction status to string method (furszy)
efd50a8 zPIV name added (furszy)
3195ea5 settings options main screen connected. (furszy)
bc9f146 settings not used screens cleanup + network monitor connected. (furszy)
8bf42a0 css util methods (furszy)
a7d0585 send view, coin control style + integrated. (furszy)
8530a32 welcome walkthrough dialog (furszy)
9fdc841 new splash screen connected. (furszy)
85478f4 snack info message signal (furszy)
dacdefc qt signaling cleanup (furszy)
66f7dad settings backup screen connected. (furszy)
ad32ef7 signal events abstraction. (furszy)
5f48f0e settings information screen connected (furszy)
56186fe settings wallet repair screen connected. (furszy)
6b048ec primary button style. (furszy)
9e03158 nav + console shortcuts (furszy)
a269970 console widget connected (furszy)
f1af623 privacy widget update action btn text (furszy)
aa76c5d window min size fix (furszy)
c4c85b7 send widget, contacts dropdown and change address features connected (furszy)
e623a1e change address dialog connected (furszy)
c81130a send widget refresh view, zpiv tx error flow - wallet model create multi output zpiv tx (furszy)
d72487b refresh receive address view (furszy)
54d977d zerocoin spend flow improved, multi outputs accepted (furszy)
2f014dd removing old cached tx (furszy)
db5f73c connect edit contact label (furszy)
c50ce41 send tx segfault fix + minor cleanup on sendCoins method (furszy)
15c2a1f addresses widget tooltip menu actions (furszy)
47d29ce fuzz svg lib fix :) (furszy)
7ffe383 more around svg (furszy)
26e5342 qt.mk (furszy)
fb1524e svg support (furszy)
e1300c5 QModelIndex siblingAtColumn method not supported in qt 5.9.7 fix (furszy)
7d66f9a convert back zPIV method created + connected to privacy view. (furszy)
9cdd54c privacy view, spork blocking mint + display unit (furszy)
77c057e privacy widget mint connected + send minor cleanup (furszy)
4a56f6b mint zerocoin method created (furszy)
8271396 request unlock method created (furszy)
40a2686 send confirmation connected (furszy)
7d25fff stake piv icon and row + receivewidget minor ui fix (furszy)
7734745 tx filtering, addresses filtering, topbar crash fix (furszy)
ae77d76 dashboard + some minor improvements (furszy)
6ae1bdb empty screens dashboard (furszy)
ff62829 lock/unlock/encrypt wallet + contacts widget (furszy)
b28be2d empty views + qr color (furszy)
abd96c9 payment request connected + getNewAddress method on module (furszy)
4b1e126 sendWidget improvements and some abstractions (furszy)
846ce88 more changes on sendwidget (furszy)
a6328fc send screen more connections (furszy)
c2109e9 subscribe to core signals + screen events (furszy)
46ca9e7 send quarter connected (furszy)
0fe625d url to image changed (furszy)
dd35979 snackbar message (furszy)
e8f7960 add label dialog (furszy)
b9f04aa my addresses list (furszy)
b0b3f15 receive dialog (furszy)
e79733b receive widget - address connected (furszy)
f52e36e message from backend added without further polish + automint button status update event (furszy)
93f778a sync topbar update (furszy)
cfcd07d connection topbar button connected -- icon left (furszy)
ae21097 tx row changes + number format (furszy)
e47f149 dashboard txes icons (furszy)
98d84f8 dashboard tx list included in a good degree (furszy)
498d890 balance connected (furszy)
6652469 shortcuts (furszy)
6006eff update from remote (furszy)
54ca539 settings integrated (furszy)
31ec47b privacy added (furszy)
ae29517 op background added (furszy)
1ece07d addresses widget + dependencies (furszy)
2117d29 receive address widget + dependencies + snackbar (furszy)
a85ccb5 send screen + dependencies (furszy)
412185b dashboard tx list and abstract rows integrated (furszy)
0de1f89 style changes (furszy)
49703f6 topbar integrated (furszy)
9e40ba7 initial new gui work, nav (furszy)

Pull request description:

  This PR encompasses the past 5 months of extensive work toward a brand new wallet.

  Starting from the entire creation of a brand new UI / UX flow for the wallet as a whole, and for every current available feature, to the addition of new functionalities (front-end and back-end) were made to be in-line with the wallet that was envisioned in the design phase.

  This new wallet was designed by [Krubit](http://krubit.com), UI / UX professional designers and front-end developers that worked side by side with me in this long adventure.

  Thanks to everyone that have been part of it, especially the PIVX governance system, and private investors for making this possible.

  A walkthrough video of the new wallet running can be found here: [LINK](https://youtu.be/qEt6i_baHRM)

  ------------------------

  PR Release Notes

  *New splash screen.
  *Intro screen revamped.

  *New initial wallet setup walkthrough tutorial wizard!
  *Language selection.

  *New Dashboard screen!
   - New transactions list.
   - One click receive QR address.
   - Wallet balances always visible in the top bar.

  *New stakes chart!
  - A brand new chart that let you know how many stakes were received in the past year, month, days!
  - Easy single click operation.

  *New top status bar!
   - Important information organized at the top of your wallet, always visible and updated in real-time.
   - New wallet lock/unlock dialog.

  *Two brand new themes supported!
   - Dark and White theme!!

  *Newly designed Send screen!
   - PIV/zPIV supported on the same screen.
   - Multi-outputs, remaining balance, total balance.
   - Parse PIVX URI & Payment Request.
   - Custom transaction options!
   - Autocomplete send to address with contacts.
   - Autocomplete URI in "send to" editable box.

  *Newly designed Receive screen!
   - Create PIVX URI & Payment request wizard. Easy payment request creation.
   - My address QR always visible.
   - Set and modify the address label.
   - Create new addresses on-demand.
   - My addresses list information lot more understandable (creation date included).
   - Single click copy/edit addresses.

  *New Contacts screen!
   - Create contacts and don't forget who sent you money, storing an address and label for them.
   - Copy, edit and delete contacts visually.
   - Every editable box address input contains a contacts auto-completable dialog.

  *New Privacy screen!
   - Mint and Convert PIV to zPIV on the same screen.
   - View your past mints and conversions in an organized list.
   - Select the coin inputs.
   - See zPIV denominations.

  *New Master Nodes screen!
   - New Master Nodes list view.
   - New Master Nodes creation wizard! (Controller creation wizard dialog).
   - Start, edit, delete master node from a single click!.
   - Export master node for remote setup.
   - Master nodes in-wallet FAQ.

  *New Settings screen!
   - All of the previous functions have been better organized and improved on the UI.
   - In-Wallet FAQ covering most commonly asked topics.
   - BIP38 encrypt and decrypt addresses flow revamped.
   - MultiSend flow revamped. Now much more visually understandable.
   - Easy Sign/Verify messages.
   - Wallet options layout improved.

  *New Notifications
   - New snackbar (popup) notification.
   - New default dialogs.

  ------------------------

  Pending work (Not forget):

  *Remove old UI code that it's not used anymore (can be done in a subsequent PR, this one is really big).
  *Update build docs.
  *Continue cleaning the PR.

ACKs for top commit:
  Fuzzbawls:
    ACK ca046aa
  random-zebra:
    ACK ca046aa

Tree-SHA512: 54f622bd598e7ac08412c28e6bdd0e6cb5f4f293d4e3dc9cf24aa56306b485185e14c777c7894dd21cf9f384d7a17f1499be59ac6217553c632086034be53d4b
@random-zebra random-zebra merged commit ca046aa into PIVX-Project:master Sep 10, 2019
furszy added a commit that referenced this pull request Oct 23, 2019
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra)
255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra)
3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra)
244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra)
620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra)
6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra)
80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy)
bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy)
436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra)
b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra)
16fa605 [RPC] define liststakingaddresses (random-zebra)
23ecdee [RPC] define listdelegators (random-zebra)
2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra)
b20bc52 [RPC] define getdelegatedbalance (random-zebra)
d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra)
f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra)
87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra)
5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra)
968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra)
4000b6e [RPC] Define listcoldutxos function (random-zebra)
f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra)
5383f52 [Fix] MintableCoins include cold staking balance (random-zebra)
7ce9432 [Tests] Fix coldstaking functional test (random-zebra)
618afdb [Tests] Additional case for Cold Staking functional test (random-zebra)
75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra)
2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra)
e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra)
f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra)
9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra)
61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra)
0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra)
374a78c [Tests] Fix Script UnitTests data (random-zebra)
c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra)
6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra)
ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra)
6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra)
c5de40f [Cleanup] Fix linter (random-zebra)
1d071f4 [Tests] Add Cold Staking functional testing (random-zebra)
8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra)
8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra)
4064423 [Consensus] ColdStaking enforcement (random-zebra)
1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra)
bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra)
e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra)
92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra)
661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra)
f30c299 [Wallet] Use cold inputs to stake (random-zebra)
cdb758b [RPC] define getcoldstakingbalance (random-zebra)
8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra)
e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra)
ca90d02 [Script] Sign P2CS scripts (random-zebra)
dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra)
e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra)
97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra)
b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra)
f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra)
c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra)
6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra)
0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra)

Pull request description:

  Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.

  Closes #579.

  The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (#954).
  The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.

  Enforcement activation height uses placeholder values for now.

  Notable changes:
  - [Core]
     * Definition of the new type of address `STAKING_ADDRESS`.
     * Definition of a new standard transaction type `TX_COLDSTAKE`.
     * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input.
     * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).
     * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too.
     * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test.
     * Definition of threshold value for cold staking outputs

  - [Script]
     * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY`
     * Definition of the output script `P2CS`
     * Definition of a fast test to recognize P2CS scripts by checking only few bytes.
     * Definition of the input scriptSig to spend P2CS scriptPubKey outputs
     * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts.

  - [Wallet]
     * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`.
     * Introduction of the concepts of "delegated" and "cold" balance (debit and credit)
     * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations.
     * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection.
     * Inclusion of delegated coins in `SelectStakeCoins` for cold staking.
     * Addition of the delegator whitelisting check in `AvailableCoins`.

  - [RPC]
     * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`.
     * Definition of new method `getnewstakingaddress` to generate a new staking address.
     * Definition of new method `delegatestake` to send a stake delegation transaction
     * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it
     * Prevent the use of staking addresses as recipients in `sendtoaddress`.
     * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet.
     * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`.
     * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.
     * Definition of new method `delegatoradd` to whitelist an owner address for cold staking.
     * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`.
     * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker).
     * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet.
     * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet.

  - [Tests]
     * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner.

  - [Misc/Clenup]
     * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp
     * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier.

ACKs for top commit:
  Fuzzbawls:
    ACK e498a06
  furszy:
    ACK e498a06

Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
akshaynexus added a commit to dogecash/dogecash-old that referenced this pull request Oct 23, 2019
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra)
255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra)
3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra)
244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra)
620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra)
6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra)
80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy)
bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy)
436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra)
b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra)
16fa605 [RPC] define liststakingaddresses (random-zebra)
23ecdee [RPC] define listdelegators (random-zebra)
2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra)
b20bc52 [RPC] define getdelegatedbalance (random-zebra)
d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra)
f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra)
87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra)
5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra)
968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra)
4000b6e [RPC] Define listcoldutxos function (random-zebra)
f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra)
5383f52 [Fix] MintableCoins include cold staking balance (random-zebra)
7ce9432 [Tests] Fix coldstaking functional test (random-zebra)
618afdb [Tests] Additional case for Cold Staking functional test (random-zebra)
75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra)
2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra)
e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra)
f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra)
9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra)
61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra)
0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra)
374a78c [Tests] Fix Script UnitTests data (random-zebra)
c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra)
6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra)
ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra)
6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra)
c5de40f [Cleanup] Fix linter (random-zebra)
1d071f4 [Tests] Add Cold Staking functional testing (random-zebra)
8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra)
8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra)
4064423 [Consensus] ColdStaking enforcement (random-zebra)
1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra)
bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra)
e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra)
92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra)
661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra)
f30c299 [Wallet] Use cold inputs to stake (random-zebra)
cdb758b [RPC] define getcoldstakingbalance (random-zebra)
8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra)
e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra)
ca90d02 [Script] Sign P2CS scripts (random-zebra)
dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra)
e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra)
97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra)
b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra)
f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra)
c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra)
6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra)
0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra)

Pull request description:

  Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.

  Closes PIVX-Project/PIVX#579.

  The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (PIVX-Project/PIVX#954).
  The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.

  Enforcement activation height uses placeholder values for now.

  Notable changes:
  - [Core]
     * Definition of the new type of address `STAKING_ADDRESS`.
     * Definition of a new standard transaction type `TX_COLDSTAKE`.
     * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input.
     * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).
     * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too.
     * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test.
     * Definition of threshold value for cold staking outputs

  - [Script]
     * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY`
     * Definition of the output script `P2CS`
     * Definition of a fast test to recognize P2CS scripts by checking only few bytes.
     * Definition of the input scriptSig to spend P2CS scriptPubKey outputs
     * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts.

  - [Wallet]
     * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`.
     * Introduction of the concepts of "delegated" and "cold" balance (debit and credit)
     * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations.
     * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection.
     * Inclusion of delegated coins in `SelectStakeCoins` for cold staking.
     * Addition of the delegator whitelisting check in `AvailableCoins`.

  - [RPC]
     * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`.
     * Definition of new method `getnewstakingaddress` to generate a new staking address.
     * Definition of new method `delegatestake` to send a stake delegation transaction
     * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it
     * Prevent the use of staking addresses as recipients in `sendtoaddress`.
     * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet.
     * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`.
     * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.
     * Definition of new method `delegatoradd` to whitelist an owner address for cold staking.
     * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`.
     * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker).
     * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet.
     * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet.

  - [Tests]
     * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner.

  - [Misc/Clenup]
     * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp
     * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier.

ACKs for top commit:
  Fuzzbawls:
    ACK e498a06
  furszy:
    ACK e498a06

Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
akshaynexus pushed a commit to dogecash/dogecash-old that referenced this pull request Oct 26, 2019
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra)
255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra)
3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra)
244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra)
620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra)
6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra)
80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy)
bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy)
436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra)
b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra)
16fa605 [RPC] define liststakingaddresses (random-zebra)
23ecdee [RPC] define listdelegators (random-zebra)
2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra)
b20bc52 [RPC] define getdelegatedbalance (random-zebra)
d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra)
f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra)
87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra)
5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra)
968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra)
4000b6e [RPC] Define listcoldutxos function (random-zebra)
f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra)
5383f52 [Fix] MintableCoins include cold staking balance (random-zebra)
7ce9432 [Tests] Fix coldstaking functional test (random-zebra)
618afdb [Tests] Additional case for Cold Staking functional test (random-zebra)
75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra)
2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra)
e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra)
f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra)
9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra)
61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra)
0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra)
374a78c [Tests] Fix Script UnitTests data (random-zebra)
c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra)
6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra)
ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra)
6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra)
c5de40f [Cleanup] Fix linter (random-zebra)
1d071f4 [Tests] Add Cold Staking functional testing (random-zebra)
8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra)
8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra)
4064423 [Consensus] ColdStaking enforcement (random-zebra)
1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra)
bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra)
e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra)
92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra)
661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra)
f30c299 [Wallet] Use cold inputs to stake (random-zebra)
cdb758b [RPC] define getcoldstakingbalance (random-zebra)
8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra)
e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra)
ca90d02 [Script] Sign P2CS scripts (random-zebra)
dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra)
e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra)
97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra)
b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra)
f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra)
c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra)
6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra)
0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra)

Pull request description:

  Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.

  Closes PIVX-Project/PIVX#579.

  The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (PIVX-Project/PIVX#954).
  The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.

  Enforcement activation height uses placeholder values for now.

  Notable changes:
  - [Core]
     * Definition of the new type of address `STAKING_ADDRESS`.
     * Definition of a new standard transaction type `TX_COLDSTAKE`.
     * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input.
     * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).
     * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too.
     * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test.
     * Definition of threshold value for cold staking outputs

  - [Script]
     * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY`
     * Definition of the output script `P2CS`
     * Definition of a fast test to recognize P2CS scripts by checking only few bytes.
     * Definition of the input scriptSig to spend P2CS scriptPubKey outputs
     * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts.

  - [Wallet]
     * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`.
     * Introduction of the concepts of "delegated" and "cold" balance (debit and credit)
     * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations.
     * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection.
     * Inclusion of delegated coins in `SelectStakeCoins` for cold staking.
     * Addition of the delegator whitelisting check in `AvailableCoins`.

  - [RPC]
     * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`.
     * Definition of new method `getnewstakingaddress` to generate a new staking address.
     * Definition of new method `delegatestake` to send a stake delegation transaction
     * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it
     * Prevent the use of staking addresses as recipients in `sendtoaddress`.
     * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet.
     * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`.
     * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.
     * Definition of new method `delegatoradd` to whitelist an owner address for cold staking.
     * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`.
     * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker).
     * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet.
     * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet.

  - [Tests]
     * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner.

  - [Misc/Clenup]
     * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp
     * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier.

ACKs for top commit:
  Fuzzbawls:
    ACK e498a06
  furszy:
    ACK e498a06

Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
Add nStakeModifierV2 changes
akshaynexus added a commit to dogecash/dogecash-old that referenced this pull request Oct 29, 2019
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra)
255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra)
3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra)
244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra)
620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra)
6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra)
80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy)
bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy)
436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra)
b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra)
16fa605 [RPC] define liststakingaddresses (random-zebra)
23ecdee [RPC] define listdelegators (random-zebra)
2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra)
b20bc52 [RPC] define getdelegatedbalance (random-zebra)
d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra)
f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra)
87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra)
5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra)
968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra)
4000b6e [RPC] Define listcoldutxos function (random-zebra)
f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra)
5383f52 [Fix] MintableCoins include cold staking balance (random-zebra)
7ce9432 [Tests] Fix coldstaking functional test (random-zebra)
618afdb [Tests] Additional case for Cold Staking functional test (random-zebra)
75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra)
2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra)
e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra)
f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra)
9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra)
61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra)
0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra)
374a78c [Tests] Fix Script UnitTests data (random-zebra)
c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra)
6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra)
ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra)
6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra)
c5de40f [Cleanup] Fix linter (random-zebra)
1d071f4 [Tests] Add Cold Staking functional testing (random-zebra)
8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra)
8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra)
4064423 [Consensus] ColdStaking enforcement (random-zebra)
1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra)
bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra)
e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra)
92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra)
661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra)
f30c299 [Wallet] Use cold inputs to stake (random-zebra)
cdb758b [RPC] define getcoldstakingbalance (random-zebra)
8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra)
e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra)
ca90d02 [Script] Sign P2CS scripts (random-zebra)
dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra)
e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra)
97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra)
b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra)
f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra)
c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra)
6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra)
0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra)

Pull request description:

  Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.

  Closes PIVX-Project/PIVX#579.

  The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (PIVX-Project/PIVX#954).
  The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.

  Enforcement activation height uses placeholder values for now.

  Notable changes:
  - [Core]
     * Definition of the new type of address `STAKING_ADDRESS`.
     * Definition of a new standard transaction type `TX_COLDSTAKE`.
     * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input.
     * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).
     * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too.
     * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test.
     * Definition of threshold value for cold staking outputs

  - [Script]
     * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY`
     * Definition of the output script `P2CS`
     * Definition of a fast test to recognize P2CS scripts by checking only few bytes.
     * Definition of the input scriptSig to spend P2CS scriptPubKey outputs
     * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts.

  - [Wallet]
     * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`.
     * Introduction of the concepts of "delegated" and "cold" balance (debit and credit)
     * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations.
     * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection.
     * Inclusion of delegated coins in `SelectStakeCoins` for cold staking.
     * Addition of the delegator whitelisting check in `AvailableCoins`.

  - [RPC]
     * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`.
     * Definition of new method `getnewstakingaddress` to generate a new staking address.
     * Definition of new method `delegatestake` to send a stake delegation transaction
     * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it
     * Prevent the use of staking addresses as recipients in `sendtoaddress`.
     * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet.
     * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`.
     * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.
     * Definition of new method `delegatoradd` to whitelist an owner address for cold staking.
     * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`.
     * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker).
     * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet.
     * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet.

  - [Tests]
     * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner.

  - [Misc/Clenup]
     * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp
     * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier.

ACKs for top commit:
  Fuzzbawls:
    ACK e498a06
  furszy:
    ACK e498a06

Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
akshaynexus added a commit to dogecash/dogecash-old that referenced this pull request Oct 30, 2019
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra)
255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra)
3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra)
244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra)
620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra)
6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra)
80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy)
bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy)
436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra)
b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra)
16fa605 [RPC] define liststakingaddresses (random-zebra)
23ecdee [RPC] define listdelegators (random-zebra)
2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra)
b20bc52 [RPC] define getdelegatedbalance (random-zebra)
d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra)
f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra)
87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra)
5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra)
968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra)
4000b6e [RPC] Define listcoldutxos function (random-zebra)
f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra)
5383f52 [Fix] MintableCoins include cold staking balance (random-zebra)
7ce9432 [Tests] Fix coldstaking functional test (random-zebra)
618afdb [Tests] Additional case for Cold Staking functional test (random-zebra)
75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra)
2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra)
e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra)
f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra)
9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra)
61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra)
0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra)
374a78c [Tests] Fix Script UnitTests data (random-zebra)
c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra)
6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra)
ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra)
6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra)
c5de40f [Cleanup] Fix linter (random-zebra)
1d071f4 [Tests] Add Cold Staking functional testing (random-zebra)
8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra)
8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra)
4064423 [Consensus] ColdStaking enforcement (random-zebra)
1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra)
bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra)
e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra)
92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra)
661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra)
f30c299 [Wallet] Use cold inputs to stake (random-zebra)
cdb758b [RPC] define getcoldstakingbalance (random-zebra)
8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra)
e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra)
ca90d02 [Script] Sign P2CS scripts (random-zebra)
dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra)
e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra)
97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra)
b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra)
f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra)
c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra)
6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra)
0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra)

Pull request description:

  Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.

  Closes PIVX-Project/PIVX#579.

  The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (PIVX-Project/PIVX#954).
  The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.

  Enforcement activation height uses placeholder values for now.

  Notable changes:
  - [Core]
     * Definition of the new type of address `STAKING_ADDRESS`.
     * Definition of a new standard transaction type `TX_COLDSTAKE`.
     * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input.
     * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).
     * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too.
     * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test.
     * Definition of threshold value for cold staking outputs

  - [Script]
     * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY`
     * Definition of the output script `P2CS`
     * Definition of a fast test to recognize P2CS scripts by checking only few bytes.
     * Definition of the input scriptSig to spend P2CS scriptPubKey outputs
     * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts.

  - [Wallet]
     * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`.
     * Introduction of the concepts of "delegated" and "cold" balance (debit and credit)
     * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations.
     * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection.
     * Inclusion of delegated coins in `SelectStakeCoins` for cold staking.
     * Addition of the delegator whitelisting check in `AvailableCoins`.

  - [RPC]
     * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`.
     * Definition of new method `getnewstakingaddress` to generate a new staking address.
     * Definition of new method `delegatestake` to send a stake delegation transaction
     * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it
     * Prevent the use of staking addresses as recipients in `sendtoaddress`.
     * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet.
     * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`.
     * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.
     * Definition of new method `delegatoradd` to whitelist an owner address for cold staking.
     * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`.
     * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker).
     * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet.
     * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet.

  - [Tests]
     * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner.

  - [Misc/Clenup]
     * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp
     * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier.

ACKs for top commit:
  Fuzzbawls:
    ACK e498a06
  furszy:
    ACK e498a06

Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
akshaynexus added a commit to dogecash/dogecash-old that referenced this pull request Nov 3, 2019
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra)
255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra)
3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra)
244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra)
620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra)
6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra)
80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy)
bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy)
436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra)
b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra)
16fa605 [RPC] define liststakingaddresses (random-zebra)
23ecdee [RPC] define listdelegators (random-zebra)
2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra)
b20bc52 [RPC] define getdelegatedbalance (random-zebra)
d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra)
f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra)
87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra)
5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra)
968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra)
4000b6e [RPC] Define listcoldutxos function (random-zebra)
f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra)
5383f52 [Fix] MintableCoins include cold staking balance (random-zebra)
7ce9432 [Tests] Fix coldstaking functional test (random-zebra)
618afdb [Tests] Additional case for Cold Staking functional test (random-zebra)
75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra)
2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra)
e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra)
f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra)
9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra)
61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra)
0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra)
374a78c [Tests] Fix Script UnitTests data (random-zebra)
c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra)
6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra)
ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra)
6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra)
c5de40f [Cleanup] Fix linter (random-zebra)
1d071f4 [Tests] Add Cold Staking functional testing (random-zebra)
8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra)
8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra)
4064423 [Consensus] ColdStaking enforcement (random-zebra)
1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra)
bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra)
e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra)
92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra)
661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra)
f30c299 [Wallet] Use cold inputs to stake (random-zebra)
cdb758b [RPC] define getcoldstakingbalance (random-zebra)
8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra)
e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra)
ca90d02 [Script] Sign P2CS scripts (random-zebra)
dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra)
e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra)
97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra)
b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra)
f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra)
c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra)
6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra)
0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra)

Pull request description:

  Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.

  Closes PIVX-Project/PIVX#579.

  The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (PIVX-Project/PIVX#954).
  The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.

  Enforcement activation height uses placeholder values for now.

  Notable changes:
  - [Core]
     * Definition of the new type of address `STAKING_ADDRESS`.
     * Definition of a new standard transaction type `TX_COLDSTAKE`.
     * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input.
     * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).
     * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too.
     * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test.
     * Definition of threshold value for cold staking outputs

  - [Script]
     * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY`
     * Definition of the output script `P2CS`
     * Definition of a fast test to recognize P2CS scripts by checking only few bytes.
     * Definition of the input scriptSig to spend P2CS scriptPubKey outputs
     * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts.

  - [Wallet]
     * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`.
     * Introduction of the concepts of "delegated" and "cold" balance (debit and credit)
     * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations.
     * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection.
     * Inclusion of delegated coins in `SelectStakeCoins` for cold staking.
     * Addition of the delegator whitelisting check in `AvailableCoins`.

  - [RPC]
     * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`.
     * Definition of new method `getnewstakingaddress` to generate a new staking address.
     * Definition of new method `delegatestake` to send a stake delegation transaction
     * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it
     * Prevent the use of staking addresses as recipients in `sendtoaddress`.
     * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet.
     * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`.
     * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.
     * Definition of new method `delegatoradd` to whitelist an owner address for cold staking.
     * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`.
     * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker).
     * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet.
     * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet.

  - [Tests]
     * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner.

  - [Misc/Clenup]
     * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp
     * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier.

ACKs for top commit:
  Fuzzbawls:
    ACK e498a06
  furszy:
    ACK e498a06

Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
akshaynexus added a commit to dogecash/dogecash-old that referenced this pull request Nov 4, 2019
e498a06 [Core] Cold Staking: lower dust threshold to 1 PIV (random-zebra)
255d757 [Core] Add CheckColdStakeFreeOutput function (random-zebra)
3bfc380 [Tests] Speed up feature_coldStaking + check 'listcoldutxos' (random-zebra)
244feca [Wallet] Fix spending P2CS delegations with coin control (random-zebra)
620bc19 [Bug] Fix isMine type in GetColdStakingDebit (random-zebra)
6cadfea [Wallet] Add fStakeDelegation voided in-memory flag (random-zebra)
80678b7 [Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount method. (furszy)
bf27e84 [Wallet] Stop duplicating cached amount update. Single method doing it instead of 3 doing exactly the same. (furszy)
436f383 [Wallet] Add fUnspent flag to GetCredit (random-zebra)
b33c6bc [Wallet] define GetColdStakingDebit and GetStakeDelegationDebit (random-zebra)
16fa605 [RPC] define liststakingaddresses (random-zebra)
23ecdee [RPC] define listdelegators (random-zebra)
2f246d2 [Wallet] fix IsValid and validateaddress for Staking Addresses (random-zebra)
b20bc52 [RPC] define getdelegatedbalance (random-zebra)
d81ecdc [Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled (random-zebra)
f7f7119 [Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan (random-zebra)
87327fc [RPC] listcoldutxos: include only final, trusted, unspent coins (random-zebra)
5209c3f [DB] Fix unserialization check for cold staking txes (random-zebra)
968931e [RPC] listcoldutxos: fix staking addresses base58 prefix (random-zebra)
4000b6e [RPC] Define listcoldutxos function (random-zebra)
f771f86 [Trivial] define GetSakingBalance and update it in miner (random-zebra)
5383f52 [Fix] MintableCoins include cold staking balance (random-zebra)
7ce9432 [Tests] Fix coldstaking functional test (random-zebra)
618afdb [Tests] Additional case for Cold Staking functional test (random-zebra)
75b8861 [Script] Unify OP_CHECKCOLDSTAKEVERIFY checks (random-zebra)
2a5bae7 [Script] Guard against GetPubKey() failures in Solver() (random-zebra)
e67c152 [Cleanup] minor styling in standard.cpp and remove fStakeDelegationVoided in wallet (random-zebra)
f20e1a6 [RPC] CreateColdStakeDelegation move checks before creating address (random-zebra)
9c8a656 [Wallet] Speed up ColdStaking and Delegated balance computation (random-zebra)
61e9d6e [Consensus] Fix output index in CheckColdStake() (random-zebra)
0f09fce [Core] Init CBitcoinAddress and Visitor with base58 prefix instead of bool flag (random-zebra)
374a78c [Tests] Fix Script UnitTests data (random-zebra)
c723ab6 [Core] Add threshold for P2CS value (hardcoded to 10 PIV) (random-zebra)
6e28ec1 [Core] prevent abuse on mn output when spork 8 is disabled (random-zebra)
ad6bee1 [Wallet][DB] Refactor Delegator whitelist as AddressBook entry (random-zebra)
6c1d399 [Trivial] Fix spelling in delegatorremove RPC help (random-zebra)
c5de40f [Cleanup] Fix linter (random-zebra)
1d071f4 [Tests] Add Cold Staking functional testing (random-zebra)
8b56c33 [RPC] define: delegatoradd, delegatorremove (random-zebra)
8bc0893 [Wallet/DB] Add Delegators-whitelist protection for cold staker (random-zebra)
4064423 [Consensus] ColdStaking enforcement (random-zebra)
1d69ef3 [Wallet] Add -coldstaking flag to enable/disable feature (random-zebra)
bff6c9e [RPC] signrawtransaction: select proper key for 'cold' inputs (random-zebra)
e546ec6 [Core][Tests] REGTEST: fix nStakeModifier (random-zebra)
92515c3 [Core] add main P2CS check in CheckTransaction (random-zebra)
661083d [Core] Sign block with staking key if coinstake is 'cold' stake (random-zebra)
f30c299 [Wallet] Use cold inputs to stake (random-zebra)
cdb758b [RPC] define getcoldstakingbalance (random-zebra)
8ac0ed3 [Script] Add fColdStake to ExtractDestination (random-zebra)
e19bfa4 [Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent (random-zebra)
ca90d02 [Script] Sign P2CS scripts (random-zebra)
dea30c7 [Script] Define IsPayToColdStaking() fast test (random-zebra)
e8abd21 [Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump (random-zebra)
97b6332 [RPC/Wallet] fix IsMine filters and add option to include delegated balance in calls (random-zebra)
b709748 [RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake (random-zebra)
f6bba23 [Wallet] Get ColdStaking/Delegated balance (random-zebra)
c7d1934 [Core] define TX_COLDSTAKE standard and P2CS script (random-zebra)
6ec51f4 [Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour (random-zebra)
0fb6ca1 [Core] Define STAKING_ADDRESS addresses (random-zebra)

Pull request description:

  Implements the "Cold Staking" system described in https://github.com/random-zebra/PIVX-Wiki/blob/master/Developer-Documentation/Specs/ColdStaking.mediawiki.

  Closes PIVX-Project/PIVX#579.

  The current changeset does not include any edit to the GUI, as it is being redesigned for v4.0.0 (PIVX-Project/PIVX#954).
  The controls for cold staking will be added to the new interface in a separate PR if this upgrade is approved.

  Enforcement activation height uses placeholder values for now.

  Notable changes:
  - [Core]
     * Definition of the new type of address `STAKING_ADDRESS`.
     * Definition of a new standard transaction type `TX_COLDSTAKE`.
     * Block signature/validation change: sign blocks with the staker private key, verify the signature extracting the public key from the coinstake input.
     * Addition of `CheckColdStake` function, called by `CheckTransaction`, to check for the rules not verified by the script evaluation (equivalence of input and output scripts).
     * Addition of `-coldstaking` startup flag to disable cold staking while keeping hot staking enabled (if `-staking=1`). If `-staking=0` then `-coldstaking` is automatically set to `0` too.
     * Definition of placeholders for the activation block height: `2880000` for main net, `2106100`for test net, `251` for reg test.
     * Definition of threshold value for cold staking outputs

  - [Script]
     * Definition of a new opcode `OP_CHECKCOLDSTAKEVERIFY`
     * Definition of the output script `P2CS`
     * Definition of a fast test to recognize P2CS scripts by checking only few bytes.
     * Definition of the input scriptSig to spend P2CS scriptPubKey outputs
     * Addition of a boolean argument `fColdStake` to `ExtractDestination` to extract proper keyID from P2CS scripts.

  - [Wallet]
     * Introduction of new ismine types to recognize cold staking txes: `ISMINE_COLD`, `ISMINE_SPENDABLE_DELEGATED`.
     * Introduction of the concepts of "delegated" and "cold" balance (debit and credit)
     * Addition of a new boolean flag `fStakeDelegationVoided` to walletTx when voiding stake delegations.
     * Addition of 2 new boolean optional arguments to `AvailableCoins` to include cold and/or delegated coins in the selection.
     * Inclusion of delegated coins in `SelectStakeCoins` for cold staking.
     * Addition of the delegator whitelisting check in `AvailableCoins`.

  - [RPC]
     * Addition of an option to include delegated balance in `getbalance`, `senfrom`, `sendmany` and `listtransactions`.
     * Definition of new method `getnewstakingaddress` to generate a new staking address.
     * Definition of new method `delegatestake` to send a stake delegation transaction
     * Definition of new method `delegatestakeraw` to create a raw stake delegation transaction without sending it
     * Prevent the use of staking addresses as recipients in `sendtoaddress`.
     * Definition of new method `getcoldstakingbalance` to retrieve the cold balance of the wallet.
     * Addition of `cold_staking_balance` and `delegated_balance` to `getwalletinfo`/`getinfo`.
     * `signrawtransaction`: for P2CS, select the key used to sign based on what is found in the keystore. If the wallet has both keys, sign with the owner key.
     * Definition of new method `delegatoradd` to whitelist an owner address for cold staking.
     * Definition of new method `delegatorremove` to un-do the effect of `delegatoradd`.
     * Definition of new function `listcoldutxos` to show p2cs utxos belonging to the wallet (either as owner or staker).
     * Definition of new function `liststakingaddresses` to show the staking addresses generated by the wallet.
     * Definition of new function `liststdelegators` to show the delegator (owner) addresses whitelisted by the (cold) wallet.

  - [Tests]
     * Creation of the new `feature_coldStaking.py` functional test and addition of it to the test-runner.

  - [Misc/Clenup]
     * Remove extra declaration of `EnsureWalletIsUnlocked` in rpcdump.cpp
     * REGTEST: lower the confirmations to 15 (same as testnet) and fix the stakeModifier.

ACKs for top commit:
  Fuzzbawls:
    ACK e498a06
  furszy:
    ACK e498a06

Tree-SHA512: 3dc3d5a50bc89c9ebfd5c84ab28ceec1166242b8ceedf62231e497bd432b9f49986f9d0e5ea442d44891f1ccc109dfe74f3e14125f2c18cd1b369f24127654ad
@Fuzzbawls Fuzzbawls removed the Needs Release Notes Placeholder tag for anything needing mention in the "Notable Changes" section of release notes label Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants