Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
destream-blockchain
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
destream-blockchain
Commits
2edbb663
Commit
2edbb663
authored
Jul 17, 2018
by
Pavel Pavlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added classes DeStreamMain, DeStreamTest, DeStreamRegTest
parent
99885838
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
336 deletions
+154
-336
DeStream.Networks.cs
Sources/NBitcoin/DeStream.Networks.cs
+34
-293
DeStreamMain.cs
Sources/NBitcoin/Networks/DeStreamMain.cs
+0
-43
DeStreamRegTest.cs
Sources/NBitcoin/Networks/DeStreamRegTest.cs
+10
-0
DeStreamTest.cs
Sources/NBitcoin/Networks/DeStreamTest.cs
+110
-0
No files found.
Sources/NBitcoin/DeStream.Networks.cs
View file @
2edbb663
This diff is collapsed.
Click to expand it.
Sources/NBitcoin/Networks/DeStreamMain.cs
View file @
2edbb663
...
...
@@ -9,15 +9,6 @@ namespace NBitcoin.Networks
{
public
class
DeStreamMain
:
Network
{
/// <summary> The name of the root folder containing the different Stratis blockchains (StratisMain, StratisTest, StratisRegTest). </summary>
public
const
string
DeStreamRootFolderName
=
"destream"
;
/// <summary> The default name used for the Stratis configuration file. </summary>
public
const
string
DeStreamDefaultConfigFilename
=
"destream.conf"
;
public
const
int
StratisMaxTimeOffsetSeconds
=
25
*
60
;
public
const
int
StratisDefaultMaxTipAgeInSeconds
=
2
*
60
*
60
;
public
DeStreamMain
()
{
...
...
@@ -131,39 +122,5 @@ namespace NBitcoin.Networks
this
.
SeedNodes
.
Add
(
addr
);
}
}
private
static
Block
CreateStratisGenesisBlock
(
ConsensusFactory
consensusFactory
,
uint
nTime
,
uint
nNonce
,
uint
nBits
,
int
nVersion
,
Money
genesisReward
)
{
string
pszTimestamp
=
"http://www.theonion.com/article/olympics-head-priestess-slits-throat-official-rio--53466"
;
return
CreateStratisGenesisBlock
(
consensusFactory
,
pszTimestamp
,
nTime
,
nNonce
,
nBits
,
nVersion
,
genesisReward
);
}
private
static
Block
CreateStratisGenesisBlock
(
ConsensusFactory
consensusFactory
,
string
pszTimestamp
,
uint
nTime
,
uint
nNonce
,
uint
nBits
,
int
nVersion
,
Money
genesisReward
)
{
Transaction
txNew
=
consensusFactory
.
CreateTransaction
();
txNew
.
Version
=
1
;
txNew
.
Time
=
nTime
;
txNew
.
AddInput
(
new
TxIn
()
{
ScriptSig
=
new
Script
(
Op
.
GetPushOp
(
0
),
new
Op
()
{
Code
=
(
OpcodeType
)
0x1
,
PushData
=
new
[]
{
(
byte
)
42
}
},
Op
.
GetPushOp
(
Encoders
.
ASCII
.
DecodeData
(
pszTimestamp
)))
});
txNew
.
AddOutput
(
new
TxOut
()
{
Value
=
genesisReward
,
});
Block
genesis
=
consensusFactory
.
CreateBlock
();
genesis
.
Header
.
BlockTime
=
Utils
.
UnixTimeToDateTime
(
nTime
);
genesis
.
Header
.
Bits
=
nBits
;
genesis
.
Header
.
Nonce
=
nNonce
;
genesis
.
Header
.
Version
=
nVersion
;
genesis
.
Transactions
.
Add
(
txNew
);
genesis
.
Header
.
HashPrevBlock
=
uint256
.
Zero
;
genesis
.
UpdateMerkleRoot
();
return
genesis
;
}
}
}
Sources/NBitcoin/Networks/DeStreamRegTest.cs
0 → 100644
View file @
2edbb663
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
NBitcoin.Networks
{
class
DeStreamRegTest
{
}
}
Sources/NBitcoin/Networks/DeStreamTest.cs
0 → 100644
View file @
2edbb663
using
System
;
using
System.Collections.Generic
;
using
System.Net
;
using
System.Text
;
using
NBitcoin.BouncyCastle.Math
;
using
NBitcoin.DataEncoders
;
using
NBitcoin.Protocol
;
namespace
NBitcoin.Networks
{
public
class
DeStreamTest
:
Network
{
public
DeStreamTest
()
{
//The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF - 8, and produce
// a large 4 - byte int at any alignment.
var
messageStart
=
new
byte
[
4
];
messageStart
[
0
]
=
0x71
;
messageStart
[
1
]
=
0x31
;
messageStart
[
2
]
=
0x21
;
messageStart
[
3
]
=
0x11
;
var
magic
=
BitConverter
.
ToUInt32
(
messageStart
,
0
);
// 0x11213171;
this
.
Name
=
"DeStreamTest"
;
this
.
RootFolderName
=
DeStreamRootFolderName
;
this
.
DefaultConfigFilename
=
DeStreamDefaultConfigFilename
;
this
.
Magic
=
magic
;
this
.
DefaultPort
=
0xDE11
;
//56849,
this
.
RPCPort
=
0xDE10
;
//56848,
this
.
MaxTimeOffsetSeconds
=
StratisMaxTimeOffsetSeconds
;
this
.
MaxTipAge
=
StratisDefaultMaxTipAgeInSeconds
;
this
.
MinTxFee
=
10000
;
this
.
FallbackFee
=
60000
;
this
.
MinRelayTxFee
=
10000
;
this
..
Consensus
.
SubsidyHalvingInterval
=
210000
;
this
.
Consensus
.
MajorityEnforceBlockUpgrade
=
750
;
this
.
Consensus
.
MajorityRejectBlockOutdated
=
950
;
this
.
Consensus
.
MajorityWindow
=
1000
;
this
.
Consensus
.
BuriedDeployments
[
BuriedDeployments
.
BIP34
]
=
0
;
this
.
Consensus
.
BuriedDeployments
[
BuriedDeployments
.
BIP65
]
=
0
;
this
.
Consensus
.
BuriedDeployments
[
BuriedDeployments
.
BIP66
]
=
0
;
this
.
Consensus
.
BIP34Hash
=
new
uint256
(
"0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"
);
this
.
Consensus
.
PowLimit
=
new
Target
(
new
uint256
(
"0000ffff00000000000000000000000000000000000000000000000000000000"
));
this
.
Consensus
.
PowTargetTimespan
=
TimeSpan
.
FromSeconds
(
14
*
24
*
60
*
60
);
// two weeks
this
.
Consensus
.
PowTargetSpacing
=
TimeSpan
.
FromSeconds
(
10
*
60
);
this
.
Consensus
.
PowAllowMinDifficultyBlocks
=
false
;
this
.
Consensus
.
PowNoRetargeting
=
false
;
this
.
Consensus
.
RuleChangeActivationThreshold
=
1916
;
// 95% of 2016
this
.
Consensus
.
MinerConfirmationWindow
=
2016
;
// nPowTargetTimespan / nPowTargetSpacing
this
.
Consensus
.
LastPOWBlock
=
12500
;
this
.
Consensus
.
IsProofOfStake
=
true
;
this
.
Consensus
.
ConsensusFactory
=
new
PosConsensusFactory
()
{
Consensus
=
network
.
Consensus
};
this
.
Consensus
.
ProofOfStakeLimit
=
new
BigInteger
(
uint256
.
Parse
(
"00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
).
ToBytes
(
false
));
this
.
Consensus
.
ProofOfStakeLimitV2
=
new
BigInteger
(
uint256
.
Parse
(
"000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff"
).
ToBytes
(
false
));
this
.
Consensus
.
CoinType
=
105
;
this
.
Consensus
.
DefaultAssumeValid
=
new
uint256
(
"0x98fa6ef0bca5b431f15fd79dc6f879dc45b83ed4b1bbe933a383ef438321958e"
);
// 372652
Block
genesis
=
CreateStratisGenesisBlock
(
this
.
Consensus
.
ConsensusFactory
,
1470467000
,
1831645
,
0x1e0fffff
,
1
,
Money
.
Zero
);
genesis
.
Header
.
Time
=
1493909211
;
genesis
.
Header
.
Nonce
=
2433759
;
genesis
.
Header
.
Bits
=
this
.
Consensus
.
PowLimit
;
this
.
Genesis
=
genesis
;
this
.
Consensus
.
HashGenesisBlock
=
genesis
.
GetHash
();
Assert
(
this
.
Consensus
.
HashGenesisBlock
==
uint256
.
Parse
(
"0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"
));
this
.
Checkpoints
=
new
Dictionary
<
int
,
CheckpointInfo
>
{
{
0
,
new
CheckpointInfo
(
new
uint256
(
"0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"
),
new
uint256
(
"0x0000000000000000000000000000000000000000000000000000000000000000"
))
},
{
2
,
new
CheckpointInfo
(
new
uint256
(
"0x56959b1c8498631fb0ca5fe7bd83319dccdc6ac003dccb3171f39f553ecfa2f2"
),
new
uint256
(
"0x13f4c27ca813aefe2d9018077f8efeb3766796b9144fcc4cd51803bf4376ab02"
))
},
{
50000
,
new
CheckpointInfo
(
new
uint256
(
"0xb42c18eacf8fb5ed94eac31943bd364451d88da0fd44cc49616ffea34d530ad4"
),
new
uint256
(
"0x824934ddc5f935e854ac59ae7f5ed25f2d29a7c3914cac851f3eddb4baf96d78"
))
},
{
100000
,
new
CheckpointInfo
(
new
uint256
(
"0xf9e2f7561ee4b92d3bde400d251363a0e8924204c326da7f4ad9ccc8863aad79"
),
new
uint256
(
"0xdef8d92d20becc71f662ee1c32252aca129f1bf4744026b116d45d9bfe67e9fb"
))
},
{
115000
,
new
CheckpointInfo
(
new
uint256
(
"0x8496c77060c8a2b5c9a888ade991f25aa33c232b4413594d556daf9043fad400"
),
new
uint256
(
"0x1886430484a9a36b56a7eb8bd25e9ebe4fc8eec8f9a84f5073f71e08f2feac90"
))
},
{
163000
,
new
CheckpointInfo
(
new
uint256
(
"0x4e44a9e0119a2e7cbf15e570a3c649a5605baa601d953a465b5ebd1c1982212a"
),
new
uint256
(
"0x0646fc7db8f3426eb209e1228c7d82724faa46a060f5bbbd546683ef30be245c"
))
},
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
PUBKEY_ADDRESS
]
=
new
byte
[]
{
(
65
)
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
SCRIPT_ADDRESS
]
=
new
byte
[]
{
(
196
)
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
SECRET_KEY
]
=
new
byte
[]
{
(
65
+
128
)
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
ENCRYPTED_SECRET_KEY_NO_EC
]
=
new
byte
[]
{
0x01
,
0x42
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
ENCRYPTED_SECRET_KEY_EC
]
=
new
byte
[]
{
0x01
,
0x43
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
EXT_PUBLIC_KEY
]
=
new
byte
[]
{
(
0x04
),
(
0x88
),
(
0xB2
),
(
0x1E
)
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
EXT_SECRET_KEY
]
=
new
byte
[]
{
(
0x04
),
(
0x88
),
(
0xAD
),
(
0xE4
)
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
PASSPHRASE_CODE
]
=
new
byte
[]
{
0x2C
,
0xE9
,
0xB3
,
0xE1
,
0xFF
,
0x39
,
0xE2
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
CONFIRMATION_CODE
]
=
new
byte
[]
{
0x64
,
0x3B
,
0xF6
,
0xA8
,
0x9A
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
STEALTH_ADDRESS
]
=
new
byte
[]
{
0x2a
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
ASSET_ID
]
=
new
byte
[]
{
23
};
this
.
Base58Prefixes
[(
int
)
Base58Type
.
COLORED_ADDRESS
]
=
new
byte
[]
{
0x13
};
var
encoder
=
new
Bech32Encoder
(
"bc"
);
this
.
Bech32Encoders
[(
int
)
Bech32Type
.
WITNESS_PUBKEY_ADDRESS
]
=
encoder
;
this
.
Bech32Encoders
[(
int
)
Bech32Type
.
WITNESS_SCRIPT_ADDRESS
]
=
encoder
;
this
.
DNSSeeds
.
AddRange
(
new
[]
{
new
DNSSeedData
(
"testnode1.destream.io"
,
"testnode1.destream.io"
)
});
this
.
SeedNodes
.
AddRange
(
new
[]
{
new
NetworkAddress
(
IPAddress
.
Parse
(
"95.128.181.196"
),
this
.
DefaultPort
),
//peak-srv-12
new
NetworkAddress
(
IPAddress
.
Parse
(
"40.121.9.206"
),
this
.
DefaultPort
)
});
//Network.Register(network);
//return network;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment