DERO-HE STARGATE Mainnet Release44

This commit is contained in:
Captain 2022-02-27 01:07:37 +00:00
parent 5ad177d90d
commit 45bf8db024
No known key found for this signature in database
GPG Key ID: 18CDB3ED5E85D2D4
12 changed files with 74 additions and 35 deletions

View File

@ -19,14 +19,15 @@ package blockchain
import "testing"
import "github.com/deroproject/derohe/globals"
func Test_Supply(t *testing.T) {
supply_at_0 := CalcBlockReward(0)
for i := uint64(0); i < 10; i++ {
total_supply := uint64(0)
for i := uint64(0); i < 14; i++ {
supply := CalcBlockReward(i * RewardReductionInterval)
t.Logf("Supply at height %d %s", i*RewardReductionInterval, globals.FormatMoney(supply))
total_supply += supply * RewardReductionInterval
t.Logf("Supply at height %9d %s Emission after %d years (%s)", i*RewardReductionInterval, globals.FormatMoney(supply), 4+i*4, globals.FormatMoney(total_supply))
if supply != supply_at_0>>i {
t.Errorf("supply not halvening as needed ")
return

View File

@ -40,7 +40,7 @@ import "github.com/deroproject/graviton"
// convert bitcoin model to our, but skip initial 4 years of supply, so our total supply gets to 10.5 million
const RewardReductionInterval = 210000 * 600 / config.BLOCK_TIME // 210000 comes from bitcoin
const BaseReward = (50 * 100000 * config.BLOCK_TIME) / 600 // convert bitcoin reward system to our block
const BaseReward = (41 * 100000 * config.BLOCK_TIME) / 600 // convert bitcoin reward system to our block
// CalcBlockSubsidy returns the subsidy amount a block at the provided height
// 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
zerobalance = zerobalance.Plus(new(big.Int).SetUint64(800000)) // add fix amount to every wallet to users balance for more testing
}
// give new wallets generated in initial month a balance
// so they can claim previous chain balance safely/securely without revealing themselves
// 144000= 86400/18 *30
if globals.IsMainnet() && height < 144000 {
zerobalance = zerobalance.Plus(new(big.Int).SetUint64(200))
}
nb := crypto.NonceBalance{NonceHeight: 0, Balance: zerobalance}
balance_tree.Put(tx.MinerAddress[:], nb.Serialize())

View File

@ -120,7 +120,13 @@ func main() {
}
// init the lookup table one, anyone importing walletapi should init this first, this will take around 1 sec on any recent system
walletapi.Initialize_LookupTable(1, 1<<21)
if os.Getenv("USE_BIG_TABLE") != "" {
fmt.Printf("Please wait, generating precompute table....")
walletapi.Initialize_LookupTable(1, 1<<24) // use 8 times more more ram, around 256 MB RAM
fmt.Printf("done\n")
} else {
walletapi.Initialize_LookupTable(1, 1<<21)
}
// We need to initialize readline first, so it changes stderr to ansi processor on windows
l, err := readline.NewEx(&readline.Config{

View File

@ -670,6 +670,7 @@ restart_loop:
}
fmt.Printf("BALANCE_TREE : %s\n", bhash)
fmt.Printf("MINING REWARD : %s\n", globals.FormatMoney(blockchain.CalcBlockReward(bl.Height)))
//fmt.Printf("Orphan: %v\n",chain.Is_Block_Orphan(hash))
@ -763,9 +764,8 @@ restart_loop:
supply := uint64(0)
if supply > (1000000 * 1000000000000) {
supply -= (1000000 * 1000000000000) // remove premine
}
supply = (config.PREMINE + blockchain.CalcBlockReward(uint64(chain.Get_Height()))*uint64(chain.Get_Height())) // valid for few years
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))
if chain.LocatePruneTopo() >= 1 {
fmt.Printf("Chain is pruned till %d\n", chain.LocatePruneTopo())
@ -783,6 +783,7 @@ restart_loop:
fmt.Printf(" %s(%d)", tip, chain.Load_Height_for_BL_ID(tip))
}
fmt.Printf("\n")
fmt.Printf("Current Block Reward: %s\n", globals.FormatMoney(blockchain.CalcBlockReward(uint64(chain.Get_Height()))))
// print hardfork status on second line
hf_state, _, _, threshold, version, votes, window := chain.Get_HF_info()

View File

@ -45,7 +45,7 @@ func GetBlockHeader(chain *blockchain.Blockchain, hash crypto.Hash) (result rpc.
result.SyncBlock = chain.IsBlockSyncBlockHeight(hash)
}
result.SideBlock = chain.Isblock_SideBlock(hash)
//result.Reward = chain.Load_Block_Total_Reward(dbtx, hash)
result.Reward = blockchain.CalcBlockReward(uint64(result.Height))
result.TXCount = int64(len(bl.Tx_hashes))
for i := range bl.Tips {

View File

@ -23,7 +23,7 @@ import "github.com/deroproject/derohe/config"
import "github.com/deroproject/derohe/globals"
import "github.com/deroproject/derohe/rpc"
//import "github.com/deroproject/derohe/blockchain"
import "github.com/deroproject/derohe/blockchain"
func GetInfo(ctx context.Context) (result rpc.GetInfo_Result, err error) {
@ -71,17 +71,13 @@ func GetInfo(ctx context.Context) (result rpc.GetInfo_Result, err error) {
//result.Target_Height = uint64(chain.Get_Height())
//result.Tx_pool_size = uint64(len(chain.Mempool.Mempool_List_TX()))
result.Tx_pool_size = uint64(len(chain.Mempool.Mempool_List_TX()))
// get dynamic fees per kb, used by wallet for tx creation
//result.Dynamic_fee_per_kb = config.FEE_PER_KB
//result.Median_Block_Size = config.CRYPTONOTE_MAX_BLOCK_SIZE
//result.Total_Supply = chain.Load_Already_Generated_Coins_for_Topo_Index( result.TopoHeight)
result.Total_Supply = 0
if result.Total_Supply > (1000000 * 1000000000000) {
result.Total_Supply -= (1000000 * 1000000000000) // remove premine
}
result.Total_Supply = result.Total_Supply / 1000000000000
result.Total_Supply = (config.PREMINE + blockchain.CalcBlockReward(uint64(result.TopoHeight))*uint64(result.TopoHeight)) // valid for few years
result.Total_Supply = result.Total_Supply / 100000 // only give deros remove fractional part
if globals.Config.Name != config.Mainnet.Name { // anything other than mainnet is testnet at this point in time
result.Testnet = true

View File

@ -356,7 +356,7 @@ func load_block_from_rpc(info *block_info, block_hash string, recursive bool) (e
info.Nonce = bresult.Block_Header.Nonce
info.Major_Version = bresult.Block_Header.Major_Version
info.Minor_Version = bresult.Block_Header.Minor_Version
info.Reward = fmt.Sprintf("%.03f", float32(bresult.Block_Header.Reward)/1000000000000.0)
info.Reward = fmt.Sprintf("%.05f", float32(bresult.Block_Header.Reward)/100000.0)
block_bin, _ = hex.DecodeString(bresult.Blob)

View File

@ -55,6 +55,8 @@ const STARGATE_HE_MAX_TX_SIZE = 300 * 1024 // max size
const MIN_RINGSIZE = 2 // >= 2 , ringsize will be accepted
const MAX_RINGSIZE = 128 // <= 128, ringsize will be accepted
const PREMINE uint64 = 1228125400000 // this is total supply of old chain ( considering both chain will be running together for some time)
type SettingsStruct struct {
MAINNET_BOOTSTRAP_DIFFICULTY uint64 `env:"MAINNET_BOOTSTRAP_DIFFICULTY" envDefault:"10000000"` // mainnet bootstrap is 10 MH/s
MAINNET_MINIMUM_DIFFICULTY uint64 `env:"MAINNET_MINIMUM_DIFFICULTY" envDefault:"100000"` // mainnet minimum is 100 KH/s
@ -89,27 +91,25 @@ type CHAIN_CONFIG struct {
}
var Mainnet = CHAIN_CONFIG{Name: "mainnet",
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x9a, 0x44, 0x40, 0x0}),
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x9a, 0x44, 0x41, 0x0}),
GETWORK_Default_Port: 10100,
P2P_Default_Port: 10101,
RPC_Default_Port: 10102,
Wallet_RPC_Default_Port: 10103,
Dev_Address: "deto1qy0ehnqjpr0wxqnknyc66du2fsxyktppkr8m8e6jvplp954klfjz2qqdzcd8p",
Dev_Address: "dero1qykyta6ntpd27nl0yq4xtzaf4ls6p5e9pqu0k2x4x3pqq5xavjsdxqgny8270",
Genesis_Tx: "" +
"01" + // version
"00" + // Source is DERO network
"00" + // Dest is DERO network
"00" + // PREMINE_FLAG
"80a8b9ceb024" + // PREMINE_VALUE
"1f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa642500", // miners public key
"c0d7e98fdf23" + // PREMINE_VALUE
"2c45f753585aaf4fef202a658ba9afe1a0d3250838fb28d534420050dd64a0d301", // miners public key
}
var Testnet = CHAIN_CONFIG{Name: "testnet", // testnet will always have last 3 bytes 0
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x86, 0x00, 0x00, 0x00}),
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x87, 0x00, 0x00, 0x00}),
GETWORK_Default_Port: 10100,
P2P_Default_Port: 40401,
RPC_Default_Port: 40402,
Wallet_RPC_Default_Port: 40403,
@ -120,9 +120,9 @@ var Testnet = CHAIN_CONFIG{Name: "testnet", // testnet will always have last 3 b
"00" + // Source is DERO network
"00" + // Dest is DERO network
"00" + // PREMINE_FLAG
"80a8b9ceb024" + // PREMINE_VALUE
"c0d7e98fdf23" + // PREMINE_VALUE
"1f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa642500", // miners public key
}
// mainnet has a remote daemon node, which can be used be default, if user provides a --remote flag
const REMOTE_DAEMON = "https://rwallet.dero.live"
const REMOTE_DAEMON = "185.132.176.174" // "https://rwallet.dero.live"

View File

@ -21,14 +21,13 @@ package config
// some seed nodes for mainnet (these seed node are not compliant with earlier protocols)
// only version 2
var Mainnet_seed_nodes = []string{
"212.8.250.158:20202",
"190.2.135.218:20202",
"212.8.242.60:20202",
"89.38.97.110:20202",
"185.132.176.174:11011",
"190.2.135.218:11011",
"185.107.69.12:11011",
"89.38.97.110:11011",
}
// some seed node for testnet
var Testnet_seed_nodes = []string{
"68.183.12.117:40401",
"167.99.145.53:40401",
"212.8.242.60:40401",
}

View File

@ -20,4 +20,4 @@ import "github.com/blang/semver/v4"
// right now it has to be manually changed
// do we need to include git commitsha??
var Version = semver.MustParse("3.4.111-43.DEROHE.STARGATE+18012022")
var Version = semver.MustParse("3.4.118-0.DEROHE.STARGATE+26022022")

29
rpc/addr_test.go Normal file
View File

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

View File

@ -121,7 +121,7 @@ var Daemon_Endpoint_Active string
func get_daemon_address() string {
if globals.Arguments["--remote"] == true && globals.IsMainnet() {
Daemon_Endpoint_Active = config.REMOTE_DAEMON
Daemon_Endpoint_Active = config.REMOTE_DAEMON + fmt.Sprintf(":%d", config.Mainnet.RPC_Default_Port)
}
// if user provided endpoint has error, use default