Skip to content

Commit

Permalink
Add Kobradag[KODA]
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaolin1579 committed Jun 16, 2024
1 parent 80d4f66 commit 2ca2f37
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Miningcore/Blockchain/Kaspa/KaspaConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ public static class HoosatConstants
public const string ChainPrefixMainnet = "hoosat";
}

public static class KobradagConstants
{
// List of Kobra prefixes:
public const string ChainPrefixDevnet = "kobradev";
public const string ChainPrefixSimnet = "kobrasim";
public const string ChainPrefixTestnet = "kobratest";
public const string ChainPrefixMainnet = "kobra";
}

public static class KaspaConstants
{
public const string WalletDaemonCategory = "wallet";
Expand Down
15 changes: 15 additions & 0 deletions src/Miningcore/Blockchain/Kaspa/KaspaJobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,21 @@ private KaspaJob CreateJob(long blockHeight)
customBlockHeaderHasher = new Blake3(hashBytes);
}

if(customCoinbaseHasher is not Blake3)
customCoinbaseHasher = new Blake3();

if(customShareHasher is not Blake3)
customShareHasher = new Blake3();

return new PyrinJob(customBlockHeaderHasher, customCoinbaseHasher, customShareHasher);
case "KODA":
if(customBlockHeaderHasher is not Blake3)
{
string coinbaseBlockHash = KaspaConstants.CoinbaseBlockHash;
byte[] hashBytes = Encoding.UTF8.GetBytes(coinbaseBlockHash.PadRight(32, '\0')).Take(32).ToArray();
customBlockHeaderHasher = new Blake3(hashBytes);
}

if(customCoinbaseHasher is not Blake3)
customCoinbaseHasher = new Blake3();

Expand Down
10 changes: 10 additions & 0 deletions src/Miningcore/Blockchain/Kaspa/KaspaUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,16 @@ public KaspaAddressUtility(string coinSymbol = "KAS")
{ HoosatConstants.ChainPrefixSimnet, KaspaBech32Prefix.KaspaSim },
};

break;
case "KODA":
this.stringsToBech32Prefixes = new Dictionary<string, KaspaBech32Prefix>
{
{ KobradagConstants.ChainPrefixMainnet, KaspaBech32Prefix.KaspaMain },
{ KobradagConstants.ChainPrefixDevnet, KaspaBech32Prefix.KaspaDev },
{ KobradagConstants.ChainPrefixTestnet, KaspaBech32Prefix.KaspaTest },
{ KobradagConstants.ChainPrefixSimnet, KaspaBech32Prefix.KaspaSim },
};

break;
case "KLS":
this.stringsToBech32Prefixes = new Dictionary<string, KaspaBech32Prefix>
Expand Down
1 change: 1 addition & 0 deletions src/Miningcore/Configuration/ClusterConfigExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public override string GetAlgorithmName()
return "Karlsenhash";
case "CAS":
case "HTN":
case "KODA":
case "PYI":
return "Pyrinhash";
default:
Expand Down
14 changes: 14 additions & 0 deletions src/Miningcore/coins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5155,5 +5155,19 @@
"explorerBlockLink": "https://explorer.sedracoin.com/blocks/$hash$",
"explorerTxLink": "https://explorer.sedracoin.com/txs/{0}",
"explorerAccountLink": "https://explorer.sedracoin.com/addresses/{0}"
},
"kobradag": {
"name": "Kobradag",
"canonicalName": "Kobradag",
"symbol": "KODA",
"family": "kaspa",
"website": "https://k0bradag.com/",
"market": "",
"twitter": "https://twitter.com/k0bradag",
"telegram": "https://t.me/k0bradag",
"discord": "https://discord.com/invite/ahnm5zENqg",
"explorerBlockLink": "https://explorer.kobradag.online/blocks/$hash$",
"explorerTxLink": "https://explorer.kobradag.online/txs/{0}",
"explorerAccountLink": "https://explorer.kobradag.online/addresses/{0}"
}
}

0 comments on commit 2ca2f37

Please sign in to comment.