Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Added support for ZClassic. Also corrected BTG block explorer (#157)
Browse files Browse the repository at this point in the history
* Added correct BTG block explorer

* Added ZClassic

* Miner fixed to support ZCL

* Added ZCL to equihash coins

* Fixed incorrect way of typing Zclassic

* Cleaned coinmetadata file

* Trying to fix the whole changed file from git

* Fixed rejected segwit blocks in BTG - https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki
  • Loading branch information
martin-key authored and Oliver Weichhold committed Jan 16, 2018
1 parent c937147 commit 7d1c363
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 97 deletions.
1 change: 1 addition & 0 deletions src/MiningCore/Blockchain/Bitcoin/BitcoinConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class KnownAddresses
{CoinType.MONA, "MBbkeAM3VQKg474bgxJEXrtcnMg8cjHY3S"},
{CoinType.VTC, "VfCAvPVrksYvwcpU7E44e51HxfvVhcxMXf"},
{CoinType.ZEC, "t1YHZHz2DGVMJiggD2P4fBQ2TAPgtLSUwZ7"},
{CoinType.ZCL, "t1Ysa2CHdpMu8T2zjYXQNQxPgGh8ehe9QYo"},
{CoinType.BTG, "GQb77ZuMCyJGZFyxpzqNfm7GB1rQreP4n6"},
{CoinType.XMR, "475YVJbPHPedudkhrcNp1wDcLMTGYusGPF5fqE7XjnragVLPdqbCHBdZg3dF4dN9hXMjjvGbykS6a77dTAQvGrpiQqHp2eH"}
};
Expand Down
1 change: 1 addition & 0 deletions src/MiningCore/Blockchain/Bitcoin/BitcoinProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public class BitcoinProperties
// Equihash
{ CoinType.ZEC, equihashCoin },
{ CoinType.BTG, equihashCoin },
{ CoinType.ZCL, equihashCoin },
};

