stratisproject / nstratis Goto Github PK
View Code? Open in Web Editor NEWThis project forked from metacosa/nbitcoin
Comprehensive Bitcoin library for the .NET framework.
License: MIT License
This project forked from metacosa/nbitcoin
Comprehensive Bitcoin library for the .NET framework.
License: MIT License
NStratis was added as a project reference to a minimal project as follows:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include=".\NStratis\NBitcoin\NBitcoin.csproj" />
</ItemGroup>
</Project>
The NStratis directory is a git submodule. This minimal project was then built from the command line, which fails:
$ dotnet build
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
HashLib -> /Users/zeptin/Projects/DotNET/StratisWiki/NStratis/Hashing/HashLib/bin/Debug/netstandard1.3/HashLib.dll
NBitcoin -> /Users/zeptin/Projects/DotNET/StratisWiki/NStratis/NBitcoin/bin/Debug/netstandard1.6/NBitcoin.dll
/usr/local/share/dotnet/sdk/1.0.4/Microsoft.Common.CurrentVersion.targets(2867,5): error MSB3554: Cannot write to the output file "/Users/zeptin/Projects/DotNET/StratisWiki/obj/Debug/netcoreapp1.1/StratisWiki.NStratis.Hashing.TomanuExtensions.TestUtils.ProgressForm.resources". Positive number required. [/Users/zeptin/Projects/DotNET/StratisWiki/StratisWiki.csproj]
/usr/local/share/dotnet/sdk/1.0.4/Microsoft.Common.CurrentVersion.targets(2867,5): error MSB3554: Parameter name: bufferSize [/Users/zeptin/Projects/DotNET/StratisWiki/StratisWiki.csproj]
Build FAILED.
It is not clear why this issue is not affecting the full node, which also uses NStratis as a submodule. Is it necessary for the Hashing project have this forms resource file at all, given that NStratis is not graphical?
The problem appears to be that the interim wallet does not accept nulldata transactions with a value of 0. The NStratis TransactionBuilder verification regards them as valid.
Sample code that exhibits the problem (when the overridden transaction is submitted to the RPC server the 0.0001 assigned to the nulldata seems to get reassigned to the staking fees):
Transaction sourceTx = rpc.GetRawTransaction(uint256.Parse("d2401ed79279d909fc84b0f89bbec694eff576b9541cc70c717f640238719aef"));
BitcoinSecret sourcePrivateKey = new BitcoinSecret("xxx", Network.StratisMain);
var issuance = new IssuanceCoin(new OutPoint(sourceTx, 0), sourceTx.Outputs[0]);
var dest = BitcoinAddress.Create("SesDUTF3sdqC8mTfW9vJFQMeQGw6dv8Dzz");
TransactionBuilder builder = new TransactionBuilder();
var tx = builder
.AddKeys(sourcePrivateKey)
.AddCoins(issuance)
.IssueAsset(dest, new AssetMoney(issuance.AssetId, quantity: 10))
.SendFees(Money.Coins(0.001m))
.SetChange(sourcePrivateKey.PubKey)
.BuildTransaction(true);
TransactionPolicyError[] errorsfound = null;
// The transaction is rejected by the interim wallet's RPC server
// unless the output values are manually changed to make the nulldata
// transaction have a non-zero value:
tx.Outputs[1].Value = Money.Coins(1.79777270m);
tx.Outputs[2].Value = Money.Coins(0.0001m);
builder.SignTransactionInPlace(tx);
bool result = builder.Verify(tx, out errorsfound);
nStratis allows OP_RETURN scripts up to the maximum length currently supported in Bitcoin itself (83 bytes).
The Stratis GUI wallet (currently 2.0.0.1) rejects the resulting OP_RETURN transaction from nStratis with an error in debug.log:
ERROR: AcceptToMemoryPool : nonstandard transaction: scriptpubkey
It appears that scripts < 40 bytes are accepted, so the length validation is incorrect in either nStratis or the wallet.
.
One cannot run NetworkBuilder.BuildAndRegister() to create a Network before triggering the static ctor of Network one time before so that it already creates BitcoinMain. Otherwise, this line will crash:
assert(consensus.HashGenesisBlock == uint256.Parse("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
This can be worked around like shown below, but it's very confusing :-)
public static void Main(string[] args)
{
var fix= Network.Main; // execute static constructor of Network before everything else, or crash
var network = !args.Contains("-testnet")
? MyNetworks.RegisterMain()
: MyNetworks.RegisterTest();
if (NodeSettings.PrintHelp(args, network))
return;
License says "Copyright (c) 2014 Metaco SA". That should probably be StratisPlatform or something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.