Ejemplo n.º 1
0
        public byte[] ToArray()
        {
            var ret = new byte[Size];

            var v = BitConverter.GetBytes(Version);

            Buffer.BlockCopy(v, 0, ret, 0, v.Length);

            var pb = PrevBlock.ToArray();

            Buffer.BlockCopy(pb, 0, ret, 4, pb.Length);

            var mr = MerkleRoot.ToArray();

            Buffer.BlockCopy(mr, 0, ret, 36, mr.Length);

            var t = BitConverter.GetBytes(Time);

            Buffer.BlockCopy(t, 0, ret, 68, t.Length);

            var nb = BitConverter.GetBytes(Target);

            Buffer.BlockCopy(nb, 0, ret, 72, nb.Length);

            var nn = BitConverter.GetBytes(Nonce);

            Buffer.BlockCopy(nn, 0, ret, 76, nn.Length);

            return(ret);
        }
Ejemplo n.º 2
0
        public byte[] ToArray()
        {
            var woffset = 0;
            var ret     = new byte[Size];

            ret.CopyAndIncr(BitConverter.GetBytes(Version), ref woffset);
            ret.CopyAndIncr(PrevBlock.ToArray(), ref woffset);
            ret.CopyAndIncr(MerkleRoot.ToArray(), ref woffset);
            ret.CopyAndIncr(BitConverter.GetBytes(Time), ref woffset);
            ret.CopyAndIncr(BitConverter.GetBytes(Target), ref woffset);
            ret.CopyAndIncr(BitConverter.GetBytes(Nonce), ref woffset);

            return(ret);
        }