public static BitcoinCoinProperties GetCoinProperties(CoinType coin, string algorithm = null)
Expand Down
2 changes: 1 addition & 1 deletion src/MiningCore/Blockchain/BitcoinGold/BitcoinGoldJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public override void Init(ZCashBlockTemplate blockTemplate, string jobId,

// build tx hashes
var txHashes = new List<uint256> { new uint256(coinbaseInitialHash) };
txHashes.AddRange(BlockTemplate.Transactions.Select(tx => new uint256(tx.Hash.HexToByteArray().ReverseArray())));
txHashes.AddRange(BlockTemplate.Transactions.Select(tx => new uint256(tx.TxId.HexToByteArray().ReverseArray())));

// build merkle root
merkleRoot = MerkleNode.GetRoot(txHashes).Hash.ToBytes().ReverseArray();
Expand Down
191 changes: 97 additions & 94 deletions src/MiningCore/Blockchain/CoinMetaData.cs
Original file line number Diff line number Diff line change
@@ -1,94 +1,97 @@
using System.Collections.Generic;
using MiningCore.Blockchain.Ethereum;
using MiningCore.Configuration;

namespace MiningCore.Blockchain
{
public static class CoinMetaData
{
public static readonly Dictionary<CoinType, Dictionary<string, string>> BlockInfoLinks = new Dictionary<CoinType, Dictionary<string, string>>
{
{ CoinType.ETH, new Dictionary<string, string>
{
{ string.Empty, "https://etherscan.io/block/{0}" },
{ EthereumConstants.BlockTypeUncle, "https://etherscan.io/uncle/{0}" },
}},

{ CoinType.ETC, new Dictionary<string, string>
{
{ string.Empty, "https://gastracker.io/block/{0}" },
{ EthereumConstants.BlockTypeUncle, "https://gastracker.io/uncle/{0}" }
}},

{ CoinType.XMR, new Dictionary<string, string> { { string.Empty, "https://chainradar.com/xmr/block/{0}" }}},
{ CoinType.ETN, new Dictionary<string, string> { { string.Empty, "https://blockexplorer.electroneum.com/block/{0}" } }},
{ CoinType.LTC, new Dictionary<string, string> { { string.Empty, "http://explorer.litecoin.net/block/{0}" }}},
{ CoinType.BCH, new Dictionary<string, string> { { string.Empty, "https://www.blocktrail.com/BCC/block/{0}" }}},
{ CoinType.DASH, new Dictionary<string, string> { { string.Empty, "https://chainz.cryptoid.info/dash/block.dws?{0}.htm" }}},
{ CoinType.BTC, new Dictionary<string, string> { { string.Empty, "https://blockchain.info/block/{0}" }}},
{ CoinType.DOGE, new Dictionary<string, string> { { string.Empty, "https://dogechain.info/block/{0}" }}},
{ CoinType.ZEC, new Dictionary<string, string> { { string.Empty, "https://explorer.zcha.in/blocks/{0}" }}},
{ CoinType.DGB, new Dictionary<string, string> { { string.Empty, "https://digiexplorer.info/block/{0}" }}},
{ CoinType.NMC, new Dictionary<string, string> { { string.Empty, "https://explorer.namecoin.info/b/{0}" }}},
{ CoinType.GRS, new Dictionary<string, string> { { string.Empty, "https://groestlsight.groestlcoin.org/block/{0}" }}},
{ CoinType.MONA, new Dictionary<string, string> { { string.Empty, "https://bchain.info/MONA/block/{0}" }}},
{ CoinType.GLT, new Dictionary<string, string> { { string.Empty, "https://bchain.info/GLT/block/{0}" }}},
{ CoinType.VTC, new Dictionary<string, string> { { string.Empty, "https://bchain.info/VTC/block/{0}" }}},
//{ CoinType.BTG, new Dictionary<string, string> { { string.Empty, "https://btgexp.com/block/{0}" }}},
{ CoinType.ELLA, new Dictionary<string, string> { { string.Empty, "https://explorer.ellaism.org/block/{0}" }}},
{ CoinType.EXP, new Dictionary<string, string> { { string.Empty, "http://www.gander.tech/blocks/{0}" }}},
{ CoinType.AEON, new Dictionary<string, string> { { string.Empty, "https://chainradar.com/aeon/block/{0}" }}},
{ CoinType.STAK, new Dictionary<string, string> { { string.Empty, "https://straks.info/block/{0}" }}},
{ CoinType.MOON, new Dictionary<string, string> { { string.Empty, " https://chainz.cryptoid.info/moon/block.dws?{0}.htm" }}},
};

public static readonly Dictionary<CoinType, string> PaymentInfoLinks = new Dictionary<CoinType, string>
{
{ CoinType.XMR, "https://chainradar.com/xmr/transaction/{0}" },
{ CoinType.ETN, "https://blockexplorer.electroneum.com/tx/{0}" },
{ CoinType.ETH, "https://etherscan.io/tx/{0}" },
{ CoinType.ETC, "https://gastracker.io/tx/{0}" },
{ CoinType.LTC, "http://explorer.litecoin.net/tx/{0}" },
{ CoinType.BCH, "https://www.blocktrail.com/BCC/tx/{0}" },
{ CoinType.DASH, "https://chainz.cryptoid.info/dash/tx.dws?{0}.htm" },
{ CoinType.BTC, "https://blockchain.info/tx/{0}" },
{ CoinType.DOGE, "https://dogechain.info/tx/{0}" },
{ CoinType.ZEC, "https://explorer.zcha.in/transactions/{0}" },
{ CoinType.DGB, "https://digiexplorer.info/tx/{0}" },
{ CoinType.NMC, "https://explorer.namecoin.info/tx/{0}" },
{ CoinType.GRS, "https://groestlsight.groestlcoin.org/tx/{0}" },
{ CoinType.MONA, "https://bchain.info/MONA/tx/{0}" },
{ CoinType.STAK, "https://straks.info/transaction/{0}" },
{ CoinType.GLT, "https://bchain.info/GLT/tx/{0}" },
{ CoinType.VTC, "https://bchain.info/VTC/tx/{0}" },
{ CoinType.BTG, "https://btgexp.com/tx/{0}" },
{ CoinType.ELLA, "https://explorer.ellaism.org/tx/{0}" },
{ CoinType.EXP, "http://www.gander.tech/tx/{0}" },
{ CoinType.AEON, "https://chainradar.com/aeon/transaction/{0}" },
{ CoinType.MOON, "https://chainz.cryptoid.info/moon/tx.dws?{0}.htm" },
};

public static readonly Dictionary<CoinType, string> AddressInfoLinks = new Dictionary<CoinType, string>
{
{ CoinType.ETH, "https://etherscan.io/address/{0}" },
{ CoinType.ETC, "https://gastracker.io/addr/{0}" },
{ CoinType.LTC, "http://explorer.litecoin.net/address/{0}" },
{ CoinType.BCH, "https://www.blocktrail.com/BCC/address/{0}" },
{ CoinType.DASH, "https://chainz.cryptoid.info/dash/address.dws?{0}.htm" },
{ CoinType.BTC, "https://blockchain.info/address/{0}" },
{ CoinType.DOGE, "https://dogechain.info/address/{0}" },
{ CoinType.ZEC, "https://explorer.zcha.in/accounts/{0}" },
{ CoinType.DGB, "https://digiexplorer.info/address/{0}" },
{ CoinType.NMC, "https://explorer.namecoin.info/a/{0}" },
{ CoinType.GRS, "https://groestlsight.groestlcoin.org/address/{0}" },
{ CoinType.MONA, "https://bchain.info/MONA/addr/{0}" },
{ CoinType.STAK, "https://straks.info/address/{0}" },
{ CoinType.GLT, "https://bchain.info/GLT/addr/{0}" },
{ CoinType.VTC, "https://bchain.info/VTC/addr/{0}" },
{ CoinType.BTG, "https://btgexp.com/address/{0}" },
{ CoinType.ELLA, "https://explorer.ellaism.org/addr/{0}" },
{ CoinType.EXP, "http://www.gander.tech/address/{0}" },
{ CoinType.MOON, "https://chainz.cryptoid.info/moon/address.dws?{0}.htm" },
};
}
}
using System.Collections.Generic;
using MiningCore.Blockchain.Ethereum;
using MiningCore.Configuration;

namespace MiningCore.Blockchain
{
public static class CoinMetaData
{
public static readonly Dictionary<CoinType, Dictionary<string, string>> BlockInfoLinks = new Dictionary<CoinType, Dictionary<string, string>>
{
{ CoinType.ETH, new Dictionary<string, string>
{
{ string.Empty, "https://etherscan.io/block/{0}" },
{ EthereumConstants.BlockTypeUncle, "https://etherscan.io/uncle/{0}" },
}},

{ CoinType.ETC, new Dictionary<string, string>
{
{ string.Empty, "https://gastracker.io/block/{0}" },
{ EthereumConstants.BlockTypeUncle, "https://gastracker.io/uncle/{0}" }
}},

{ CoinType.XMR, new Dictionary<string, string> { { string.Empty, "https://chainradar.com/xmr/block/{0}" }}},
{ CoinType.ETN, new Dictionary<string, string> { { string.Empty, "https://blockexplorer.electroneum.com/block/{0}" } }},
{ CoinType.LTC, new Dictionary<string, string> { { string.Empty, "http://explorer.litecoin.net/block/{0}" }}},
{ CoinType.BCH, new Dictionary<string, string> { { string.Empty, "https://www.blocktrail.com/BCC/block/{0}" }}},
{ CoinType.DASH, new Dictionary<string, string> { { string.Empty, "https://chainz.cryptoid.info/dash/block.dws?{0}.htm" }}},
{ CoinType.BTC, new Dictionary<string, string> { { string.Empty, "https://blockchain.info/block/{0}" }}},
{ CoinType.DOGE, new Dictionary<string, string> { { string.Empty, "https://dogechain.info/block/{0}" }}},
{ CoinType.ZEC, new Dictionary<string, string> { { string.Empty, "https://explorer.zcha.in/blocks/{0}" }}},
{ CoinType.ZCL, new Dictionary<string, string> { { string.Empty, "http://explorer.zclmine.pro/blocks/{0}" }}},
{ CoinType.DGB, new Dictionary<string, string> { { string.Empty, "https://digiexplorer.info/block/{0}" }}},
{ CoinType.NMC, new Dictionary<string, string> { { string.Empty, "https://explorer.namecoin.info/b/{0}" }}},
{ CoinType.GRS, new Dictionary<string, string> { { string.Empty, "https://groestlsight.groestlcoin.org/block/{0}" }}},
{ CoinType.MONA, new Dictionary<string, string> { { string.Empty, "https://bchain.info/MONA/block/{0}" }}},
{ CoinType.GLT, new Dictionary<string, string> { { string.Empty, "https://bchain.info/GLT/block/{0}" }}},
{ CoinType.VTC, new Dictionary<string, string> { { string.Empty, "https://bchain.info/VTC/block/{0}" }}},
{ CoinType.BTG, new Dictionary<string, string> { { string.Empty, "https://btg-bitcore2.trezor.io/block/{0}" }}},
{ CoinType.ELLA, new Dictionary<string, string> { { string.Empty, "https://explorer.ellaism.org/block/{0}" }}},
{ CoinType.EXP, new Dictionary<string, string> { { string.Empty, "http://www.gander.tech/blocks/{0}" }}},
{ CoinType.AEON, new Dictionary<string, string> { { string.Empty, "https://chainradar.com/aeon/block/{0}" }}},
{ CoinType.STAK, new Dictionary<string, string> { { string.Empty, "https://straks.info/block/{0}" }}},
{ CoinType.MOON, new Dictionary<string, string> { { string.Empty, " https://chainz.cryptoid.info/moon/block.dws?{0}.htm" }}},
};

public static readonly Dictionary<CoinType, string> PaymentInfoLinks = new Dictionary<CoinType, string>
{
{ CoinType.XMR, "https://chainradar.com/xmr/transaction/{0}" },
{ CoinType.ETN, "https://blockexplorer.electroneum.com/tx/{0}" },
{ CoinType.ETH, "https://etherscan.io/tx/{0}" },
{ CoinType.ETC, "https://gastracker.io/tx/{0}" },
{ CoinType.LTC, "http://explorer.litecoin.net/tx/{0}" },
{ CoinType.BCH, "https://www.blocktrail.com/BCC/tx/{0}" },
{ CoinType.DASH, "https://chainz.cryptoid.info/dash/tx.dws?{0}.htm" },
{ CoinType.BTC, "https://blockchain.info/tx/{0}" },
{ CoinType.DOGE, "https://dogechain.info/tx/{0}" },
{ CoinType.ZEC, "https://explorer.zcha.in/transactions/{0}" },
{ CoinType.ZCL, "http://explorer.zclmine.pro/transactions/{0}" },
{ CoinType.DGB, "https://digiexplorer.info/tx/{0}" },
{ CoinType.NMC, "https://explorer.namecoin.info/tx/{0}" },
{ CoinType.GRS, "https://groestlsight.groestlcoin.org/tx/{0}" },
{ CoinType.MONA, "https://bchain.info/MONA/tx/{0}" },
{ CoinType.STAK, "https://straks.info/transaction/{0}" },
{ CoinType.GLT, "https://bchain.info/GLT/tx/{0}" },
{ CoinType.VTC, "https://bchain.info/VTC/tx/{0}" },
{ CoinType.BTG, "https://btgexp.com/tx/{0}" },
{ CoinType.ELLA, "https://explorer.ellaism.org/tx/{0}" },
{ CoinType.EXP, "http://www.gander.tech/tx/{0}" },
{ CoinType.AEON, "https://chainradar.com/aeon/transaction/{0}" },
{ CoinType.MOON, "https://chainz.cryptoid.info/moon/tx.dws?{0}.htm" },
};

public static readonly Dictionary<CoinType, string> AddressInfoLinks = new Dictionary<CoinType, string>
{
{ CoinType.ETH, "https://etherscan.io/address/{0}" },
{ CoinType.ETC, "https://gastracker.io/addr/{0}" },
{ CoinType.LTC, "http://explorer.litecoin.net/address/{0}" },
{ CoinType.BCH, "https://www.blocktrail.com/BCC/address/{0}" },
{ CoinType.DASH, "https://chainz.cryptoid.info/dash/address.dws?{0}.htm" },
{ CoinType.BTC, "https://blockchain.info/address/{0}" },
{ CoinType.DOGE, "https://dogechain.info/address/{0}" },
{ CoinType.ZEC, "https://explorer.zcha.in/accounts/{0}" },
{ CoinType.ZCL, "http://explorer.zclmine.pro/accounts/{0}" },
{ CoinType.DGB, "https://digiexplorer.info/address/{0}" },
{ CoinType.NMC, "https://explorer.namecoin.info/a/{0}" },
{ CoinType.GRS, "https://groestlsight.groestlcoin.org/address/{0}" },
{ CoinType.MONA, "https://bchain.info/MONA/addr/{0}" },
{ CoinType.STAK, "https://straks.info/address/{0}" },
{ CoinType.GLT, "https://bchain.info/GLT/addr/{0}" },
{ CoinType.VTC, "https://bchain.info/VTC/addr/{0}" },
{ CoinType.BTG, "https://btgexp.com/address/{0}" },
{ CoinType.ELLA, "https://explorer.ellaism.org/addr/{0}" },
{ CoinType.EXP, "http://www.gander.tech/address/{0}" },
{ CoinType.MOON, "https://chainz.cryptoid.info/moon/address.dws?{0}.htm" },
};
}
}
47 changes: 47 additions & 0 deletions src/MiningCore/Blockchain/ZCash/ZCashConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,58 @@ public class ZCashConstants
}
},
};

