Skip to content

Commit 45bf8db

Browse files
committed
DERO-HE STARGATE Mainnet Release44
1 parent 5ad177d commit 45bf8db

File tree

12 files changed

+74
-35
lines changed

12 files changed

+74
-35
lines changed

blockchain/supply_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ package blockchain
1919
import "testing"
2020
import "github.com/deroproject/derohe/globals"
2121

22-
2322
func Test_Supply(t *testing.T) {
2423

2524
supply_at_0 := CalcBlockReward(0)
2625

27-
for i := uint64(0); i < 10; i++ {
26+
total_supply := uint64(0)
27+
for i := uint64(0); i < 14; i++ {
2828
supply := CalcBlockReward(i * RewardReductionInterval)
29-
t.Logf("Supply at height %d %s", i*RewardReductionInterval, globals.FormatMoney(supply))
29+
total_supply += supply * RewardReductionInterval
30+
t.Logf("Supply at height %9d %s Emission after %d years (%s)", i*RewardReductionInterval, globals.FormatMoney(supply), 4+i*4, globals.FormatMoney(total_supply))
3031
if supply != supply_at_0>>i {
3132
t.Errorf("supply not halvening as needed ")
3233
return

blockchain/transaction_execute.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import "github.com/deroproject/graviton"
4040

4141
// convert bitcoin model to our, but skip initial 4 years of supply, so our total supply gets to 10.5 million
4242
const RewardReductionInterval = 210000 * 600 / config.BLOCK_TIME // 210000 comes from bitcoin
43-
const BaseReward = (50 * 100000 * config.BLOCK_TIME) / 600 // convert bitcoin reward system to our block
43+
const BaseReward = (41 * 100000 * config.BLOCK_TIME) / 600 // convert bitcoin reward system to our block
4444

4545
// CalcBlockSubsidy returns the subsidy amount a block at the provided height
4646
// should have. This is mainly used for determining how much the coinbase for
@@ -186,6 +186,13 @@ func (chain *Blockchain) process_transaction(changed map[crypto.Hash]*graviton.T
186186
zerobalance = zerobalance.Plus(new(big.Int).SetUint64(800000)) // add fix amount to every wallet to users balance for more testing
187187
}
188188

189+
// give new wallets generated in initial month a balance
190+
// so they can claim previous chain balance safely/securely without revealing themselves
191+
// 144000= 86400/18 *30
192+
if globals.IsMainnet() && height < 144000 {
193+
zerobalance = zerobalance.Plus(new(big.Int).SetUint64(200))
194+
}
195+
189196
nb := crypto.NonceBalance{NonceHeight: 0, Balance: zerobalance}
190197

191198
balance_tree.Put(tx.MinerAddress[:], nb.Serialize())

cmd/dero-wallet-cli/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ func main() {
120120
}
121121

122122
// init the lookup table one, anyone importing walletapi should init this first, this will take around 1 sec on any recent system
123-
walletapi.Initialize_LookupTable(1, 1<<21)
123+
if os.Getenv("USE_BIG_TABLE") != "" {
124+
fmt.Printf("Please wait, generating precompute table....")
125+
walletapi.Initialize_LookupTable(1, 1<<24) // use 8 times more more ram, around 256 MB RAM
126+
fmt.Printf("done\n")
127+
} else {
128+
walletapi.Initialize_LookupTable(1, 1<<21)
129+
}
124130

125131
// We need to initialize readline first, so it changes stderr to ansi processor on windows
126132
l, err := readline.NewEx(&readline.Config{

cmd/derod/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ restart_loop:
670670
}
671671

672672
fmt.Printf("BALANCE_TREE : %s\n", bhash)
673+
fmt.Printf("MINING REWARD : %s\n", globals.FormatMoney(blockchain.CalcBlockReward(bl.Height)))
673674

674675
//fmt.Printf("Orphan: %v\n",chain.Is_Block_Orphan(hash))
675676

@@ -763,9 +764,8 @@ restart_loop:
763764

764765
supply := uint64(0)
765766

766-
if supply > (1000000 * 1000000000000) {
767-
supply -= (1000000 * 1000000000000) // remove premine
768-
}
767+
supply = (config.PREMINE + blockchain.CalcBlockReward(uint64(chain.Get_Height()))*uint64(chain.Get_Height())) // valid for few years
768+
769769
fmt.Printf("Network %s Height %d NW Hashrate %0.03f MH/sec Peers %d inc, %d out MEMPOOL size %d REGPOOL %d Total Supply %s DERO \n", globals.Config.Name, chain.Get_Height(), float64(chain.Get_Network_HashRate())/1000000.0, inc, out, mempool_tx_count, regpool_tx_count, globals.FormatMoney(supply))
770770
if chain.LocatePruneTopo() >= 1 {
771771
fmt.Printf("Chain is pruned till %d\n", chain.LocatePruneTopo())
@@ -783,6 +783,7 @@ restart_loop:
783783
fmt.Printf(" %s(%d)", tip, chain.Load_Height_for_BL_ID(tip))
784784
}
785785
fmt.Printf("\n")
786+
fmt.Printf("Current Block Reward: %s\n", globals.FormatMoney(blockchain.CalcBlockReward(uint64(chain.Get_Height()))))
786787

787788
// print hardfork status on second line
788789
hf_state, _, _, threshold, version, votes, window := chain.Get_HF_info()

cmd/derod/rpc/blockheader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func GetBlockHeader(chain *blockchain.Blockchain, hash crypto.Hash) (result rpc.
4545
result.SyncBlock = chain.IsBlockSyncBlockHeight(hash)
4646
}
4747
result.SideBlock = chain.Isblock_SideBlock(hash)
48-
//result.Reward = chain.Load_Block_Total_Reward(dbtx, hash)
48+
result.Reward = blockchain.CalcBlockReward(uint64(result.Height))
4949
result.TXCount = int64(len(bl.Tx_hashes))
5050

5151
for i := range bl.Tips {

cmd/derod/rpc/rpc_dero_getinfo.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import "github.com/deroproject/derohe/config"
2323
import "github.com/deroproject/derohe/globals"
2424
import "github.com/deroproject/derohe/rpc"
2525

26-
//import "github.com/deroproject/derohe/blockchain"
26+
import "github.com/deroproject/derohe/blockchain"
2727

2828
func GetInfo(ctx context.Context) (result rpc.GetInfo_Result, err error) {
2929

@@ -71,17 +71,13 @@ func GetInfo(ctx context.Context) (result rpc.GetInfo_Result, err error) {
7171

7272
//result.Target_Height = uint64(chain.Get_Height())
7373

74-
//result.Tx_pool_size = uint64(len(chain.Mempool.Mempool_List_TX()))
74+
result.Tx_pool_size = uint64(len(chain.Mempool.Mempool_List_TX()))
7575
// get dynamic fees per kb, used by wallet for tx creation
7676
//result.Dynamic_fee_per_kb = config.FEE_PER_KB
7777
//result.Median_Block_Size = config.CRYPTONOTE_MAX_BLOCK_SIZE
7878

79-
//result.Total_Supply = chain.Load_Already_Generated_Coins_for_Topo_Index( result.TopoHeight)
80-
result.Total_Supply = 0
81-
if result.Total_Supply > (1000000 * 1000000000000) {
82-
result.Total_Supply -= (1000000 * 1000000000000) // remove premine
83-
}
84-
result.Total_Supply = result.Total_Supply / 1000000000000
79+
result.Total_Supply = (config.PREMINE + blockchain.CalcBlockReward(uint64(result.TopoHeight))*uint64(result.TopoHeight)) // valid for few years
80+
result.Total_Supply = result.Total_Supply / 100000 // only give deros remove fractional part
8581

8682
if globals.Config.Name != config.Mainnet.Name { // anything other than mainnet is testnet at this point in time
8783
result.Testnet = true

cmd/explorer/explorerlib/explorerlib.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func load_block_from_rpc(info *block_info, block_hash string, recursive bool) (e
356356
info.Nonce = bresult.Block_Header.Nonce
357357
info.Major_Version = bresult.Block_Header.Major_Version
358358
info.Minor_Version = bresult.Block_Header.Minor_Version
359-
info.Reward = fmt.Sprintf("%.03f", float32(bresult.Block_Header.Reward)/1000000000000.0)
359+
info.Reward = fmt.Sprintf("%.05f", float32(bresult.Block_Header.Reward)/100000.0)
360360

361361
block_bin, _ = hex.DecodeString(bresult.Blob)
362362

config/config.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const STARGATE_HE_MAX_TX_SIZE = 300 * 1024 // max size
5555
const MIN_RINGSIZE = 2 // >= 2 , ringsize will be accepted
5656
const MAX_RINGSIZE = 128 // <= 128, ringsize will be accepted
5757

58+
const PREMINE uint64 = 1228125400000 // this is total supply of old chain ( considering both chain will be running together for some time)
59+
5860
type SettingsStruct struct {
5961
MAINNET_BOOTSTRAP_DIFFICULTY uint64 `env:"MAINNET_BOOTSTRAP_DIFFICULTY" envDefault:"10000000"` // mainnet bootstrap is 10 MH/s
6062
MAINNET_MINIMUM_DIFFICULTY uint64 `env:"MAINNET_MINIMUM_DIFFICULTY" envDefault:"100000"` // mainnet minimum is 100 KH/s
@@ -89,27 +91,25 @@ type CHAIN_CONFIG struct {
8991
}
9092

9193
var Mainnet = CHAIN_CONFIG{Name: "mainnet",
92-
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x9a, 0x44, 0x40, 0x0}),
94+
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x9a, 0x44, 0x41, 0x0}),
9395
GETWORK_Default_Port: 10100,
94-
P2P_Default_Port: 10101,
9596
RPC_Default_Port: 10102,
9697
Wallet_RPC_Default_Port: 10103,
97-
Dev_Address: "deto1qy0ehnqjpr0wxqnknyc66du2fsxyktppkr8m8e6jvplp954klfjz2qqdzcd8p",
98+
Dev_Address: "dero1qykyta6ntpd27nl0yq4xtzaf4ls6p5e9pqu0k2x4x3pqq5xavjsdxqgny8270",
9899

99100
Genesis_Tx: "" +
100101
"01" + // version
101102
"00" + // Source is DERO network
102103
"00" + // Dest is DERO network
103104
"00" + // PREMINE_FLAG
104-
"80a8b9ceb024" + // PREMINE_VALUE
105-
"1f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa642500", // miners public key
105+
"c0d7e98fdf23" + // PREMINE_VALUE
106+
"2c45f753585aaf4fef202a658ba9afe1a0d3250838fb28d534420050dd64a0d301", // miners public key
106107

107108
}
108109

109110
var Testnet = CHAIN_CONFIG{Name: "testnet", // testnet will always have last 3 bytes 0
110-
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x86, 0x00, 0x00, 0x00}),
111+
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x87, 0x00, 0x00, 0x00}),
111112
GETWORK_Default_Port: 10100,
112-
P2P_Default_Port: 40401,
113113
RPC_Default_Port: 40402,
114114
Wallet_RPC_Default_Port: 40403,
115115

@@ -120,9 +120,9 @@ var Testnet = CHAIN_CONFIG{Name: "testnet", // testnet will always have last 3 b
120120
"00" + // Source is DERO network
121121
"00" + // Dest is DERO network
122122
"00" + // PREMINE_FLAG
123-
"80a8b9ceb024" + // PREMINE_VALUE
123+
"c0d7e98fdf23" + // PREMINE_VALUE
124124
"1f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa642500", // miners public key
125125
}
126126

127127
// mainnet has a remote daemon node, which can be used be default, if user provides a --remote flag
128-
const REMOTE_DAEMON = "https://rwallet.dero.live"
128+
const REMOTE_DAEMON = "185.132.176.174" // "https://rwallet.dero.live"

config/seed_nodes.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ package config
2121
// some seed nodes for mainnet (these seed node are not compliant with earlier protocols)
2222
// only version 2
2323
var Mainnet_seed_nodes = []string{
24-
"212.8.250.158:20202",
25-
"190.2.135.218:20202",
26-
"212.8.242.60:20202",
27-
"89.38.97.110:20202",
24+
"185.132.176.174:11011",
25+
"190.2.135.218:11011",
26+
"185.107.69.12:11011",
27+
"89.38.97.110:11011",
2828
}
2929

3030
// some seed node for testnet
3131
var Testnet_seed_nodes = []string{
32-
"68.183.12.117:40401",
33-
"167.99.145.53:40401",
32+
"212.8.242.60:40401",
3433
}

config/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ import "github.com/blang/semver/v4"
2020

2121
// right now it has to be manually changed
2222
// do we need to include git commitsha??
23-
var Version = semver.MustParse("3.4.111-43.DEROHE.STARGATE+18012022")
23+
var Version = semver.MustParse("3.4.118-0.DEROHE.STARGATE+26022022")

rpc/addr_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2017-2022 DERO Project. All rights reserved.
2+
// Use of this source code in any form is governed by RESEARCH license.
3+
// license can be found in the LICENSE file.
4+
// GPG: 0F39 E425 8C65 3947 702A 8234 08B2 0360 A03A 9DE8
5+
//
6+
//
7+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
8+
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9+
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
10+
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
12+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
13+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
15+
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16+
17+
package rpc
18+
19+
import "testing"
20+
import "github.com/deroproject/derohe/config"
21+
22+
func Test_Address(t *testing.T) {
23+
24+
addr, err := NewAddress(config.Mainnet.Dev_Address)
25+
if err != nil {
26+
t.Fatalf("devaddress could not be parsed")
27+
}
28+
t.Logf("dev address compressed form %x\n", addr.Compressed())
29+
}

walletapi/daemon_communication.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ var Daemon_Endpoint_Active string
121121

122122
func get_daemon_address() string {
123123
if globals.Arguments["--remote"] == true && globals.IsMainnet() {
124-
Daemon_Endpoint_Active = config.REMOTE_DAEMON
124+
Daemon_Endpoint_Active = config.REMOTE_DAEMON + fmt.Sprintf(":%d", config.Mainnet.RPC_Default_Port)
125125
}
126126

127127
// if user provided endpoint has error, use default

0 commit comments

Comments
 (0)