Skip to content

Commit 129c67d

Browse files
authored
Adding HomeCoin Network (#289)
* Adding HomeCoin
1 parent 8aefa13 commit 129c67d

17 files changed

Lines changed: 987 additions & 0 deletions

src/Blockcore.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blockcore.Networks.X1", "Ne
137137
EndProject
138138
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blockcore.Networks.XRC", "Networks\Blockcore.Networks.XRC\Blockcore.Networks.XRC.csproj", "{4615D1C6-14CD-47CA-8B78-A462A37057F6}"
139139
EndProject
140+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blockcore.Networks.HomeCoin", "Networks\Blockcore.Networks.HomeCoin\Blockcore.Networks.HomeCoin.csproj", "{074057D3-A1BE-409D-B4B4-F01CFA434D58}"
141+
EndProject
140142
Global
141143
GlobalSection(SolutionConfigurationPlatforms) = preSolution
142144
Debug|Any CPU = Debug|Any CPU
@@ -363,6 +365,10 @@ Global
363365
{4615D1C6-14CD-47CA-8B78-A462A37057F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
364366
{4615D1C6-14CD-47CA-8B78-A462A37057F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
365367
{4615D1C6-14CD-47CA-8B78-A462A37057F6}.Release|Any CPU.Build.0 = Release|Any CPU
368+
{074057D3-A1BE-409D-B4B4-F01CFA434D58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
369+
{074057D3-A1BE-409D-B4B4-F01CFA434D58}.Debug|Any CPU.Build.0 = Debug|Any CPU
370+
{074057D3-A1BE-409D-B4B4-F01CFA434D58}.Release|Any CPU.ActiveCfg = Release|Any CPU
371+
{074057D3-A1BE-409D-B4B4-F01CFA434D58}.Release|Any CPU.Build.0 = Release|Any CPU
366372
EndGlobalSection
367373
GlobalSection(SolutionProperties) = preSolution
368374
HideSolutionNode = FALSE
@@ -425,6 +431,7 @@ Global
425431
{120500DF-C04F-43CC-9A1E-523A6429301F} = {3B56C02B-4468-4268-B797-851562789FCC}
426432
{9A2BA15A-C316-42B4-8E4D-E01B4873190C} = {3B56C02B-4468-4268-B797-851562789FCC}
427433
{4615D1C6-14CD-47CA-8B78-A462A37057F6} = {3B56C02B-4468-4268-B797-851562789FCC}
434+
{074057D3-A1BE-409D-B4B4-F01CFA434D58} = {3B56C02B-4468-4268-B797-851562789FCC}
428435
EndGlobalSection
429436
GlobalSection(ExtensibilityGlobals) = postSolution
430437
SolutionGuid = {6C780ABA-5872-4B83-AD3F-A5BD423AD907}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Authors>Blockcore</Authors>
5+
<AssemblyTitle>Blockcore.Networks.HomeCoin</AssemblyTitle>
6+
<AssemblyName>Blockcore.Networks.HomeCoin</AssemblyName>
7+
<PackageId>Blockcore.Networks.HomeCoin</PackageId>
8+
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
9+
<IsPackable>true</IsPackable>
10+
</PropertyGroup>
11+
12+
<PropertyGroup>
13+
<LangVersion>latest</LangVersion>
14+
<Description>Home Crypto Coin</Description>
15+
<PackageProjectUrl>https://homecoin.ru</PackageProjectUrl>
16+
<RepositoryUrl>git://github.com/homecoin-ru/blockcore</RepositoryUrl>
17+
<PackageTags>blockchain;cryptocurrency;crypto;C#;.NET;bitcoin;blockcore,homecoin</PackageTags>
18+
<PackageIcon>icon.png</PackageIcon>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<EmbeddedResource Include="icon.png" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="..\..\Features\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" />
27+
<ProjectReference Include="..\..\Features\Blockcore.Features.MemoryPool\Blockcore.Features.MemoryPool.csproj" />
28+
<ProjectReference Include="..\..\Features\Blockcore.Features.Miner\Blockcore.Features.Miner.csproj" />
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<None Include="icon.png">
33+
<Pack>True</Pack>
34+
<PackagePath></PackagePath>
35+
</None>
36+
</ItemGroup>
37+
</Project>
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Blockcore.Consensus.Checkpoints;
4+
using HomeCoin.Networks.Setup;
5+
using NBitcoin;
6+
7+
namespace HomeCoin
8+
{
9+
internal class HomeCoinSetup
10+
{
11+
internal static HomeCoinSetup Instance = new HomeCoinSetup();
12+
13+
internal CoinSetup Setup = new CoinSetup
14+
{
15+
FileNamePrefix = "homecoin",
16+
ConfigFileName = "homecoin.conf",
17+
Magic = "48-4F-4D-45",
18+
CoinType = 100500, //0x80018894// SLIP-0044: https://github.com/satoshilabs/slips/blob/master/slip-0044.md,
19+
PremineReward = 1000000,
20+
PoWBlockReward = 10,
21+
PoSBlockReward = 10,
22+
LastPowBlock = 100500,
23+
MaxSupply = 21000000,
24+
GenesisText = "I'd like to know what this whole show is all about before it's out.",
25+
TargetSpacing = TimeSpan.FromSeconds(64),
26+
ProofOfStakeTimestampMask = 0x0000000F,
27+
PoSVersion = 3
28+
};
29+
30+
internal NetworkSetup Main = new NetworkSetup
31+
{
32+
Name = "HomeCoinMain",
33+
RootFolderName = "homecoin",
34+
CoinTicker = "HOME",
35+
DefaultPort = 33331,
36+
DefaultRPCPort = 33332,
37+
DefaultAPIPort = 33333,
38+
DefaultSignalRPort = 33334,
39+
PubKeyAddress = 40, // B https://en.bitcoin.it/wiki/List_of_address_prefixes
40+
ScriptAddress = 100, // b
41+
SecretAddress = 160,
42+
GenesisTime = 1614259698,
43+
GenesisNonce = 60494,
44+
GenesisBits = 0x1E0FFFFF,
45+
GenesisVersion = 1,
46+
GenesisReward = Money.Zero,
47+
HashGenesisBlock = "00000ae66e376bf115b9440f03a520bd88d28624ec6f13606b0d72051e56e635",
48+
HashMerkleRoot = "f54bfdb51ebda155c70525ed6ef4fee32ca2564b8532767661acf42015cd5542",
49+
DNS = new[] { "seed.homecoin.ru", "seed2.homecoin.ru", "seed3.homecoin.ru", "seed4.homecoin.ru", "seed5.homecoin.ru" },
50+
Nodes = new[] { "167.86.77.3", "167.86.126.130", "158.101.197.109", "158.101.206.15", "40.76.201.247" },
51+
Checkpoints = new Dictionary<int, CheckpointInfo>
52+
{
53+
{ 0, new CheckpointInfo(new uint256("0x00000ae66e376bf115b9440f03a520bd88d28624ec6f13606b0d72051e56e635"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) }, // Genisis
54+
{ 2, new CheckpointInfo(new uint256("0x346e8a928dc03b3d92249cc67666d905a92b09f18b7bb5308198d7a28562bd98"), new uint256("0x8503c0bca8aeca76ed38648896d164637bf7229f5d9865d2b26448d448675c43")) }, // Premine
55+
{ 1000, new CheckpointInfo(new uint256("0x10b7137bc293d3c9426b29548ff902fca123f60e7af8a844c8fa151a736dbb37"), new uint256("0x228f509a5761ca04c14e2c3aa1b2a3249485525dbc9c33e19271e13404c0a7ee")) },
56+
}
57+
};
58+
59+
internal NetworkSetup RegTest = new NetworkSetup
60+
{
61+
Name = "HomeCoinRegTest",
62+
RootFolderName = "homecoinregtest",
63+
CoinTicker = "THOME",
64+
DefaultPort = 43331,
65+
DefaultRPCPort = 43332,
66+
DefaultAPIPort = 43333,
67+
DefaultSignalRPort = 43334,
68+
PubKeyAddress = 111,
69+
ScriptAddress = 196,
70+
SecretAddress = 239,
71+
GenesisTime = 1614259704,
72+
GenesisNonce = 83376,
73+
GenesisBits = 0x1F00FFFF,
74+
GenesisVersion = 1,
75+
GenesisReward = Money.Zero,
76+
HashGenesisBlock = "00008e71ca88630fe4f8156b826f04f564858315e0d2d38ffaf583f3c269de44",
77+
HashMerkleRoot = "6c68247b2a96dabbcd8bffd2b0cc9adbca29662c7a94acedf3543ac3a98e9806",
78+
DNS = new[] { "regtestseed.homecoin.ru", "regtestseed2.homecoin.ru", "regtestseed3.homecoin.ru", "regtestseed4.homecoin.ru", "regtestseed5.homecoin.ru" },
79+
Nodes = new[] { "167.86.77.3", "167.86.126.130", "158.101.197.109", "158.101.196.76", "40.76.201.247" },
80+
Checkpoints = new Dictionary<int, CheckpointInfo>
81+
{
82+
// TODO: Add checkpoints as the network progresses.
83+
}
84+
};
85+
86+
internal NetworkSetup Test = new NetworkSetup
87+
{
88+
Name = "HomeCoinTest",
89+
RootFolderName = "homecointest",
90+
CoinTicker = "THOME",
91+
DefaultPort = 53331,
92+
DefaultRPCPort = 53331,
93+
DefaultAPIPort = 53331,
94+
DefaultSignalRPort = 53334,
95+
PubKeyAddress = 111,
96+
ScriptAddress = 196,
97+
SecretAddress = 239,
98+
GenesisTime = 1614259712,
99+
GenesisNonce = 1845,
100+
GenesisBits = 0x1F0FFFFF,
101+
GenesisVersion = 1,
102+
GenesisReward = Money.Zero,
103+
HashGenesisBlock = "0008c7ff991b012b8dc06bd91165b64b307e53f183d070850d8381f238c672df",
104+
HashMerkleRoot = "277acb69460036d6f4aa04408164be0c38d6cc1c10cc771fb1385696036fe742",
105+
DNS = new[] { "testseed.homecoin.ru", "testseed2.homecoin.ru", "testseed3.homecoin.ru", "testseed4.homecoin.ru", "testseed5.homecoin.ru" },
106+
Nodes = new[] { "167.86.77.3", "167.86.126.130", "158.101.197.109", "158.101.196.76", "40.76.201.247" },
107+
Checkpoints = new Dictionary<int, CheckpointInfo>
108+
{
109+
// TODO: Add checkpoints as the network progresses.
110+
}
111+
};
112+
113+
public bool IsPoSv3()
114+
{
115+
return this.Setup.PoSVersion == 3;
116+
}
117+
118+
public bool IsPoSv4()
119+
{
120+
return this.Setup.PoSVersion == 4;
121+
}
122+
}
123+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using Blockcore.Base.Deployments;
2+
using Blockcore.Consensus.ScriptInfo;
3+
using Blockcore.Consensus.TransactionInfo;
4+
5+
namespace HomeCoin.Networks.Deployments
6+
{
7+
/// <summary>
8+
/// BIP9 deployments for the Blockcore sample coin network.
9+
/// </summary>
10+
public class HomeCoinBIP9Deployments : BIP9DeploymentsArray
11+
{
12+
// The position of each deployment in the deployments array. Note that this is decoupled from the actual position of the flag bit for the deployment in the block version.
13+
public const int CSV = 0;
14+
public const int Segwit = 1;
15+
public const int ColdStaking = 2; // TODO: Move this to the end of the deployments to leave room for others from Bitcoin?
16+
17+
// The number of deployments.
18+
public const int NumberOfDeployments = 3;
19+
20+
/// <summary>
21+
/// Constructs the BIP9 deployments array.
22+
/// </summary>
23+
public HomeCoinBIP9Deployments() : base(NumberOfDeployments)
24+
{
25+
}
26+
27+
/// <summary>
28+
/// Gets the deployment flags to set when the deployment activates.
29+
/// </summary>
30+
/// <param name="deployment">The deployment number.</param>
31+
/// <returns>The deployment flags.</returns>
32+
public override BIP9DeploymentFlags GetFlags(int deployment)
33+
{
34+
// The flags get combined in the caller, so it is ok to make a fresh object here.
35+
var flags = new BIP9DeploymentFlags();
36+
37+
switch (deployment)
38+
{
39+
case ColdStaking:
40+
flags.ScriptFlags = ScriptVerify.CheckColdStakeVerify;
41+
break;
42+
43+
case CSV:
44+
// Start enforcing BIP68 (sequence locks), BIP112 (CHECKSEQUENCEVERIFY) and BIP113 (Median Time Past) using versionbits logic.
45+
flags.ScriptFlags = ScriptVerify.CheckSequenceVerify;
46+
flags.LockTimeFlags = Transaction.LockTimeFlags.VerifySequence | Transaction.LockTimeFlags.MedianTimePast;
47+
break;
48+
49+
case Segwit:
50+
// Start enforcing WITNESS rules using versionbits logic.
51+
flags.ScriptFlags = ScriptVerify.Witness;
52+
break;
53+
}
54+
55+
return flags;
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)