From 0961daab23b17b09a5d45e89bebd7092386d3a21 Mon Sep 17 00:00:00 2001 From: Decho Kocharin Date: Tue, 13 Aug 2024 15:38:38 +0700 Subject: [PATCH] Add CSS and PUG --- .../Blockchain/Kaspa/KaspaConstants.cs | 18 +++++++++++ .../Blockchain/Kaspa/KaspaJobManager.cs | 2 ++ src/Miningcore/Blockchain/Kaspa/KaspaUtils.cs | 22 +++++++++++++- .../Configuration/ClusterConfigExtensions.cs | 2 ++ src/Miningcore/coins.json | 30 +++++++++++++++++++ 5 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/Miningcore/Blockchain/Kaspa/KaspaConstants.cs b/src/Miningcore/Blockchain/Kaspa/KaspaConstants.cs index 654169644..f66b74b38 100644 --- a/src/Miningcore/Blockchain/Kaspa/KaspaConstants.cs +++ b/src/Miningcore/Blockchain/Kaspa/KaspaConstants.cs @@ -105,6 +105,24 @@ public static class KarlsencoinConstants public const long FishHashPlusForkHeightTestnet = 6000000; } +public static class ConsensusConstants +{ + // List of CSS prefixes: https://github.com/consensus-network/consensusd/blob/master/util/address.go + public const string ChainPrefixDevnet = "consensusdev"; + public const string ChainPrefixSimnet = "consensussim"; + public const string ChainPrefixTestnet = "consensustest"; + public const string ChainPrefixMainnet = "consensus"; +} + +public static class PugdagConstants +{ + // List of PUG prefixes: https://github.com/Pugdag/pugdagd/blob/main/util/address.go + public const string ChainPrefixDevnet = "pugdagdev"; + public const string ChainPrefixSimnet = "pugdagsim"; + public const string ChainPrefixTestnet = "pugdagtest"; + public const string ChainPrefixMainnet = "pugdag"; +} + public static class NautilusConstants { // List of NTL prefixes: https://github.com/Nautilus-Network/nautiliad/blob/master/util/address.go diff --git a/src/Miningcore/Blockchain/Kaspa/KaspaJobManager.cs b/src/Miningcore/Blockchain/Kaspa/KaspaJobManager.cs index 3fdfa7f78..674984352 100644 --- a/src/Miningcore/Blockchain/Kaspa/KaspaJobManager.cs +++ b/src/Miningcore/Blockchain/Kaspa/KaspaJobManager.cs @@ -288,6 +288,8 @@ private KaspaJob CreateJob(long blockHeight) customShareHasher = new CShake256(null, Encoding.UTF8.GetBytes(KaspaConstants.CoinbaseHeavyHash)); return new KarlsencoinJob(customBlockHeaderHasher, customCoinbaseHasher, customShareHasher); + case "CSS": + case "PUG": case "NTL": case "NXL": if(customBlockHeaderHasher is not Blake2b) diff --git a/src/Miningcore/Blockchain/Kaspa/KaspaUtils.cs b/src/Miningcore/Blockchain/Kaspa/KaspaUtils.cs index 43e3f1200..2ec751d34 100644 --- a/src/Miningcore/Blockchain/Kaspa/KaspaUtils.cs +++ b/src/Miningcore/Blockchain/Kaspa/KaspaUtils.cs @@ -354,7 +354,27 @@ public KaspaAddressUtility(string coinSymbol = "KAS") // Build address pattern based on network type and coin symbol switch(this.CoinSymbol) { - case "BGA": + case "PUG": + this.stringsToBech32Prefixes = new Dictionary + { + { PugdagConstants.ChainPrefixMainnet, KaspaBech32Prefix.KaspaMain }, + { PugdagConstants.ChainPrefixDevnet, KaspaBech32Prefix.KaspaDev }, + { PugdagConstants.ChainPrefixTestnet, KaspaBech32Prefix.KaspaTest }, + { PugdagConstants.ChainPrefixSimnet, KaspaBech32Prefix.KaspaSim }, + }; + + break; + case "CSS": + this.stringsToBech32Prefixes = new Dictionary + { + { ConsensusConstants.ChainPrefixMainnet, KaspaBech32Prefix.KaspaMain }, + { ConsensusConstants.ChainPrefixDevnet, KaspaBech32Prefix.KaspaDev }, + { ConsensusConstants.ChainPrefixTestnet, KaspaBech32Prefix.KaspaTest }, + { ConsensusConstants.ChainPrefixSimnet, KaspaBech32Prefix.KaspaSim }, + }; + + break; + case "BGA": this.stringsToBech32Prefixes = new Dictionary { { BugnaConstants.ChainPrefixMainnet, KaspaBech32Prefix.KaspaMain }, diff --git a/src/Miningcore/Configuration/ClusterConfigExtensions.cs b/src/Miningcore/Configuration/ClusterConfigExtensions.cs index a6a5fb721..dd1cb09ef 100644 --- a/src/Miningcore/Configuration/ClusterConfigExtensions.cs +++ b/src/Miningcore/Configuration/ClusterConfigExtensions.cs @@ -258,6 +258,8 @@ public override string GetAlgorithmName() { switch(Symbol) { + case "CSS": + case "PUG": case "KLS": case "NTL": case "NXL": diff --git a/src/Miningcore/coins.json b/src/Miningcore/coins.json index 9e4ebaa3e..3a38678e3 100644 --- a/src/Miningcore/coins.json +++ b/src/Miningcore/coins.json @@ -5549,6 +5549,36 @@ "explorerTxLink": "https://explorer.kobradag.online/txs/{0}", "explorerAccountLink": "https://explorer.kobradag.online/addresses/{0}" }, + "consensus": { + "name": "Consensus", + "canonicalName": "Consensus", + "symbol": "CSS", + "family": "kaspa", + "website": "https://consensus-network.com/", + "github": "https://github.com/consensus-network/consensusd", + "market": "", + "twitter": "https://twitter.com/Consensus_CSS", + "telegram": "https://t.me/consensus_network", + "discord": "", + "explorerBlockLink": "https://explorer.consensus-network.com/blocks/$hash$", + "explorerTxLink": "https://explorer.consensus-network.com/txs/{0}", + "explorerAccountLink": "https://explorer.consensus-network.com/addresses/{0}" + }, + "pugdag": { + "name": "Pugdag", + "canonicalName": "Pugdag", + "symbol": "PUG", + "family": "kaspa", + "website": "https://pugdag.com/", + "github": "https://github.com/Pugdag/pugdagd", + "market": "https://xeggex.com/market/PUG_USDT?ref=660c7f77a13a5706f612bbc8", + "twitter": "https://twitter.com/pug_dag", + "telegram": "https://t.me/pug_dag", + "discord": "https://discord.com/invite/pugdag", + "explorerBlockLink": "https://explorer.pugdag.com/blocks/$hash$", + "explorerTxLink": "https://explorer.pugdag.com/txs/{0}", + "explorerAccountLink": "https://explorer.pugdag.com/addresses/{0}" + }, "nvolve": { "name": "Nvolve", "symbol": "NVOL",