-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding HomeCoin Network #289
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/Networks/Blockcore.Networks.HomeCoin/Blockcore.Networks.HomeCoin.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Authors>Blockcore</Authors> | ||
<AssemblyTitle>Blockcore.Networks.HomeCoin</AssemblyTitle> | ||
<AssemblyName>Blockcore.Networks.HomeCoin</AssemblyName> | ||
<PackageId>Blockcore.Networks.HomeCoin</PackageId> | ||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild> | ||
<IsPackable>true</IsPackable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
<Description>Home Crypto Coin</Description> | ||
<PackageProjectUrl>https://homecoin.ru</PackageProjectUrl> | ||
<RepositoryUrl>git://github.com/homecoin-ru/blockcore</RepositoryUrl> | ||
<PackageTags>blockchain;cryptocurrency;crypto;C#;.NET;bitcoin;blockcore,homecoin</PackageTags> | ||
<PackageIcon>icon.png</PackageIcon> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="icon.png" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Features\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" /> | ||
<ProjectReference Include="..\..\Features\Blockcore.Features.MemoryPool\Blockcore.Features.MemoryPool.csproj" /> | ||
<ProjectReference Include="..\..\Features\Blockcore.Features.Miner\Blockcore.Features.Miner.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="icon.png"> | ||
<Pack>True</Pack> | ||
<PackagePath></PackagePath> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
123 changes: 123 additions & 0 deletions
123
src/Networks/Blockcore.Networks.HomeCoin/HomeCoinSetup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Blockcore.Consensus.Checkpoints; | ||
using HomeCoin.Networks.Setup; | ||
using NBitcoin; | ||
|
||
namespace HomeCoin | ||
{ | ||
internal class HomeCoinSetup | ||
{ | ||
internal static HomeCoinSetup Instance = new HomeCoinSetup(); | ||
|
||
internal CoinSetup Setup = new CoinSetup | ||
{ | ||
FileNamePrefix = "homecoin", | ||
ConfigFileName = "homecoin.conf", | ||
Magic = "48-4F-4D-45", | ||
CoinType = 100500, //0x80018894// SLIP-0044: https://github.com/satoshilabs/slips/blob/master/slip-0044.md, | ||
PremineReward = 1000000, | ||
PoWBlockReward = 10, | ||
PoSBlockReward = 10, | ||
LastPowBlock = 100500, | ||
MaxSupply = 21000000, | ||
GenesisText = "I'd like to know what this whole show is all about before it's out.", | ||
TargetSpacing = TimeSpan.FromSeconds(64), | ||
ProofOfStakeTimestampMask = 0x0000000F, | ||
PoSVersion = 3 | ||
}; | ||
|
||
internal NetworkSetup Main = new NetworkSetup | ||
{ | ||
Name = "HomeCoinMain", | ||
RootFolderName = "homecoin", | ||
CoinTicker = "HOME", | ||
DefaultPort = 33331, | ||
DefaultRPCPort = 33332, | ||
DefaultAPIPort = 33333, | ||
DefaultSignalRPort = 33334, | ||
PubKeyAddress = 40, // B https://en.bitcoin.it/wiki/List_of_address_prefixes | ||
sondreb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ScriptAddress = 100, // b | ||
SecretAddress = 160, | ||
GenesisTime = 1614259698, | ||
GenesisNonce = 60494, | ||
GenesisBits = 0x1E0FFFFF, | ||
GenesisVersion = 1, | ||
GenesisReward = Money.Zero, | ||
HashGenesisBlock = "00000ae66e376bf115b9440f03a520bd88d28624ec6f13606b0d72051e56e635", | ||
HashMerkleRoot = "f54bfdb51ebda155c70525ed6ef4fee32ca2564b8532767661acf42015cd5542", | ||
DNS = new[] { "seed.homecoin.ru", "seed2.homecoin.ru", "seed3.homecoin.ru", "seed4.homecoin.ru", "seed5.homecoin.ru" }, | ||
Nodes = new[] { "167.86.77.3", "167.86.126.130", "158.101.197.109", "158.101.206.15", "40.76.201.247" }, | ||
Checkpoints = new Dictionary<int, CheckpointInfo> | ||
{ | ||
{ 0, new CheckpointInfo(new uint256("0x00000ae66e376bf115b9440f03a520bd88d28624ec6f13606b0d72051e56e635"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) }, // Genisis | ||
{ 2, new CheckpointInfo(new uint256("0x346e8a928dc03b3d92249cc67666d905a92b09f18b7bb5308198d7a28562bd98"), new uint256("0x8503c0bca8aeca76ed38648896d164637bf7229f5d9865d2b26448d448675c43")) }, // Premine | ||
{ 1000, new CheckpointInfo(new uint256("0x10b7137bc293d3c9426b29548ff902fca123f60e7af8a844c8fa151a736dbb37"), new uint256("0x228f509a5761ca04c14e2c3aa1b2a3249485525dbc9c33e19271e13404c0a7ee")) }, | ||
} | ||
}; | ||
|
||
internal NetworkSetup RegTest = new NetworkSetup | ||
{ | ||
Name = "HomeCoinRegTest", | ||
RootFolderName = "homecoinregtest", | ||
CoinTicker = "THOME", | ||
DefaultPort = 43331, | ||
DefaultRPCPort = 43332, | ||
DefaultAPIPort = 43333, | ||
DefaultSignalRPort = 43334, | ||
PubKeyAddress = 111, | ||
ScriptAddress = 196, | ||
SecretAddress = 239, | ||
GenesisTime = 1614259704, | ||
GenesisNonce = 83376, | ||
GenesisBits = 0x1F00FFFF, | ||
GenesisVersion = 1, | ||
GenesisReward = Money.Zero, | ||
HashGenesisBlock = "00008e71ca88630fe4f8156b826f04f564858315e0d2d38ffaf583f3c269de44", | ||
HashMerkleRoot = "6c68247b2a96dabbcd8bffd2b0cc9adbca29662c7a94acedf3543ac3a98e9806", | ||
DNS = new[] { "regtestseed.homecoin.ru", "regtestseed2.homecoin.ru", "regtestseed3.homecoin.ru", "regtestseed4.homecoin.ru", "regtestseed5.homecoin.ru" }, | ||
Nodes = new[] { "167.86.77.3", "167.86.126.130", "158.101.197.109", "158.101.196.76", "40.76.201.247" }, | ||
Checkpoints = new Dictionary<int, CheckpointInfo> | ||
{ | ||
// TODO: Add checkpoints as the network progresses. | ||
} | ||
}; | ||
|
||
internal NetworkSetup Test = new NetworkSetup | ||
{ | ||
Name = "HomeCoinTest", | ||
RootFolderName = "homecointest", | ||
CoinTicker = "THOME", | ||
DefaultPort = 53331, | ||
DefaultRPCPort = 53331, | ||
DefaultAPIPort = 53331, | ||
DefaultSignalRPort = 53334, | ||
PubKeyAddress = 111, | ||
ScriptAddress = 196, | ||
SecretAddress = 239, | ||
GenesisTime = 1614259712, | ||
GenesisNonce = 1845, | ||
GenesisBits = 0x1F0FFFFF, | ||
GenesisVersion = 1, | ||
GenesisReward = Money.Zero, | ||
HashGenesisBlock = "0008c7ff991b012b8dc06bd91165b64b307e53f183d070850d8381f238c672df", | ||
HashMerkleRoot = "277acb69460036d6f4aa04408164be0c38d6cc1c10cc771fb1385696036fe742", | ||
DNS = new[] { "testseed.homecoin.ru", "testseed2.homecoin.ru", "testseed3.homecoin.ru", "testseed4.homecoin.ru", "testseed5.homecoin.ru" }, | ||
Nodes = new[] { "167.86.77.3", "167.86.126.130", "158.101.197.109", "158.101.196.76", "40.76.201.247" }, | ||
Checkpoints = new Dictionary<int, CheckpointInfo> | ||
{ | ||
// TODO: Add checkpoints as the network progresses. | ||
} | ||
}; | ||
|
||
public bool IsPoSv3() | ||
{ | ||
return this.Setup.PoSVersion == 3; | ||
} | ||
|
||
public bool IsPoSv4() | ||
{ | ||
return this.Setup.PoSVersion == 4; | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/Networks/Blockcore.Networks.HomeCoin/Networks/Deployments/HomeCoinBIP9Deployments.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using Blockcore.Base.Deployments; | ||
using Blockcore.Consensus.ScriptInfo; | ||
using Blockcore.Consensus.TransactionInfo; | ||
|
||
namespace HomeCoin.Networks.Deployments | ||
{ | ||
/// <summary> | ||
/// BIP9 deployments for the Blockcore sample coin network. | ||
/// </summary> | ||
public class HomeCoinBIP9Deployments : BIP9DeploymentsArray | ||
{ | ||
// 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. | ||
public const int CSV = 0; | ||
public const int Segwit = 1; | ||
public const int ColdStaking = 2; // TODO: Move this to the end of the deployments to leave room for others from Bitcoin? | ||
|
||
// The number of deployments. | ||
public const int NumberOfDeployments = 3; | ||
|
||
/// <summary> | ||
/// Constructs the BIP9 deployments array. | ||
/// </summary> | ||
public HomeCoinBIP9Deployments() : base(NumberOfDeployments) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets the deployment flags to set when the deployment activates. | ||
/// </summary> | ||
/// <param name="deployment">The deployment number.</param> | ||
/// <returns>The deployment flags.</returns> | ||
public override BIP9DeploymentFlags GetFlags(int deployment) | ||
{ | ||
// The flags get combined in the caller, so it is ok to make a fresh object here. | ||
var flags = new BIP9DeploymentFlags(); | ||
|
||
switch (deployment) | ||
{ | ||
case ColdStaking: | ||
flags.ScriptFlags = ScriptVerify.CheckColdStakeVerify; | ||
break; | ||
|
||
case CSV: | ||
// Start enforcing BIP68 (sequence locks), BIP112 (CHECKSEQUENCEVERIFY) and BIP113 (Median Time Past) using versionbits logic. | ||
flags.ScriptFlags = ScriptVerify.CheckSequenceVerify; | ||
flags.LockTimeFlags = Transaction.LockTimeFlags.VerifySequence | Transaction.LockTimeFlags.MedianTimePast; | ||
break; | ||
|
||
case Segwit: | ||
// Start enforcing WITNESS rules using versionbits logic. | ||
flags.ScriptFlags = ScriptVerify.Witness; | ||
break; | ||
} | ||
|
||
return flags; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this idea about overriding the default Blockcore properties. All individual network definitions should do the same.