Пример #1
0
        static async Task ReadBlockPipeAsync(PipeReader reader)
        {
            var block = new KzBlock();

            // Read Bitcoin block headers from a PipeReader
            while (_zmqRunning)
            {
                var rr = await reader.ReadAsync();

                var consumed = 0L;
                var buf      = rr.Buffer;
                var ros      = buf;
                if (block.TryReadBlock(ref buf))
                {
                    reader.AdvanceTo(buf.GetPosition(consumed));
                    //KzH.WriteMessageLine($"Block parsed {block.Hash}");
                    Blocks.AddNewBlock(block, ros);
                }
                else
                {
                    reader.AdvanceTo(buf.Start, buf.End);
                    KzH.WriteMessageLine($"Block parse failed");
                }
            }
        }
Пример #2
0
        static void SetDefaultMessage()
        {
            KzH.WriteMessageLine(@"
Basic Getting Started Instructions for KzjHack: a Bitcoin SV sandbox application.

You'll need access to a Bitcoin SV node for JSON-RPC and ZMQ access to block and transaction data.

Click the ""Settings"" button on the Actions panel to configure access to your node.
Also check the root folder to be used on this machine to save cached block data.

Once configured, switch to the Log panel to monitor the initial data retrieval.
In the Tasks panel, first click Fetch Recent Blocks to fetch recent blocks
from your node and save them locally.

Once that completes, or if you stop it by unchecking its checkbox, as long
as you've retrieved at least on recent block, click the Enable ZMQ checkbox to begin
receiving live transaction and new blocks.

See http://github.com/tonesnotes/KzBitcoinSV for more information.
");
        }