Browse Source

Merge pull request #1610 from letolabs/hushsupply2

Upstream Hush Supply Curve
pull/37/head
jl777 5 years ago
committed by GitHub
parent
commit
b018d0dda0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      src/assetchains.json
  2. 1
      src/assetchains.old
  3. 7
      src/fiat/hush
  4. 11
      src/hush-cli
  5. 52
      src/hushd
  6. 37
      src/komodo_bitcoind.h

22
src/assetchains.json

@ -268,5 +268,27 @@
"ac_supply": "64000777",
"ac_staked": "10",
"addnode": ["18.197.20.21"]
},
{
"ac_name": "HUSH3",
"ac_sapling": "1",
"ac_founders": "1",
"ac_reward": "0,1125000000,562500000",
"ac_end": "128,340000,5422111",
"ac_blocktime": "150",
"ac_supply": "6178674",
"ac_halving": "129,340000,840000",
"ac_cc": "2",
"ac_cclib": "hush3",
"ac_ccenable": "228,234,235,236,241",
"ac_perc": "11111111",
"ac_eras": "3",
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac",
"clientname": "GoldenSandtrout",
"addnode": [
"188.165.212.101",
"136.243.227.142",
"5.9.224.250"
]
}
]

1
src/assetchains.old

@ -52,3 +52,4 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 &
./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 &
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 &
./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac &

7
src/fiat/hush

@ -0,0 +1,7 @@
#!/bin/bash
#set working directory to the location of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
../komodo-cli -ac_name=HUSH3 "$@"

11
src/hush-cli

@ -0,0 +1,11 @@
#!/bin/bash
# Copyright (c) 2019 Hush developers
# set working directory to the location of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
NAME=HUSH3
CLI=${KOMODOCLI:-./komodo-cli}
$CLI -ac_name=$NAME "$@"

52
src/hushd

@ -0,0 +1,52 @@
#!/bin/bash
# Copyright (c) 2019 Hush developers
# set working directory to the location of this script
DIR="$( cd "$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" && pwd )"
cd $DIR
NAME=HUSH3
# this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn
SCRIPT=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac
# Chain parameters
ERAS=3
BLOCKTIME=150
# 6250000 - (sprout pool at block 500,000)
SUPPLY=6178674
FOUNDERS=1
REWARD=0,1125000000,562500000
PERC=11111111
HALVING=129,340000,840000
# NOTE: keep in sync with komodo_bitcoind.h
END=128,340000,5422111
CLIENTNAME=GoldenSandtrout
SEEDNODE1=188.165.212.101
SEEDNODE2=136.243.227.142
SEEDNODE3=5.9.224.250
CCLIB=hush3
# CryptoConditions/Custom Consensus params
FAUCET=228
HEIR=234
CHANNEL=235
ORACLE=236
GATEWAY=241
CCENABLE=$FAUCET,$HEIR,$CHANNEL,$ORACLE,$GATEWAY
KMD=${KOMODOD:-./komodod}
$KMD -ac_name=$NAME -ac_sapling=1 \
-ac_reward=$REWARD \
-ac_halving=$HALVING \
-ac_end=$END \
-ac_eras=$ERAS \
-ac_blocktime=$BLOCKTIME \
-ac_cc=2 -ac_ccenable=$CCENABLE \
-ac_founders=$FOUNDERS -ac_supply=$SUPPLY \
-ac_perc=$PERC \
-clientname=$CLIENTNAME \
-addnode=$SEEDNODE1 \
-addnode=$SEEDNODE2 \
-addnode=$SEEDNODE3 \
-ac_cclib=$CCLIB \
-ac_script=$SCRIPT "$@"

37
src/komodo_bitcoind.h

@ -1256,16 +1256,53 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
uint64_t komodo_commission(const CBlock *pblock,int32_t height)
{
static bool didinit = false,ishush3 = false;
// LABS fungible chains, cannot have any block reward!
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 2 )
return(0);
if (!didinit) {
ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
didinit = true;
}
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0;
if ( ASSETCHAINS_FOUNDERS != 0 )
{
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
if (ishush3) {
int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111;
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves.
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
// Transition period of 128 blocks has BR=FR=0
if (height < TRANSITION) {
commission = 0;
} else if (height < HALVING1) {
commission = starting_commission;
} else if (height < HALVING1+1*INTERVAL) {
commission = starting_commission / 2;
} else if (height < HALVING1+2*INTERVAL) {
commission = starting_commission / 4;
} else if (height < HALVING1+3*INTERVAL) {
commission = starting_commission / 8;
} else if (height < HALVING1+4*INTERVAL) {
commission = starting_commission / 16;
} else if (height < HALVING1+5*INTERVAL) {
commission = starting_commission / 32;
} else if (height < HALVING1+6*INTERVAL) { // Block 5380000
// Block reward will go to zero between 7th+8th halvings, ac_end may need adjusting
commission = starting_commission / 64;
} else if (height < HALVING1+7*INTERVAL) {
// Block reward will be zero before this is ever reached
commission = starting_commission / 128; // Block 6220000
}
}
if ( ASSETCHAINS_FOUNDERS > 1 )
{
if ( (height % ASSETCHAINS_FOUNDERS) == 0 )

Loading…
Cancel
Save