/// <summary> /// Initializes a new instance of the <see cref="Blockchain"/> class. /// </summary> /// <exception cref="ArgumentNullException"> /// <paramref name="storage"/> is <c>null</c>. /// </exception> public Blockchain(IBlockchainStorage storage) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } this.storage = storage; }
public BitcoinNode(IBlockchainStorage storage) { this.storage = storage; this.blockchain = new Blockchain(storage); services.AddFactory(new NodeDiscoveryServiceFactory()); services.AddFactory(new BlockHeaderDownloadServiceFactory()); services.AddFactory(new BlockContentDownloadServiceFactory()); services.AddFactory(new BlockValidationServiceFactory()); }
static UInt256 GetAssetId(IBlockchainStorage blockchain, string asset) { if (string.Compare("neo", asset, true) == 0) { return(blockchain.GoverningTokenHash); } if (string.Compare("gas", asset, true) == 0) { return(blockchain.UtilityTokenHash); } return(UInt256.Parse(asset)); }
public InternalBlockchain(IBlockchainStorage storage) { this.storage = storage; transactionalResource = new TransactionalResource(OnCommit, OnRollback); }
public Blockchain(IBlockchainStorage storage) { CachingBlockchainStorage cache = new CachingBlockchainStorage(storage); blockchain = new InternalBlockchain(cache); }