public NeoSystem(ProtocolSettings settings, string storageEngine = null, string storagePath = null) { this.Settings = settings; this.GenesisBlock = new Block { Header = new Header { PrevHash = UInt256.Zero, MerkleRoot = UInt256.Zero, Timestamp = (new DateTime(2016, 7, 15, 15, 8, 21, DateTimeKind.Utc)).ToTimestampMS(), Index = 0, PrimaryIndex = 0, NextConsensus = Contract.GetBFTAddress(settings.StandbyValidators), Witness = new Witness { InvocationScript = Array.Empty <byte>(), VerificationScript = new[] { (byte)OpCode.PUSH1 } }, }, Transactions = Array.Empty <Transaction>() }; this.storage_engine = storageEngine; this.store = LoadStore(storagePath); this.MemPool = new MemoryPool(this); this.Blockchain = ActorSystem.ActorOf(Ledger.Blockchain.Props(this)); this.LocalNode = ActorSystem.ActorOf(Network.P2P.LocalNode.Props(this)); this.TaskManager = ActorSystem.ActorOf(Network.P2P.TaskManager.Props(this)); Blockchain.Ask <FillCompleted>(new FillMemoryPool { Transactions = Enumerable.Empty <Transaction>() }).Wait(); foreach (var plugin in Plugin.Plugins) { plugin.OnSystemLoaded(this); } }
public NeoSystem(ProtocolSettings settings, string storageEngine = null, string storagePath = null) { this.Settings = settings; Plugin.LoadPlugins(this); this.storage_engine = storageEngine; this.store = LoadStore(storagePath); this.MemPool = new MemoryPool(this); this.Blockchain = ActorSystem.ActorOf(Ledger.Blockchain.Props(this)); this.LocalNode = ActorSystem.ActorOf(Network.P2P.LocalNode.Props(this)); this.TaskManager = ActorSystem.ActorOf(Network.P2P.TaskManager.Props(this)); foreach (var plugin in Plugin.Plugins) { plugin.OnPluginsLoaded(); } }
public NeoSystem(ProtocolSettings settings, string storageEngine = null, string storagePath = null) { this.Settings = settings; this.GenesisBlock = CreateGenesisBlock(settings); this.storage_engine = storageEngine; this.store = LoadStore(storagePath); this.MemPool = new MemoryPool(this); this.Blockchain = ActorSystem.ActorOf(Ledger.Blockchain.Props(this)); this.LocalNode = ActorSystem.ActorOf(Network.P2P.LocalNode.Props(this)); this.TaskManager = ActorSystem.ActorOf(Network.P2P.TaskManager.Props(this)); this.TxRouter = ActorSystem.ActorOf(TransactionRouter.Props(this)); foreach (var plugin in Plugin.Plugins) { plugin.OnSystemLoaded(this); } Blockchain.Ask(new Blockchain.Initialize()).Wait(); }
public static Block CreateGenesisBlock(ProtocolSettings settings) => new Block { Header = new Header { PrevHash = UInt256.Zero, MerkleRoot = UInt256.Zero, Timestamp = (new DateTime(2016, 7, 15, 15, 8, 21, DateTimeKind.Utc)).ToTimestampMS(), Index = 0, PrimaryIndex = 0, NextConsensus = Contract.GetBFTAddress(settings.StandbyValidators), Witness = new Witness { InvocationScript = Array.Empty <byte>(), VerificationScript = new[] { (byte)OpCode.PUSH1 } }, }, Transactions = Array.Empty <Transaction>() };
public NeoSystem(ProtocolSettings settings, string storageEngine = null, string storagePath = null) { this.Settings = settings; this.GenesisBlock = CreateGenesisBlock(settings); this.storage_engine = storageEngine; this.store = LoadStore(storagePath); this.MemPool = new MemoryPool(this); this.Blockchain = ActorSystem.ActorOf(Ledger.Blockchain.Props(this)); this.LocalNode = ActorSystem.ActorOf(Network.P2P.LocalNode.Props(this)); this.TaskManager = ActorSystem.ActorOf(Network.P2P.TaskManager.Props(this)); foreach (var plugin in Plugin.Plugins) { plugin.OnSystemLoaded(this); } Blockchain.Ask <FillCompleted>(new FillMemoryPool { Transactions = Enumerable.Empty <Transaction>() }).Wait(); }
static ProtocolSettings() { IConfigurationSection section = new ConfigurationBuilder().AddJsonFile("protocol.json", true).Build().GetSection("ProtocolConfiguration"); Default = new ProtocolSettings(section); }
static bool UpdateDefault(IConfiguration configuration) { var settings = new ProtocolSettings(configuration.GetSection("ProtocolConfiguration")); return(null == Interlocked.CompareExchange(ref _default, settings, null)); }