Skip to content

Commit 7eefa5e

Browse files
authored
Feature/bcp chain (#266)
* Add the BCP (Blockcore Platform) network definition - Generated from our own generator, with some minor modifications (namespace) after generation. * activate segwit from genesis * Fix max trx fee * Fix deployment setup for x42 - Fixes an issue with invalid deployment setup for x42. - Add debug configurations for RUTA. * Allow fees as low as the network configuration allows - Fixes an issue where x42 could not be used due to zero fee. Co-authored-by: SondreB
1 parent 731e74b commit 7eefa5e

18 files changed

Lines changed: 961 additions & 2 deletions

File tree

src/Blockcore.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blockcore.Features.Persiste
131131
EndProject
132132
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blockcore.Networks.Impleum", "Networks\Blockcore.Networks.Impleum\Blockcore.Networks.Impleum.csproj", "{64E9C309-867E-45F6-A88E-7BC061305D0B}"
133133
EndProject
134+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blockcore.Networks.BCP", "Networks\Blockcore.Networks.BCP\Blockcore.Networks.BCP.csproj", "{120500DF-C04F-43CC-9A1E-523A6429301F}"
135+
EndProject
134136
Global
135137
GlobalSection(SolutionConfigurationPlatforms) = preSolution
136138
Debug|Any CPU = Debug|Any CPU
@@ -345,6 +347,10 @@ Global
345347
{64E9C309-867E-45F6-A88E-7BC061305D0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
346348
{64E9C309-867E-45F6-A88E-7BC061305D0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
347349
{64E9C309-867E-45F6-A88E-7BC061305D0B}.Release|Any CPU.Build.0 = Release|Any CPU
350+
{120500DF-C04F-43CC-9A1E-523A6429301F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
351+
{120500DF-C04F-43CC-9A1E-523A6429301F}.Debug|Any CPU.Build.0 = Debug|Any CPU
352+
{120500DF-C04F-43CC-9A1E-523A6429301F}.Release|Any CPU.ActiveCfg = Release|Any CPU
353+
{120500DF-C04F-43CC-9A1E-523A6429301F}.Release|Any CPU.Build.0 = Release|Any CPU
348354
EndGlobalSection
349355
GlobalSection(SolutionProperties) = preSolution
350356
HideSolutionNode = FALSE
@@ -404,6 +410,7 @@ Global
404410
{8098D7F8-8B2F-451C-8DCB-90597B768F96} = {64694A14-97E0-4CBC-8032-754F9353B2DD}
405411
{4275AF0C-587B-4C9D-A100-0F2DD1702674} = {64694A14-97E0-4CBC-8032-754F9353B2DD}
406412
{64E9C309-867E-45F6-A88E-7BC061305D0B} = {3B56C02B-4468-4268-B797-851562789FCC}
413+
{120500DF-C04F-43CC-9A1E-523A6429301F} = {3B56C02B-4468-4268-B797-851562789FCC}
407414
EndGlobalSection
408415
GlobalSection(ExtensibilityGlobals) = postSolution
409416
SolutionGuid = {6C780ABA-5872-4B83-AD3F-A5BD423AD907}

src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
if (string.IsNullOrEmpty(this.Password)) { this.Alert = "Please enter a password"; return; }
226226
if (string.IsNullOrEmpty(this.Address)) { this.Alert = "Please enter a valid address"; return; }
227227
if (this.Amount == 0) { this.Alert = "Please enter the number of coins you want to send"; return; }
228-
if (this.Fee == 0) { this.Alert = "Please ensure you enter a fee"; return; }
228+
if (this.Fee < this.ConnectionManager.Network.MinTxFee) { this.Alert = $"The fee is lower than minimum ({this.ConnectionManager.Network.MinTxFee})"; return; }
229229

230230
this.Alert = string.Empty;
231231

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Blockcore.Consensus.Checkpoints;
4+
using Blockcore.Networks.BCP.Networks.Setup;
5+
using NBitcoin;
6+
7+
namespace Blockcore.Networks.BCP
8+
{
9+
internal class BCPSetup
10+
{
11+
internal static BCPSetup Instance = new BCPSetup();
12+
13+
internal CoinSetup Setup = new CoinSetup
14+
{
15+
FileNamePrefix = "bcp",
16+
ConfigFileName = "bcp.conf",
17+
Magic = "42-43-50-30",
18+
CoinType = 2009, // SLIP-0044: https://github.com/satoshilabs/slips/blob/master/slip-0044.md,
19+
PremineReward = 0,
20+
PoWBlockReward = 1,
21+
PoSBlockReward = 1,
22+
LastPowBlock = 12500,
23+
GenesisText = "build blockchains",
24+
TargetSpacing = TimeSpan.FromSeconds(64),
25+
ProofOfStakeTimestampMask = 0x0000000F, // 0x0000003F // 64 sec
26+
PoSVersion = 4
27+
};
28+
29+
internal NetworkSetup Main = new NetworkSetup
30+
{
31+
Name = "BCPMain",
32+
RootFolderName = "bcp",
33+
CoinTicker = "BCP",
34+
DefaultPort = 15001,
35+
DefaultRPCPort = 15002,
36+
DefaultAPIPort = 15003,
37+
PubKeyAddress = 58, // B https://en.bitcoin.it/wiki/List_of_address_prefixes
38+
ScriptAddress = 120, // b
39+
SecretAddress = 125,
40+
GenesisTime = 1610818015,
41+
GenesisNonce = 1374370,
42+
GenesisBits = 0x1E0FFFFF,
43+
GenesisVersion = 1,
44+
GenesisReward = Money.Zero,
45+
HashGenesisBlock = "000007841f9dc0a4e12e127a66bf895d526a5aad9f6857482f6c0edb89a09cf1",
46+
HashMerkleRoot = "4f931c99c7dc688b6e2284ad8d695e2cfb19af115749b8e3f485f8cdaabff1a7",
47+
DNS = new[] { "seed.blockcore.net", "bcp.seed.blockcore.net" },
48+
Nodes = new[] { "89.10.229.203" },
49+
Checkpoints = new Dictionary<int, CheckpointInfo>
50+
{
51+
// TODO: Add checkpoints as the network progresses.
52+
}
53+
};
54+
55+
internal NetworkSetup RegTest = new NetworkSetup
56+
{
57+
Name = "BCPRegTest",
58+
RootFolderName = "bcpregtest",
59+
CoinTicker = "TBCP",
60+
DefaultPort = 25001,
61+
DefaultRPCPort = 25002,
62+
DefaultAPIPort = 25003,
63+
PubKeyAddress = 111,
64+
ScriptAddress = 196,
65+
SecretAddress = 239,
66+
GenesisTime = 1610818118,
67+
GenesisNonce = 81461,
68+
GenesisBits = 0x1F00FFFF,
69+
GenesisVersion = 1,
70+
GenesisReward = Money.Zero,
71+
HashGenesisBlock = "00006ea4efad31207df6a5d60ab4399b95f3eee9a5381d848e6105c60ea63766",
72+
HashMerkleRoot = "1eee168fcc801467f7ae5379f94400f15f771800e06451c6246b50d00143d1d8",
73+
DNS = new[] { "seedregtest1.bcp.blockcore.net", "seedregtest.bcp.blockcore.net" },
74+
Nodes = new[] { "89.10.229.203" },
75+
Checkpoints = new Dictionary<int, CheckpointInfo>
76+
{
77+
// TODO: Add checkpoints as the network progresses.
78+
}
79+
};
80+
81+
internal NetworkSetup Test = new NetworkSetup
82+
{
83+
Name = "BCPTest",
84+
RootFolderName = "bcptest",
85+
CoinTicker = "TBCP",
86+
DefaultPort = 35001,
87+
DefaultRPCPort = 35002,
88+
DefaultAPIPort = 35003,
89+
PubKeyAddress = 111,
90+
ScriptAddress = 196,
91+
SecretAddress = 239,
92+
GenesisTime = 1610818124,
93+
GenesisNonce = 819,
94+
GenesisBits = 0x1F0FFFFF,
95+
GenesisVersion = 1,
96+
GenesisReward = Money.Zero,
97+
HashGenesisBlock = "000f2d143b4fe0fedb60b80d75fbdb2b91af97dbcf2f053d0a3c22f73557635e",
98+
HashMerkleRoot = "e3c2c263b5dd0b18ce12957872792615a27dd946ca7c2eb88d5ddb05ea14973d",
99+
DNS = new[] { "seedtest1.bcp.blockcore.net", "seedtest.bcp.blockcore.net" },
100+
Nodes = new[] { "89.10.229.203" },
101+
Checkpoints = new Dictionary<int, CheckpointInfo>
102+
{
103+
// TODO: Add checkpoints as the network progresses.
104+
}
105+
};
106+
107+
public bool IsPoSv3()
108+
{
109+
return Setup.PoSVersion == 3;
110+
}
111+
112+
public bool IsPoSv4()
113+
{
114+
return Setup.PoSVersion == 4;
115+
}
116+
}
117+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Authors>Blockcore</Authors>
5+
<AssemblyTitle>Blockcore.Networks.BCP</AssemblyTitle>
6+
<AssemblyName>Blockcore.Networks.BCP</AssemblyName>
7+
<PackageId>Blockcore.Networks.BCP</PackageId>
8+
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
9+
<IsPackable>true</IsPackable>
10+
</PropertyGroup>
11+
12+
<PropertyGroup>
13+
<LangVersion>latest</LangVersion>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\..\Features\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" />
18+
<ProjectReference Include="..\..\Features\Blockcore.Features.MemoryPool\Blockcore.Features.MemoryPool.csproj" />
19+
</ItemGroup>
20+
21+
</Project>

0 commit comments

Comments
 (0)