Skip to content

Commit 155e388

Browse files
committed
Add Rincoin
1 parent 4773a46 commit 155e388

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

src/Miningcore/Blockchain/Bitcoin/BitcoinJob.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Newtonsoft.Json.Linq;
1616
using Contract = Miningcore.Contracts.Contract;
1717
using Transaction = NBitcoin.Transaction;
18+
using System.Numerics;
1819

1920
namespace Miningcore.Blockchain.Bitcoin;
2021

@@ -431,7 +432,8 @@ protected virtual (Share Share, string BlockHex) ProcessShareInternal(
431432
var headerValue = new uint256(headerHash);
432433

433434
// calc share-diff
434-
var shareDiff = (double) new BigRational(BitcoinConstants.Diff1, headerHash.ToBigInteger()) * shareMultiplier;
435+
var diff1 = coin.Diff1 != null ? BigInteger.Parse(coin.Diff1, NumberStyles.HexNumber) : BitcoinConstants.Diff1; // ?????Bitcoin??
436+
var shareDiff = (double) new BigRational(diff1, headerHash.ToBigInteger()) * shareMultiplier;
435437
var stratumDifficulty = context.Difficulty;
436438
var ratio = shareDiff / stratumDifficulty;
437439

@@ -522,10 +524,11 @@ protected virtual byte[] SerializeBlock(byte[] header, byte[] coinbase)
522524
{
523525
var separator = new byte[] { 0x01 };
524526
var mweb = BlockTemplate.Extra.SafeExtensionDataAs<MwebBlockTemplateExtra>();
525-
var mwebRaw = mweb.Mweb.HexToByteArray();
526-
527-
bs.ReadWrite(separator);
528-
bs.ReadWrite(mwebRaw);
527+
if (mweb != null && mweb.Mweb != null) {
528+
var mwebRaw = mweb.Mweb.HexToByteArray();
529+
bs.ReadWrite(separator);
530+
bs.ReadWrite(mwebRaw);
531+
}
529532
}
530533

531534
return stream.ToArray();

src/Miningcore/Configuration/ClusterConfig.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ public class BitcoinNetworkParams
206206
public JObject HeaderHasher { get; set; }
207207
public JObject BlockHasher { get; set; }
208208

209+
[JsonProperty("diff1")]
210+
public string Diff1 { get; set; }
211+
209212
[JsonProperty("posBlockHasher")]
210213
public JObject PoSBlockHasher { get; set; }
211214

src/Miningcore/coins.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6649,5 +6649,35 @@
66496649
"explorerBlockLink": "https://explorer.crionic.org/block/$height$",
66506650
"explorerTxLink": "https://explorer.crionic.org/tx/{0}",
66516651
"explorerAccountLink": "https://explorer.crionic.org/address/{0}"
6652+
},
6653+
"rincoin": {
6654+
"name": "Rincoin",
6655+
"canonicalName": "Rincoin",
6656+
"symbol": "RIN",
6657+
"family": "bitcoin",
6658+
"website": "https://coin.rin.so/",
6659+
"market": "",
6660+
"twitter": "",
6661+
"telegram": "",
6662+
"discord": "https://discord.gg/Ap7TUXYRBf",
6663+
"coinbaseHasher": {
6664+
"hash": "sha256d"
6665+
},
6666+
"headerHasher": {
6667+
"hash": "rinhash"
6668+
},
6669+
"blockHasher": {
6670+
"hash": "reverse",
6671+
"args": [
6672+
{
6673+
"hash": "rinhash"
6674+
}
6675+
]
6676+
},
6677+
"hasMWEB": true,
6678+
"diff1": "0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
6679+
"explorerBlockLink": "https://rin-explorer.coin-miners.info/block/$hash$",
6680+
"explorerTxLink": "https://rin-explorer.coin-miners.info/tx/{0}",
6681+
"explorerAccountLink": "https://rin-explorer.coin-miners.info/address/{0}"
66526682
}
66536683
}

0 commit comments

Comments
 (0)