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

Commit

Permalink
Dev (#398)
Browse files Browse the repository at this point in the history
* Refactored TLS certificate loading

* Disable TLS 1.0

* Mini refactor

* WIP

* GC optimization for outgoing stratum traffic

* Prevent memory leak

* Re-enable proxy header spoofing protection and add support for IPv4 on IPv6

* Connection logging

* Refactor

* Cleanup

* Connection logging for unsecure connections rephrased

* WIP

* Logging cleanup

* Code cleanup

* WIP

* Added ignored linux socket error

* Bitcoin Diamond (BCD)

* BCD

* Reduced log noise

* WIP

* Coherent connection logging

* WIP

* Fixed Makefile

* Cryptonight Variant test

* WIP LibCryptonight

* WIP

* libcryptonight working

* Ignore certain exceptions during shutdown

* More tests

* Fixed blockrewardMultiplier getting initialized to zero

* Makefile warnings

* Makefile

* Makefile

* Improved SendAsync of StratumClient

* Bitcoin Gold Address decode fix

* WIP

* More BTG fixes

* And another BTG fix

* Trimming

* Comments

* Compile error fix

* WIP

* Revert BTG network diff

* Code cleanup

* Crash fix

* Fix async exceptions

* WIP

* Re-introduce sendQueue for StratumClient

* ProcessSendQueueAsync cleanup

* Replace NetMQ with clrzmq4

* Fix compile warnings

* WIP

* WIP

* ShareReceiver endianess fix

* Temporary disable telemetry

* TMP fix

* WIP

* Makefile consolidation

* disable optimizations for now on libcryptonight/Makefile

* Fix ZeroMQ message memory leaks

* More leak fixes

* O2

* Update README.md
Fixes #260

* BOM stripping

* Revert libcryptnight

* Revert "BOM stripping"

This reverts commit 8f7b73e.

* JSON trimming
  • Loading branch information
Oliver Weichhold authored Sep 24, 2018
1 parent 726de70 commit 133a9dd
Show file tree
Hide file tree
Showing 90 changed files with 8,404 additions and 726 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,25 @@ This is going to change in the future.
Coin | Implemented | Tested | Planned | Notes
:--- | :---: | :---: | :---: | :---:
Bitcoin | Yes | Yes | |
Bitcoin Cash | Yes | Yes | |
Bitcoin Gold | Yes | Yes | |
Bitcoin Diamond | Yes | Yes | |
Bitcoin Private | Yes | Yes | |
Litecoin | Yes | Yes | |
Zcash | Yes | Yes | |
Monero | Yes | Yes | |
Ethereum | Yes | Yes | | Requires [Parity](https://github.com/paritytech/parity/releases)
Ethereum Classic | Yes | Yes | | Requires [Parity](https://github.com/paritytech/parity/releases)
Expanse | Yes | Yes | | - **Not working for Byzantinium update**<br>- Requires [Parity](https://github.com/paritytech/parity/releases)
DASH | Yes | Yes | |
Bitcoin Gold | Yes | Yes | |
Bitcoin Cash | Yes | Yes | |
Vertcoin | Yes | Yes | |
Monacoin | Yes | Yes | |
Globaltoken | Yes | Yes | | Requires [GLT Daemon](https://globaltoken.org/#downloads)
Ellaism | Yes | Yes | | Requires [Parity](https://github.com/paritytech/parity/releases)
Groestlcoin | Yes | Yes | |
Dogecoin | Yes | No | |
DigiByte | Yes | Yes | |
Namecoin | Yes | No | |
Viacoin | Yes | No | |
Peercoin | Yes | No | |
Straks | Yes | Yes | |
Electroneum | Yes | Yes | |
Ravencoin | Yes | Yes | |
MoonCoin | Yes | Yes | |

#### Ethereum
Expand Down Expand Up @@ -87,6 +85,7 @@ This software comes with a built-in donation of 0.1% per block-reward to support

- [.Net Core 2.1 Runtime](https://www.microsoft.com/net/download/core#/runtime)
- [PostgreSQL Database](https://www.postgresql.org/)
- On Linux you also need to install the libzmq package for your platform (Ubuntu/Debian: libzmq5, CentOS epel: zeromq)
- Coin Daemon (per pool)
- To build and run on Linux refer to the section below

Expand Down Expand Up @@ -140,7 +139,7 @@ $ sudo dpkg -i packages-microsoft-prod.deb
$ sudo apt-get update -y
$ sudo apt-get install apt-transport-https -y
$ sudo apt-get update -y
$ sudo apt-get -y install dotnet-sdk-2.1 git cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev
$ sudo apt-get -y install dotnet-sdk-2.1 git cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
$ git clone https://github.com/coinfoundry/miningcore
$ cd miningcore/src/MiningCore
$ ./linux-build.sh
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#---------------------------------#

# Build worker image (VM template)
image: Visual Studio 2017
image:
- Visual Studio 2017

#---------------------------------#
# build configuration #
Expand Down
Binary file added libs/ZeroMQ.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions src/MiningCore.Tests/Crypto/CrytonoteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ public void Crytonote_Hash_Slow()
Assert.Equal("a845ffbdf83ae9a8ffa504a1011efbd5ed2294bb9da591d3b583740568402c00", result);
}

[Fact]
public void Crytonote_Hash_Slow_Variant_1()
{
var blobConverted = "0106a2aaafd505583cf50bcc743d04d831d2b119dc94ad88679e359076ee3f18d258ee138b3b42580100a4b1e2f4baf6ab7109071ab59bc52dba740d1de99fa0ae0c4afd6ea9f40c5d87ec01".HexToByteArray();
var result = LibCryptonote.CryptonightHashSlow(blobConverted, 1).ToHexString();

Assert.Equal("c41ec6434df8b2307ff3105ae15206f3fbdf5a99b35879c0a27b8b85a8e2704f", result);
}

[Fact]
public void Cryptonote_SlowHash_Should_Throw_On_Null_Argument()
{
Expand Down
35 changes: 34 additions & 1 deletion src/MiningCore.Tests/Crypto/HashingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,43 @@ public void X11_Hash()
[Fact]
public void X11_Hash_Should_Throw_On_Null_Input()
{
var hasher = new Sha256S();
var hasher = new X11();
Assert.Throws<ArgumentNullException>(() => hasher.Digest(null));
}

[Fact]
public void X13_Hash()
{
var hasher = new X13();
var result = hasher.Digest(testValue2).ToHexString();

Assert.Equal("55b2b7f940ffb87bdb138ebdb04b8f823aa55736852c06ea9de46124f85d70e9", result);
}

[Fact]
public void X13_Hash_Should_Throw_On_Null_Input()
{
var hasher = new X13();
Assert.Throws<ArgumentNullException>(() => hasher.Digest(null));
}

[Fact]
public void X13_BCD_Hash()
{
var hasher = new X13BCD();
var result = hasher.Digest(testValue2).ToHexString();

Assert.Equal("28c4e1abe8a009251c30031c566a652c84cff10056385496c21eb46cf88aeb7b", result);
}

[Fact]
public void X13_BCD_Hash_Should_Throw_On_Null_Input()
{
var hasher = new X13BCD();
Assert.Throws<ArgumentNullException>(() => hasher.Digest(null));
}


[Fact]
public void X17_Hash()
{
Expand Down
10 changes: 6 additions & 4 deletions src/MiningCore.Tests/MiningCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<Compile Remove="JsonRpc\**" />
<EmbeddedResource Remove="JsonRpc\**" />
<None Remove="JsonRpc\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="3.1.1" />
Expand All @@ -34,8 +40,4 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="JsonRpc\" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/MiningCore/Blockchain/Bitcoin/BitcoinConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public class DevDonation
{
{ CoinType.BTC, "17QnVor1B6oK1rWnVVBrdX9gFzVkZZbhDm" },
{ CoinType.BCH, "1LJGTzNDTuTvkHpTxNSdmAEBAXAnEHDVqQ" },
{ CoinType.BCD, "1CdZ2PXisTRxyB4bkvq5oka9YjBHGU5Z36" },
{ CoinType.LTC, "LTK6CWastkmBzGxgQhTTtCUjkjDA14kxzC" },
{ CoinType.DOGE, "DGDuKRhBewGP1kbUz4hszNd2p6dDzWYy9Q" },
{ CoinType.NMC, "NDSLDpFEcTbuRVcWHdJyiRZThVAcb5Z79o" },
Expand Down
10 changes: 6 additions & 4 deletions src/MiningCore/Blockchain/Bitcoin/BitcoinJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class BitcoinJob<TBlockTemplate>
protected IMasterClock clock;
protected IHashAlgorithm coinbaseHasher;
protected double shareMultiplier;
protected decimal blockRewardMultiplier;
protected decimal blockRewardMultiplier = 1.0m;
protected int extraNoncePlaceHolderLength;
protected IHashAlgorithm headerHasher;
protected bool isPoS;
Expand Down Expand Up @@ -154,7 +154,7 @@ protected virtual void BuildCoinbase()
bs.ReadWriteAsVarInt(ref sigScriptLength);
bs.ReadWrite(ref sigScriptInitialBytes);

// done
// done
coinbaseInitial = stream.ToArray();
coinbaseInitialHex = coinbaseInitial.ToHexString();
}
Expand Down Expand Up @@ -432,7 +432,7 @@ protected virtual byte[] BuildRawTransactionBuffer()
public virtual void Init(TBlockTemplate blockTemplate, string jobId,
PoolConfig poolConfig, ClusterConfig clusterConfig, IMasterClock clock,
IDestination poolAddressDestination, BitcoinNetworkType networkType,
bool isPoS, double shareMultiplier, decimal blockrewardMultiplier,
bool isPoS, double shareMultiplier, decimal? blockrewardMultiplier,
IHashAlgorithm coinbaseHasher, IHashAlgorithm headerHasher, IHashAlgorithm blockHasher)
{
Contract.RequiresNonNull(blockTemplate, nameof(blockTemplate));
Expand All @@ -457,7 +457,9 @@ public virtual void Init(TBlockTemplate blockTemplate, string jobId,
extraNoncePlaceHolderLength = BitcoinConstants.ExtranoncePlaceHolderLength;
this.isPoS = isPoS;
this.shareMultiplier = shareMultiplier;
this.blockRewardMultiplier = blockrewardMultiplier;

if(blockrewardMultiplier.HasValue)
this.blockRewardMultiplier = blockrewardMultiplier.Value;

this.coinbaseHasher = coinbaseHasher;
this.headerHasher = headerHasher;
Expand Down
Loading

0 comments on commit 133a9dd

Please sign in to comment.