public static void GetFirstTransaction(MainnetBlockProvider blockProvider, out Block block, out Transaction tx, out IDictionary <UInt256, Transaction> txLookup) { txLookup = new Dictionary <UInt256, Transaction>(); // prior outputs for first transaction GetTransaction(blockProvider, 9, 0, out block, out tx); txLookup.Add(tx.Hash, tx); // first transaction // do this last so its output is what is returned GetTransaction(blockProvider, 170, 1, out block, out tx); txLookup.Add(tx.Hash, tx); }
public MainnetSimulator() { this.random = new Random(); this.blockProvider = new MainnetBlockProvider(); // initialize kernel this.kernel = new StandardKernel(); // add logging module this.kernel.Load(new ConsoleLoggingModule()); // log startup this.logger = kernel.Get <Logger>(); this.logger.Info("Starting up: {0}".Format2(DateTime.Now)); // add storage module this.kernel.Load(new MemoryStorageModule()); // add cache module this.kernel.Load(new CoreCacheModule()); // initialize block view this.blockCache = this.kernel.Get <BlockCache>(); // add rules module this.kernel.Load(new RulesModule(RulesEnum.MainNet)); MainnetRules.IgnoreScriptErrors = true; // initialize the blockchain daemon this.kernel.Bind <CoreDaemon>().ToSelf().InSingletonScope(); this.coreDaemon = this.kernel.Get <CoreDaemon>(); // start the blockchain daemon this.coreDaemon.Start(); // wait for initial work this.coreDaemon.ForceWorkAndWait(); // verify initial state Assert.AreEqual(0, this.coreDaemon.TargetBlock.Height); //Assert.AreEqual(this.genesisBlock.Hash, this.blockchainDaemon.TargetChain.LastBlock.Hash); //Assert.AreEqual(this.genesisBlock.Hash, this.blockchainDaemon.ChainState.LastBlockHash); }
public MainnetSimulator() { this.random = new Random(); this.blockProvider = new MainnetBlockProvider(); // initialize kernel this.kernel = new StandardKernel(); // add logging module this.kernel.Load(new ConsoleLoggingModule()); // log startup this.logger = kernel.Get <Logger>(); this.logger.Info("Starting up: {0}".Format2(DateTime.Now)); // add storage module this.kernel.Load(new MemoryStorageModule()); // add rules module this.kernel.Load(new RulesModule(RulesEnum.MainNet)); // TODO ignore script errors in test daemon until scripting engine is completed var rules = this.kernel.Get <IBlockchainRules>(); rules.IgnoreScriptErrors = true; // initialize the blockchain daemon this.kernel.Bind <CoreDaemon>().ToSelf().InSingletonScope(); this.coreDaemon = this.kernel.Get <CoreDaemon>(); this.coreStorage = this.coreDaemon.CoreStorage; // start the blockchain daemon this.coreDaemon.Start(); // wait for initial work this.coreDaemon.WaitForUpdate(); // verify initial state Assert.AreEqual(0, this.coreDaemon.TargetChainHeight); Assert.AreEqual(rules.GenesisBlock.Hash, this.coreDaemon.TargetChain.LastBlockHash); Assert.AreEqual(rules.GenesisBlock.Hash, this.coreDaemon.CurrentChain.LastBlockHash); }
public static void GetTransaction(MainnetBlockProvider blockProvider, int blockIndex, int txIndex, out Block block, out Transaction tx) { block = blockProvider.GetBlock(blockIndex); tx = block.Transactions[txIndex]; }
public static void GetTransaction(MainnetBlockProvider blockProvider, int blockIndex, int txIndex, out Block block, out Transaction tx) { block = blockProvider.GetBlock(blockIndex); tx = block.Transactions[txIndex]; }
public static void GetFirstHash160Transaction(MainnetBlockProvider blockProvider, out Block block, out Transaction tx, out IDictionary<UInt256, Transaction> txLookup) { txLookup = new Dictionary<UInt256, Transaction>(); // prior outputs for first OP_HASH160 transaction GetTransaction(blockProvider, 2676, 0, out block, out tx); txLookup.Add(tx.Hash, tx); GetTransaction(blockProvider, 2812, 1, out block, out tx); txLookup.Add(tx.Hash, tx); // first OP_HASH160 transaction // do this last so its output is what is returned GetTransaction(blockProvider, 2812, 2, out block, out tx); txLookup.Add(tx.Hash, tx); }
public static void GetFirstMultiInputTransaction(MainnetBlockProvider blockProvider, out Block block, out Transaction tx, out IDictionary<UInt256, Transaction> txLookup) { txLookup = new Dictionary<UInt256, Transaction>(); // prior outputs for first transaction GetTransaction(blockProvider, 360, 0, out block, out tx); txLookup.Add(tx.Hash, tx); GetTransaction(blockProvider, 187, 1, out block, out tx); txLookup.Add(tx.Hash, tx); GetTransaction(blockProvider, 248, 1, out block, out tx); txLookup.Add(tx.Hash, tx); // first transaction // do this last so its output is what is returned GetTransaction(blockProvider, 496, 1, out block, out tx); txLookup.Add(tx.Hash, tx); }