Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ $ sudo apt-get update -y
$ sudo apt-get -y install dotnet-sdk-2.2 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
$ dotnet publish -c Release --framework netcoreapp2.2 -o ../../build
$ dotnet publish -c Release --framework netcoreapp3.1 -o ../../build
```

#### Building on Windows
Expand All @@ -145,7 +145,7 @@ Download and install the [.Net Core 2.2 SDK](https://www.microsoft.com/net/downl
```dosbatch
> git clone https://github.com/coinfoundry/miningcore
> cd miningcore/src/Miningcore
> dotnet publish -c Release --framework netcoreapp2.2 -o ..\..\build
> dotnet publish -c Release --framework netcoreapp3.1 -o ..\..\build
```

#### Building on Windows - Visual Studio
Expand Down
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

#---------------------------------#
Expand All @@ -21,13 +21,13 @@ build_script:
- sh: sudo apt-get update -y && sudo apt-get -y install cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
- # Publish
- cd Miningcore
- dotnet publish -c Release --framework netcoreapp2.2
- dotnet publish -c Release --framework netcoreapp3.1
- # Publish Artifacts
- sh: (cd bin/Release/netcoreapp2.2 && mkdir miningcore && cp -r publish/* miningcore && tar cf miningcore-linux-ubuntu-x64.tar.gz miningcore && appveyor PushArtifact miningcore-linux-ubuntu-x64.tar.gz)
- cmd: cd bin\Release\netcoreapp2.2 && mkdir miningcore && xcopy publish\* miningcore /S && 7z a miningcore-win-x64.zip miningcore && appveyor PushArtifact miningcore-win-x64.zip && cd ..\..\..
- sh: (cd bin/Release/netcoreapp3.1 && mkdir miningcore && cp -r publish/* miningcore && tar cf miningcore-linux-ubuntu-x64.tar.gz miningcore && appveyor PushArtifact miningcore-linux-ubuntu-x64.tar.gz)
- cmd: cd bin\Release\netcoreapp3.1 && mkdir miningcore && xcopy publish\* miningcore /S && 7z a miningcore-win-x64.zip miningcore && appveyor PushArtifact miningcore-win-x64.zip && cd ..\..\..
- # Build Tests
- cd ../Miningcore.Tests
- dotnet build -c Release --framework netcoreapp2.2
- dotnet build -c Release --framework netcoreapp3.1

#---------------------------------#
# tests configuration #
Expand Down
8 changes: 4 additions & 4 deletions src/Miningcore.Tests/Miningcore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<Platforms>AnyCPU</Platforms>
<AssemblyName>Miningcore.Tests</AssemblyName>
Expand All @@ -35,7 +35,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.1.2" />
<PackageReference Include="Microsoft.AspNetCore.All" />
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -56,7 +56,7 @@
<!-- Copy library binaries from Miningcore build output on Windows -->
<Target Name="CopyLibsWin" AfterTargets="AfterBuild" Condition="'$(IsWindows)' == 'true'">
<ItemGroup>
<Libs Include="$(ProjectDir)..\Miningcore\bin\$(Configuration)\netcoreapp2.2\lib*.dll" />
<Libs Include="$(ProjectDir)..\Miningcore\bin\$(Configuration)\netcoreapp3.1\lib*.dll" />
</ItemGroup>

<Copy SourceFiles="@(Libs)" DestinationFolder="$(OutDir)" />
Expand All @@ -65,7 +65,7 @@
<!-- Copy library binaries from Miningcore build output on Linux -->
<Target Name="CopyLibsLinux" AfterTargets="AfterBuild" Condition="'$(IsLinux)' == 'true'">
<ItemGroup>
<Libs Include="$(ProjectDir)..\Miningcore\bin\$(Configuration)\netcoreapp2.2\lib*.so" />
<Libs Include="$(ProjectDir)..\Miningcore\bin\$(Configuration)\netcoreapp3.1\lib*.so" />
</ItemGroup>

<Copy SourceFiles="@(Libs)" DestinationFolder="$(OutDir)" />
Expand Down
28 changes: 22 additions & 6 deletions src/Miningcore/Api/Controllers/PoolApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,28 +160,37 @@ public async Task<MinerPerformanceStats[]> PagePoolMinersAsync(
con, pool.Id, start, page, pageSize)))
.Select(mapper.Map<MinerPerformanceStats>)
.ToArray();

Response.Headers.Add("x-total-count",miners.Length.ToString());
return miners;
}

[HttpGet("{poolId}/blocks")]
public async Task<Responses.Block[]> PagePoolBlocksPagedAsync(
string poolId, [FromQuery] int page, [FromQuery] int pageSize = 15, [FromQuery] BlockStatus[] state = null)
string poolId, [FromQuery] int page, [FromQuery] int _start ,[FromQuery] int _end ,[FromQuery] String _order ,[FromQuery] String _sort,[FromQuery] int perPage = 0,[FromQuery] int pageSize = 15, [FromQuery] BlockStatus[] state = null)
{
//http://192.168.2.2:4000/api/pools/indexchain/blocks?_end=10&_order=ASC&_sort=id&_start=0
var pool = GetPool(poolId);
if(perPage != 0){
pageSize = perPage;
}
bool shouldlimitbyid = _end > 0;

var blockStates = state != null && state.Length > 0 ?
state :
new[] { BlockStatus.Confirmed, BlockStatus.Pending, BlockStatus.Orphaned };

var blocks = (await cf.Run(con => blocksRepo.PageBlocksAsync(con, pool.Id, blockStates, page, pageSize)))
var blocks = shouldlimitbyid ? (await cf.Run(con => blocksRepo.PageBlocksAsyncPaged(con, pool.Id, blockStates, page, pageSize,_start,_end,_order,_sort)))
.Select(mapper.Map<Responses.Block>)
.ToArray():(await cf.Run(con => blocksRepo.PageBlocksAsync(con, pool.Id, blockStates, page, pageSize)))
.Select(mapper.Map<Responses.Block>)
.ToArray();

var totalcount = (await cf.Run(con => blocksRepo.PageBlocksAsync(con, pool.Id, blockStates, page, 100000000)))
.Select(mapper.Map<Responses.Block>)
.ToArray().Length;
// enrich blocks
var blockInfobaseDict = pool.Template.ExplorerBlockLinks;

foreach(var block in blocks)
if (_start == 0 && _end < _start)
foreach(var block in blocks)
{
// compute infoLink
if(blockInfobaseDict != null)
Expand All @@ -197,6 +206,8 @@ public async Task<MinerPerformanceStats[]> PagePoolMinersAsync(
}
}
}

Response.Headers.Add("x-total-count",totalcount.ToString());

return blocks;
}
Expand Down Expand Up @@ -226,6 +237,7 @@ public async Task<MinerPerformanceStats[]> PagePoolMinersAsync(
if(!string.IsNullOrEmpty(addressInfobaseUrl))
payment.AddressInfoLink = string.Format(addressInfobaseUrl, payment.Address);
}
Response.Headers.Add("x-total-count",payments.Length.ToString());

return payments;
}
Expand Down Expand Up @@ -294,6 +306,7 @@ public async Task<MinerPerformanceStats[]> PagePoolMinersAsync(
if(!string.IsNullOrEmpty(addressInfobaseUrl))
payment.AddressInfoLink = string.Format(addressInfobaseUrl, payment.Address);
}
Response.Headers.Add("x-total-count",payments.Length.ToString());

return payments;
}
Expand All @@ -311,6 +324,7 @@ public async Task<MinerPerformanceStats[]> PagePoolMinersAsync(
con, pool.Id, address, page, pageSize)))
.Select(mapper.Map<Responses.BalanceChange>)
.ToArray();
Response.Headers.Add("x-total-count",balanceChanges.Length.ToString());

return balanceChanges;
}
Expand All @@ -327,6 +341,7 @@ public async Task<AmountByDate[]> PageMinerEarningsByDayAsync(
var earnings = (await cf.Run(con => paymentsRepo.PageMinerPaymentsByDayAsync(
con, pool.Id, address, page, pageSize)))
.ToArray();
Response.Headers.Add("x-total-count",earnings.Length.ToString());

return earnings;
}
Expand All @@ -341,6 +356,7 @@ public async Task<AmountByDate[]> PageMinerEarningsByDayAsync(
throw new ApiException($"Invalid or missing miner address", HttpStatusCode.NotFound);

var result = await GetMinerPerformanceInternal(mode, pool, address);
Response.Headers.Add("x-total-count",result.Length.ToString());

return result;
}
Expand Down
1 change: 1 addition & 0 deletions src/Miningcore/Api/Responses/GetBlocksResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Miningcore.Api.Responses
{
public class Block
{
public long Id { get; set; }
public string PoolId { get; set; }
public ulong BlockHeight { get; set; }
public double NetworkDifficulty { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/Miningcore/Api/Responses/GetMinerStatsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Miningcore.Api.Responses
{
public class MinerPerformanceStats
{
public long Id { get; set; }
public string Miner { get; set; }
public double Hashrate { get; set; }
public double SharesPerSecond { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/Miningcore/Api/Responses/GetPaymentsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Miningcore.Api.Responses
{
public class Payment
{
public long Id { get; set; }
public string Coin { get; set; }
public string Address { get; set; }
public string AddressInfoLink { get; set; }
Expand Down
8 changes: 7 additions & 1 deletion src/Miningcore/Blockchain/Bitcoin/BitcoinConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public enum BitcoinAddressType
/// Bech encoded, segwit
/// </summary>
BechSegwit,
/// <summary>
/// Bcash custom bech encoded
/// </summary>
CashAddr,

}

public enum BitcoinTransactionCategory
Expand Down Expand Up @@ -70,8 +75,9 @@ public class BitcoinConstants
public const int ExtranoncePlaceHolderLength = 8;
public const decimal SatoshisPerBitcoin = 100000000;
public static double Pow2x32 = Math.Pow(2, 32);
public static double Pow2x42 = Math.Pow(2, 42);
public static readonly BigInteger Diff1 = BigInteger.Parse("00ffff0000000000000000000000000000000000000000000000000000", NumberStyles.HexNumber);
public const int CoinbaseMinConfimations = 102;
public const int CoinbaseMinConfimations = 101;

/// <summary>
/// Pool-side mask for version-rolling (Overt ASIC-Boost)
Expand Down
Loading