Skip to content

Cold staking#249

Merged
aguycalled merged 311 commits intonavcoin:masterfrom
aguycalled:cold-staking
Dec 7, 2018
Merged

Cold staking#249
aguycalled merged 311 commits intonavcoin:masterfrom
aguycalled:cold-staking

Conversation

@aguycalled
Copy link
Copy Markdown
Member

This PR introduces the changes described in https://github.com/NAVCoin/npips/blob/master/npip-0002.mediawiki.

Add new class methods to obtain the staking and spending key ids from a cold staking address
when sending a transaction, the ui will check whether any of the outputs is a cold staking script. in that case, it will warn the user about the coins going to a normal change address if he didnt specify a cold staking address as custom change destination
@aguycalled aguycalled merged commit b1c776c into navcoin:master Dec 7, 2018
aguycalled pushed a commit to skreener/navcoin-core that referenced this pull request Feb 3, 2019
* stake weight counts cold staking balance

* show colstaking output values in gui

* overview layout

* overview layout move to staking section

* receive layout

* fix top menu layout

* unused var

* set coinstake version before signing

* resign coinstake tx

* error takes string as arg

* error must return false

* inherit return value

* extract pub key from input scripsig when cold staking

* gui cold staking wizard

* fix layout

* fix layout

* restrict getcoldstakingaddress only after actv

* use chainactive instead of pindexbestheader

* add logging

* correctly extract pubkey from coldstaking script

* new regtest genesis block

* IsPayToPublicKey()

* addressindex and unspentindex track p2pk (staking) outputs

* use address type 1 for p2pk

* use extract destination for address/unspent indexes

* track cold staking addresses in index

* GetStakingKeyID / GetSpendingKeyID

Add new class methods to obtain the staking and spending key ids from a cold staking address

* ui checks if spends coldstaking out

when sending a transaction, the ui will check whether any of the outputs is a cold staking script. in that case, it will warn the user about the coins going to a normal change address if he didnt specify a cold staking address as custom change destination

* fix

* update strings

* add IsColdStake() to CScript

* parse OP_COINSTAKE opcode

* Solver() extracts addresses from cold staking tx

* read key from coldstaking script when verifying block signature

* sign coldstaking input

* remove cnavcoinaddress

* add key_io

* revert

* fix extractdestinations

* required signatures

* show cold staking balance

* get available stakable credit

* get available stakable credit

* count cold staking balance when creating coinstake

* show canspend / canstake in listtransactions

* fix total stakable amount

* list transactions canspend/stake

* fix order of the public keys on raw decoded address

* cold staking balance in ui

* show colstaking output values in gui

* overview layout

* overview layout move to staking section

* fix top menu layout

* extract pub key from input scripsig when cold staking

* gui cold staking wizard

* add logging

* remove duplicate case

* Remove duplicated case

* Remove wrong duplicated check

* do not enforce random string for preq v2

* adjust overview layout

* fix condition order

* extend log

* move proposal/preq check to contextualcheckblock

* revert

* rebase cold staking branch

* testnet coldstaking versionbit

* fix version bit

* check versionbit testnet

* sync branch

* restart testnet / increase pow last block

* add log

* cfund change logic for accepting props/preq

* add consensus info to cfundstats

* do not count rejected preqs when creating a new one

