Пример #1
0
        public Hash Decode(byte[] bytes)
        {
            byte[] hash = Rlp.Decode(bytes);

            if (hash.Length == 0)
            {
                return(null);
            }

            return(new Hash(hash));
        }
Пример #2
0
        public Block Decode(byte[] bytes)
        {
            IList <byte[]> list = Rlp.DecodeList(bytes);

            ulong          number = (ulong)bigIntegerEncoder.Decode(list[0]);
            BlockHash      hash   = hashEncoder.DecodeBlockHash(list[1]);
            IList <byte[]> btxs   = Rlp.DecodeList(Rlp.Decode(list[2]));

            IList <Transaction> txs = new List <Transaction>();

            for (int k = 0; k < btxs.Count; k++)
            {
                txs.Add(TransactionEncoder.Instance.Decode(btxs[k]));
            }

            return(new Block(number, hash, txs));
        }
        public Address Decode(byte[] bytes)
        {
            byte[] addr = Rlp.Decode(bytes);

            return(new Address(addr));
        }
 public BigInteger Decode(byte[] bytes)
 {
     return(new BigInteger(Rlp.Decode(bytes)));
 }