Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9ff1e2f
Create stale.yml
Sep 10, 2019
d72db18
Dupe prevention. Fixes #710
Dec 9, 2019
1faa235
Update to .net3 and add x16rv2
akshaynexus Mar 2, 2020
fef5d8f
add IndexChain
akshaynexus Mar 2, 2020
f200fdb
Refactor x16rv2 implementation
akshaynexus Mar 2, 2020
1e7462b
Add back orignal x16r code
akshaynexus Mar 2, 2020
cdabce0
Update AppVeyor to use Visual Studio 2019
akshaynexus Mar 2, 2020
db2db42
Fix hash type for IndexChain
akshaynexus Mar 2, 2020
963d704
Fixes for x16rv2 code
akshaynexus Mar 2, 2020
e117e1f
Changes for indexchain and general upgrades
akshaynexus Mar 3, 2020
a8d32c6
Updates for testing
akshaynexus Mar 4, 2020
eac84eb
Minor fixes for Header hash
akshaynexus Mar 4, 2020
9218683
Working IDX mining code
akshaynexus Mar 20, 2020
8d95a93
More modifications to api for react-admin
akshaynexus Mar 21, 2020
3f080fd
Fix Quarkhash
akshaynexus Mar 21, 2020
3ddb15c
log only each 1000 shares
akshaynexus Mar 22, 2020
ec205e9
Add Yespower_sugar hash,Add CashAddr support and DVT.
akshaynexus Mar 24, 2020
37cf750
Set default addr type as cashaddr for dvt and bchabc
akshaynexus Mar 24, 2020
e042e92
Add support for DVT coinbase_payload
akshaynexus Mar 24, 2020
9b4c63c
Use CashAddrToDestination for DVT coinbase_payload txes
akshaynexus Mar 24, 2020
33f2151
Remove extra payee code
akshaynexus Mar 24, 2020
2b638b4
Add IDX handler and hashrate fix for x16v2
akshaynexus Apr 17, 2020
5521fe7
Merge pull request #1 from akshaynexus/devault
akshaynexus Apr 17, 2020
5f47bb6
Add PigeonCoin testnet code.
akshaynexus Apr 17, 2020
fe6750c
Add support for current PGN Mainnet
akshaynexus Apr 23, 2020
be50613
Fix error on devfee code for PGN Mainnet
akshaynexus Apr 23, 2020
6c6b146
Fix coinbase payload code
akshaynexus Apr 24, 2020
36dddcb
use CashAddr for payee on coinbasepayload for DVT
akshaynexus Apr 24, 2020
852cfde
Dont hardcode addrtypes and minor fixes
akshaynexus Apr 24, 2020
7dd1c41
Fix DVT address url and add sugarchain to coins
akshaynexus Apr 24, 2020
7fcc663
Fix coinbase hasher for sugarchain to sha256
akshaynexus Apr 24, 2020
7994b2c
Fix hashtype for Sugarchain
akshaynexus Apr 24, 2020
2cf060d
add sugarchain testnet as seperate entry
akshaynexus Apr 25, 2020
d56dc7b
add BechPrefix to extrapoolconfig
akshaynexus Apr 25, 2020
6ee34db
Fix yesPower_sugarchain hash code
akshaynexus Apr 25, 2020
9b7fdc1
Cleanup devault coinbase_payload code and add PEXA
akshaynexus Apr 26, 2020
3cdffac
wip kawpow code
akshaynexus Apr 27, 2020
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