From b5794452d82d72e14ecfa8fa236654201d271aaa Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Thu, 6 Aug 2015 12:27:28 +0300 Subject: [PATCH] Initial commit Some stubs were implemented for basic classes. --- Novacoin.sln | 20 ++++++++++++++++ Novacoin/CBlock.cs | 27 +++++++++++++++++++++ Novacoin/CBlockHeader.cs | 42 +++++++++++++++++++++++++++++++++ Novacoin/CTransaction.cs | 38 ++++++++++++++++++++++++++++++ Novacoin/CTxIn.cs | 32 +++++++++++++++++++++++++ Novacoin/CTxOut.cs | 22 +++++++++++++++++ Novacoin/Hash160.cs | 20 ++++++++++++++++ Novacoin/Hash256.cs | 20 ++++++++++++++++ Novacoin/Novacoin.csproj | 44 +++++++++++++++++++++++++++++++++++ Novacoin/Properties/AssemblyInfo.cs | 27 +++++++++++++++++++++ 10 files changed, 292 insertions(+), 0 deletions(-) create mode 100644 Novacoin.sln create mode 100644 Novacoin/CBlock.cs create mode 100644 Novacoin/CBlockHeader.cs create mode 100644 Novacoin/CTransaction.cs create mode 100644 Novacoin/CTxIn.cs create mode 100644 Novacoin/CTxOut.cs create mode 100644 Novacoin/Hash160.cs create mode 100644 Novacoin/Hash256.cs create mode 100644 Novacoin/Novacoin.csproj create mode 100644 Novacoin/Properties/AssemblyInfo.cs diff --git a/Novacoin.sln b/Novacoin.sln new file mode 100644 index 0000000..e64f8e3 --- /dev/null +++ b/Novacoin.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Novacoin", "Novacoin\Novacoin.csproj", "{6C657EA6-E9FB-41D7-B949-B41DD5136748}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C657EA6-E9FB-41D7-B949-B41DD5136748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C657EA6-E9FB-41D7-B949-B41DD5136748}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C657EA6-E9FB-41D7-B949-B41DD5136748}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C657EA6-E9FB-41D7-B949-B41DD5136748}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = Novacoin\Novacoin.csproj + EndGlobalSection +EndGlobal diff --git a/Novacoin/CBlock.cs b/Novacoin/CBlock.cs new file mode 100644 index 0000000..ca217fe --- /dev/null +++ b/Novacoin/CBlock.cs @@ -0,0 +1,27 @@ +using System; + +namespace Novacoin +{ + public class CBlock + { + /// + /// Block header. + /// + public CBlockHeader header; + + /// + /// Transactions array. + /// + public CTransaction[] tx; + + /// + /// Block header signature. + /// + public byte[] signature; + + public CBlock () + { + } + } +} + diff --git a/Novacoin/CBlockHeader.cs b/Novacoin/CBlockHeader.cs new file mode 100644 index 0000000..0ccc1fb --- /dev/null +++ b/Novacoin/CBlockHeader.cs @@ -0,0 +1,42 @@ +using System; + +namespace Novacoin +{ + public class CBlockHeader + { + /// + /// Version of block schema. + /// + public uint nVersion; + + /// + /// Previous block hash. + /// + public Hash256 prevHash; + + /// + /// Merkle root hash. + /// + public Hash256 merkleRoot; + + /// + /// Block timestamp. + /// + public uint nTime; + + /// + /// Compressed difficulty representation. + /// + public uint nBits; + + /// + /// Nonce counter. + /// + public uint nNonce; + + public CBlockHeader () + { + } + } +} + diff --git a/Novacoin/CTransaction.cs b/Novacoin/CTransaction.cs new file mode 100644 index 0000000..e068a0d --- /dev/null +++ b/Novacoin/CTransaction.cs @@ -0,0 +1,38 @@ +using System; + +namespace Novacoin +{ + public class CTransaction + { + /// + /// Version of transaction schema. + /// + public uint nVersion; + + /// + /// Transaction timestamp. + /// + public uint nTime; + + /// + /// Array of transaction inputs + /// + public CTxIn[] inputs; + + /// + /// Array of transaction outputs + /// + public CTxOut[] outputs; + + /// + /// Block height or timestamp when transaction is final + /// + public uint nLockTime; + + public CTransaction () + { + + } + } +} + diff --git a/Novacoin/CTxIn.cs b/Novacoin/CTxIn.cs new file mode 100644 index 0000000..6c4b5ec --- /dev/null +++ b/Novacoin/CTxIn.cs @@ -0,0 +1,32 @@ +using System; + +namespace Novacoin +{ + public class CTxIn + { + /// + /// Hash of parent transaction. + /// + public Hash256 txID; + + /// + /// Parent input number. + /// + public uint nInput; + + /// + /// First half of script, signatures for the scriptPubKey + /// + public byte[] scriptSig; + + /// + /// Transaction variant number, irrelevant if nLockTime isn't specified. Its value is 0xffffffff by default. + /// + public uint nSequence; + + public CTxIn () + { + } + } +} + diff --git a/Novacoin/CTxOut.cs b/Novacoin/CTxOut.cs new file mode 100644 index 0000000..b072985 --- /dev/null +++ b/Novacoin/CTxOut.cs @@ -0,0 +1,22 @@ +using System; + +namespace Novacoin +{ + public class CTxOut + { + /// + /// Input value. + /// + public ulong nValue; + + /// + /// Second half of script which contains spending instructions. + /// + public byte[] scriptPubKey; + + public CTxOut () + { + } + } +} + diff --git a/Novacoin/Hash160.cs b/Novacoin/Hash160.cs new file mode 100644 index 0000000..8a995d5 --- /dev/null +++ b/Novacoin/Hash160.cs @@ -0,0 +1,20 @@ +using System; + +namespace Novacoin +{ + /// + /// Representation of pubkey/script hash. + /// + public class Hash160 + { + /// + /// Array of digest bytes. + /// + private byte[] h; + + public Hash160 () + { + } + } +} + diff --git a/Novacoin/Hash256.cs b/Novacoin/Hash256.cs new file mode 100644 index 0000000..655b300 --- /dev/null +++ b/Novacoin/Hash256.cs @@ -0,0 +1,20 @@ +using System; + +namespace Novacoin +{ + /// + /// Representation of SHA-256 hash + /// + public class Hash256 + { + /// + /// Array of digest bytes. + /// + private byte[] h; + + public Hash256 () + { + } + } +} + diff --git a/Novacoin/Novacoin.csproj b/Novacoin/Novacoin.csproj new file mode 100644 index 0000000..9f14b3c --- /dev/null +++ b/Novacoin/Novacoin.csproj @@ -0,0 +1,44 @@ + + + + Debug + AnyCPU + {6C657EA6-E9FB-41D7-B949-B41DD5136748} + Library + Novacoin + Novacoin + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Novacoin/Properties/AssemblyInfo.cs b/Novacoin/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c1da566 --- /dev/null +++ b/Novacoin/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("Novacoin")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("alex")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + -- 1.7.1