private static readonly Dictionary<BitcoinNetworkType, ZCashCoinbaseTxConfig> ZCLCoinbaseTxConfig = new Dictionary<BitcoinNetworkType, ZCashCoinbaseTxConfig>
{
{
BitcoinNetworkType.Main, new ZCashCoinbaseTxConfig
{
PayFoundersReward = false,
PercentFoundersReward = 0,
FoundersRewardSubsidyHalvingInterval = 0,
FoundersRewardSubsidySlowStartInterval = 0,

FoundersRewardAddresses = new[]
{
""
}
}
},
{
BitcoinNetworkType.Test, new ZCashCoinbaseTxConfig
{
PayFoundersReward = false,
PercentFoundersReward = 0,
FoundersRewardSubsidyHalvingInterval = 0,
FoundersRewardSubsidySlowStartInterval = 0,

FoundersRewardAddresses = new[]
{
""
}
}
},
{
BitcoinNetworkType.RegTest, new ZCashCoinbaseTxConfig
{
PayFoundersReward = false,
PercentFoundersReward = 0,
FoundersRewardSubsidyHalvingInterval = 0,
FoundersRewardSubsidySlowStartInterval = 0,

FoundersRewardAddresses = new[]
{
""
}
}
},
};

public static Dictionary<CoinType, Dictionary<BitcoinNetworkType, ZCashCoinbaseTxConfig>> CoinbaseTxConfig =
new Dictionary<CoinType, Dictionary<BitcoinNetworkType, ZCashCoinbaseTxConfig>>
{
{ CoinType.ZEC, ZCashCoinbaseTxConfig },
{ CoinType.ZCL, ZCLCoinbaseTxConfig }
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/MiningCore/Blockchain/ZCash/ZCashPayoutHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

namespace MiningCore.Blockchain.ZCash
{
[CoinMetadata(CoinType.ZEC)]
[CoinMetadata(CoinType.ZEC, CoinType.ZCL)]
public class ZCashPayoutHandler : BitcoinPayoutHandler
{
public ZCashPayoutHandler(
Expand Down
2 changes: 1 addition & 1 deletion src/MiningCore/Blockchain/ZCash/ZCashPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

namespace MiningCore.Blockchain.ZCash
{
[CoinMetadata(CoinType.ZEC)]
[CoinMetadata(CoinType.ZEC, CoinType.ZCL)]
public class ZCashPool : ZCashPoolBase<ZCashJob>
{
public ZCashPool(IComponentContext ctx,
Expand Down
1 change: 1 addition & 0 deletions src/MiningCore/Configuration/ClusterConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public enum CoinType
VIA, // Viacoin
PPC, // Peercoin
ZEC, // ZCash
ZCL, // Zcassic
ETH, // Ethereum
ETC, // Ethereum Classic
EXP, // Expanse
Expand Down

0 comments on commit 7d1c363

Please sign in to comment.