* added cold staking to regtest (aguycalled#31)

* combined cfund test helper functions: activate_cfund, start_new_cycle, end_cycle, slow_gen

* simplified setup-network using existing code

* removed duplicate code from rawtx tests and minor linting fixes

* adds cold staking to regtest

* added cold staking to regtest

* new testnet genesis

* a coldstakingaddress can be constructued only from two normal addresses

* bug fix for getcoldstakingaddress (aguycalled#32)

* forces user to use different staking and spending addresses for getcoldstakingaddress

* updated the cold-staking wizard so you cannot enter the same address as both args

* add coldstaking to regtest

* admit holding two priv keys of a cstaking script

* Merge from Cfund cold staking (aguycalled#33)

* do not enforce random string for preq v2

* adjust overview layout

* fix condition order

* extend log

* move proposal/preq check to contextualcheckblock

* revert

* restart testnet / increase pow last block

* add log

* cfund change logic for accepting props/preq

* add consensus info to cfundstats

* do not count rejected preqs when creating a new one

* new testnet genesis

* a coldstakingaddress can be constructued only from two normal addresses

* bug fix for getcoldstakingaddress (aguycalled#32)

* forces user to use different staking and spending addresses for getcoldstakingaddress

* updated the cold-staking wizard so you cannot enter the same address as both args

* add coldstaking to regtest

* admit holding two priv keys of a cstaking script

* FIxed wizard text (aguycalled#35)

* fix overview page

* fix coldstaking wizard

* show both staking and spending pubkeys

* fix cold staking wizard

* combine signatures cold staking

* Moved over RPC tests from other branch

* Updated gitignore

* ported fix for zlib compile on mac from bitcoin bitcoin/bitcoin#9973

* tided tests up slightly

* First spending test

* Largely completed tests for coldstaking where we hold the spending address

* started work on coldstaing tests where we hold the staking address

* fixed accidental var reasignment in test

* Added a staking test

* added some debugging to test

* added missing brackets to function call

* added a loop that waits until we stake

* fixed syntax error

* fixed some more syntax errors

* replaced missing bracket

* Updated test so we use getblockheight instead of getblockchaininfo and only set up 1 node instaed of 2

* we now mine blocks so our coins mature for stkaing

* now we check if the cold staking utxo is used for staking

* adding in block generation so we confirm our tx to the cold stkaing address

* ading more logs for debugging

* more debugging

* syncing blocks between nodes

* Rejigged node setup, hopefully gets syncing working

* get the utxo a different way

* fixed syntax error

* New method to get utxo

* fixes some syntax errors

* fixes other syntax errors

* We check if the uxto is spent via staking

* bump version 4.5.0

* added some more staing address tests

* added ore logging

* updated arg name in send raw tx function, os it's more verbose

* Updated function so we throw a custom exception we can explicitely catch

* fixed exception throwing

* fixed syntax err

* fixing more syntax errors

* playing around with exception catching

* fixed typo

* Removed some logging, unused variables and commented out some printing as part of test clean up

* added syncing to test

* more test fixes

* removed syncing

* removed syncing

* wrapped operation in rbackets

* parse  numbers asfloats

* removed back slahses

* fixed syntax error

* we generate our blocks on node 0 now and just remove the block rewards value from our balance calculatins

* added getcoldstaking error message

* updated rpc test for new help text

* adds modified coldstaking client testing doc

* format fixes

* format fixes

* Moved over RPC tests from other branch

* Updated gitignore

* ported fix for zlib compile on mac from bitcoin bitcoin/bitcoin#9973

* tided tests up slightly

* First spending test

* Largely completed tests for coldstaking where we hold the spending address

* started work on coldstaing tests where we hold the staking address

* fixed accidental var reasignment in test

* Added a staking test

* added some debugging to test

* added missing brackets to function call

* added a loop that waits until we stake

* fixed syntax error

* fixed some more syntax errors

* replaced missing bracket

* Updated test so we use getblockheight instead of getblockchaininfo and only set up 1 node instaed of 2

* we now mine blocks so our coins mature for stkaing

* now we check if the cold staking utxo is used for staking

* adding in block generation so we confirm our tx to the cold stkaing address

* ading more logs for debugging

* more debugging

* syncing blocks between nodes

* Rejigged node setup, hopefully gets syncing working

* get the utxo a different way

* fixed syntax error

* New method to get utxo

* fixes some syntax errors

* fixes other syntax errors

* We check if the uxto is spent via staking

* added some more staing address tests

* added ore logging

* updated arg name in send raw tx function, os it's more verbose

* Updated function so we throw a custom exception we can explicitely catch

* fixed exception throwing

* fixed syntax err

* fixing more syntax errors

* playing around with exception catching

* fixed typo

* Static reward RC (navcoin#328)

* static rewards added

* initial test and test util added

* added new test to rpc test file

* test updated

* adding sleep print

* removed extra bracket

* updated perms.

* cleanup test

* checking before the soft fork

* creating a few blocks to start

* removing pre check

* Removed some logging, unused variables and commented out some printing as part of test clean up

* added syncing to test

* more test fixes

* removed syncing

* removed syncing

* wrapped operation in rbackets

* parse  numbers asfloats

* removed back slahses

* fixed syntax error

* we generate our blocks on node 0 now and just remove the block rewards value from our balance calculatins

* added getcoldstaking error message

* updated rpc test for new help text

* adds modified coldstaking client testing doc

* format fixes

* format fixes

* fix

* added spending-from-coldstaking test

* updated rpc-tests.py

* removed extra file, updated coldstaking tests

* Update qa/pull-tester/rpc-tests.py

delete reference to deleted file

* Updated release notes with a draft of the cold staking notes

* added notes about Marcus's testing

* fix word

void getAddressToReceive::getColdStakingAddress()
{
if (!IsCommunityFundEnabled(pindexBestHeader,Params().GetConsensus()))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Based on the response in the QMessageBox it seems that this conditional should have used IsColdStakingEnabled.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

" \"stakingaddress\" : \"navcoinaddress\", (string) The navcoin staking address part of a cold staking address\n"
" \"spendingaddress\" : \"navcoinaddress\", (string) The navcoin spending address part of a cold staking address\n"
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
" \"ismine\" : true|false, (boolean) If the coins from the address are stakable or not\n"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be labelled as isstakable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

already fixed in current master

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This pull request is already closed and merged. I would suggest to better check against the current state of master.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thought I did, but I was checking master on the source repo of the PR, not navcoin/navcoin-core. Will pay more attention in future.


bool IsColdStaking() const;

bool IsColdStake() const;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Declared but never defined.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants