Skip to content

Commit

Permalink
Add Etherchain[ETX]
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaolin1579 committed Sep 6, 2023
1 parent 5948644 commit 26eb343
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
7 changes: 7 additions & 0 deletions src/Miningcore/Blockchain/Ethereum/EthereumConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public class BitnetConstants
public const decimal BaseRewardInitial = 1.0m;
}

public class EtherChainConstants
{
public const decimal BaseRewardInitial = 6.0m;
}

public enum EthereumNetworkType
{
Main = 1,
Expand All @@ -175,6 +180,7 @@ public enum EthereumNetworkType
Rethereum = 622277,
Bitnet = 210,
OctaSpace = 800001,
EtherChain = 11777,

Unknown = -1,
}
Expand All @@ -198,6 +204,7 @@ public enum GethChainType
Rethereum = 622277,
Bitnet = 210,
OctaSpace = 800001,
EtherChain = 11777,

Unknown = -1,
}
Expand Down
23 changes: 13 additions & 10 deletions src/Miningcore/Blockchain/Ethereum/EthereumPayoutHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public async Task<Block[]> ClassifyBlocksAsync(IMiningPool pool, Block[] blocks,
var gasUsed = blockHashResponse.Response.GasUsed;

var burnedFee = (decimal) 0;
if(extraPoolConfig?.ChainTypeOverride == "Ethereum" || extraPoolConfig?.ChainTypeOverride == "Main" || extraPoolConfig?.ChainTypeOverride == "MainPow" || extraPoolConfig?.ChainTypeOverride == "Ubiq" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "Pink" || extraPoolConfig?.ChainTypeOverride == "JibChain" || extraPoolConfig?.ChainTypeOverride == "Altcoin" || extraPoolConfig?.ChainTypeOverride == "Pom" || extraPoolConfig?.ChainTypeOverride == "MaxxChain" || extraPoolConfig?.ChainTypeOverride == "Canxium" || extraPoolConfig?.ChainTypeOverride == "Rethereum" || extraPoolConfig?.ChainTypeOverride == "Bitnet" || extraPoolConfig?.ChainTypeOverride == "OctaSpace")
if(extraPoolConfig?.ChainTypeOverride == "Ethereum" || extraPoolConfig?.ChainTypeOverride == "Main" || extraPoolConfig?.ChainTypeOverride == "MainPow" || extraPoolConfig?.ChainTypeOverride == "Ubiq" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "Pink" || extraPoolConfig?.ChainTypeOverride == "JibChain" || extraPoolConfig?.ChainTypeOverride == "Altcoin" || extraPoolConfig?.ChainTypeOverride == "Pom" || extraPoolConfig?.ChainTypeOverride == "MaxxChain" || extraPoolConfig?.ChainTypeOverride == "Canxium" || extraPoolConfig?.ChainTypeOverride == "Rethereum" || extraPoolConfig?.ChainTypeOverride == "Bitnet" || extraPoolConfig?.ChainTypeOverride == "OctaSpace" || extraPoolConfig?.ChainTypeOverride == "EtherChain")
burnedFee = (baseGas * gasUsed / EthereumConstants.Wei);

block.Hash = blockHash;
Expand Down Expand Up @@ -291,7 +291,7 @@ public async Task PayoutAsync(IMiningPool pool, Balance[] balances, Cancellation
// ensure we have peers
var infoResponse = await rpcClient.ExecuteAsync<string>(logger, EC.GetPeerCount, ct);

if((networkType == EthereumNetworkType.Main || extraPoolConfig?.ChainTypeOverride == "Classic" || extraPoolConfig?.ChainTypeOverride == "Mordor" || networkType == EthereumNetworkType.MainPow || extraPoolConfig?.ChainTypeOverride == "Ubiq" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "Pink" || extraPoolConfig?.ChainTypeOverride == "JibChain" || extraPoolConfig?.ChainTypeOverride == "Altcoin" || extraPoolConfig?.ChainTypeOverride == "Pom" || extraPoolConfig?.ChainTypeOverride == "MaxxChain" || extraPoolConfig?.ChainTypeOverride == "Canxium" || extraPoolConfig?.ChainTypeOverride == "Rethereum" || extraPoolConfig?.ChainTypeOverride == "Bitnet" || extraPoolConfig?.ChainTypeOverride == "OctaSpace") &&
if((networkType == EthereumNetworkType.Main || extraPoolConfig?.ChainTypeOverride == "Classic" || extraPoolConfig?.ChainTypeOverride == "Mordor" || networkType == EthereumNetworkType.MainPow || extraPoolConfig?.ChainTypeOverride == "Ubiq" || extraPoolConfig?.ChainTypeOverride == "EtherOne" || extraPoolConfig?.ChainTypeOverride == "Pink" || extraPoolConfig?.ChainTypeOverride == "JibChain" || extraPoolConfig?.ChainTypeOverride == "Altcoin" || extraPoolConfig?.ChainTypeOverride == "Pom" || extraPoolConfig?.ChainTypeOverride == "MaxxChain" || extraPoolConfig?.ChainTypeOverride == "Canxium" || extraPoolConfig?.ChainTypeOverride == "Rethereum" || extraPoolConfig?.ChainTypeOverride == "Bitnet" || extraPoolConfig?.ChainTypeOverride == "OctaSpace" || extraPoolConfig?.ChainTypeOverride == "EtherChain") &&
(infoResponse.Error != null || string.IsNullOrEmpty(infoResponse.Response) ||
infoResponse.Response.IntegralFromHex<int>() < EthereumConstants.MinPayoutPeerCount))
{
Expand Down Expand Up @@ -401,25 +401,25 @@ internal static decimal GetBaseBlockReward(GethChainType chainType, ulong height

return UbiqConstants.BaseRewardInitial;

case GethChainType.JibChain:
case GethChainType.JibChain:
return JibChainConstants.BaseRewardInitial;

case GethChainType.Altcoin:
case GethChainType.Altcoin:
return AltcoinConstants.BaseRewardInitial;

case GethChainType.Pom:
case GethChainType.Pom:
return PomConstants.BaseRewardInitial;

case GethChainType.MaxxChain:
case GethChainType.MaxxChain:
if(height >= MaxxChainConstants.MaxxHardForkHeight)
return MaxxChainConstants.MaxxBlockReward;

return MaxxChainConstants.BaseRewardInitial;

case GethChainType.Canxium:
case GethChainType.Canxium:
return CanxiumConstants.BaseRewardInitial;

case GethChainType.Rethereum:
case GethChainType.Rethereum:
if(height >= RethereumConstants.LondonHeight)
return RethereumConstants.LondonBlockReward;
if(height >= RethereumConstants.ArrowGlacierHeight)
Expand All @@ -429,10 +429,10 @@ internal static decimal GetBaseBlockReward(GethChainType chainType, ulong height

return RethereumConstants.BaseRewardInitial;

case GethChainType.Bitnet:
case GethChainType.Bitnet:
return BitnetConstants.BaseRewardInitial;

case GethChainType.OctaSpace:
case GethChainType.OctaSpace:
if(height >= OctaSpaceConstants.TriangulumHardForkHeight)
return OctaSpaceConstants.TriangulumBlockReward;
if(height >= OctaSpaceConstants.VegaHardForkHeight)
Expand All @@ -456,6 +456,9 @@ internal static decimal GetBaseBlockReward(GethChainType chainType, ulong height

return OctaSpaceConstants.BaseRewardInitial;

case GethChainType.EtherChain:
return EtherChainConstants.BaseRewardInitial;

default:
throw new Exception("Unable to determine block reward: Unsupported chain type");
}
Expand Down
22 changes: 20 additions & 2 deletions src/Miningcore/coins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5163,7 +5163,7 @@
"canonicalName": "Bitnet-Money",
"symbol": "BTN",
"family": "ethereum",
"ethasher": "ethash",
"ethasher": "ethash",
"website": "https://bitnet.money/",
"market": "https://xeggex.com/market/BTN_USDT",
"twitter": "",
Expand All @@ -5189,11 +5189,29 @@
"discord": "https://discord.gg/octaspace",
"explorerBlockLinks": {
"block": "https://explorer.octa.space/block/$height$",
"uncle": "https://explorer.octa.space/block/$height$"
"uncle": "https://explorer.octa.space/block/$hash$"
},
"explorerTxLink": "https://explorer.octa.space/tx/{0}",
"explorerAccountLink": "https://explorer.octa.space/address/{0}",
},
"etherchain": {
"name": "EtherChain",
"canonicalName": "EtherChain",
"symbol": "ETX",
"family": "ethereum",
"ethasher": "ethash",
"website": "https://etherchain.io/",
"market": "",
"twitter": "https://twitter.com/EtherchainPoW",
"telegram": "",
"discord": "https://discord.gg/MawMAE38ep",
"explorerBlockLinks": {
"block": "https://explorer.etherchain.io/block/$height$",
"uncle": "https://explorer.etherchain.io/block/$hash$"
},
"explorerTxLink": "https://explorer.etherchain.io/tx/{0}",
"explorerAccountLink": "https://explorer.etherchain.io/address/{0}"
},
"ergo": {
"name": "Ergo",
"canonicalName": "Ergo",
Expand Down

0 comments on commit 26eb343

Please sign in to comment.