BlockPo / BlockPo-to-Tradelayer

Incubation Repo for the TradeLayer protocol, 0.2.0
http://www.tradelayer.org
Other
8 stars 8 forks source link

Node Reward Tx/RPC #224

Closed patrickdugan closed 1 year ago

patrickdugan commented 4 years ago

Node reward has a function in TradeLayer.cpp but it doesn't have a tx defined, the validity rules or supporting RPC call written.

We also have to double-check that the logic is correct:

bool TxValidNodeReward(std::string ConsensusHash, std::string Tx) { int NLast = 2;

std::string LastTwoCharConsensus = ConsensusHash.substr(ConsensusHash.size() - NLast); std::string LastTwoCharTx = Tx.substr(Tx.size() - NLast);

PrintToLog("\nLastTwoCharConsensus = %s\t LastTwoCharTx = %s\n", LastTwoCharConsensus,LastTwoCharTx);

if (LastTwoCharConsensus == LastTwoCharTx) return true; else return false; }

Having trouble finding where in TradeLayer.cpp the math about Node Reward supply is.

patrickdugan commented 4 years ago

Math is on the Node Reward tab here:

https://docs.google.com/spreadsheets/d/1qMF3RbsdNRd8n862adkk-IPE06ahANUexdEnHk52-Fw/edit#gid=1520242544

Starts at 0.05, grows to 0.5 over 6 months, then walks down slowly up to block t+250k, then we transition into an incremental drop off. The sum decreases by 2 Dugans/Satoshis/Willets/LoLs per block for 500k blocks. Then it decreases by 1 per blocks for 1M blocks, then 1 per 2 blocks for 1M, then 1 per 4 blocks for 5M blocks, then Freeze It at 0.0125 forever, generating ~2500 per year which should be (off a 300k ALL Founder Reward Base) about 0.1% annual inflation.

santos177 commented 4 years ago

Math is located in tx.cpp line 5051 . It's triggered just in logicMath_ContractDexTrade() . @patrickdugan let me know if this is ok (in other case tell me please what do we have to change)

patrickdugan commented 4 years ago

Ok so this is basically mostly done. We just have to make sure that Rules and Parse and then the RPCs work for it, and we can test it and then ship it, seems like it's 80% done.

patrickdugan commented 4 years ago

Moved this over to Native Activation so we can focus on shipping the no frills version.

patrickdugan commented 2 years ago

We have node reward, we have RPCs to do the tx, do we have RPCs to get the data? If so we can close.

@santos177

patrickdugan commented 1 year ago

{ "trade layer (transaction creation)", "tl_submit_nodeaddress", &tl_submit_nodeaddress, {} }, { "trade layer (transaction creation)", "tl_claim_nodereward", &tl_claim_nodereward, {} }

We need an rpc in rpc.cpp to go in and tell us what the current Node Reward total is, and ideally, another one to tell us Node Reward win history (block # and amount won) for people's taxes.

patrickdugan commented 1 year ago

We have them actually:

{"trade layer (data retrieval)", "tl_getnextreward", &tl_getnextreward, {} }, { "trade layer (data retrieval)", "tl_isaddresswinner", &tl_isaddresswinner, {} }, { "trade layer (data retrieval)" , "tl_getlast_winners", &tl_getlast_winners, {} }