Ejemplo n.º 1
0
        public Keccak SendTransaction(PublicEntry publicEntry)
        {
            TransactionBroadcast broadcast = new TransactionBroadcast
            {
                PublicEntry = publicEntry
            };

            _transactionReceived.OnTransactionReceived(broadcast.ToProtocolMessage(_peerId));

            byte[] kvmAddressBytes = Keccak.Compute(publicEntry.SenderAddress.ToByteArray()).Bytes.AsSpan(12).ToArray();
            string hex             = kvmAddressBytes.ToHexString() ?? throw new ArgumentNullException("kvmAddressBytes.ToHexString()");

            publicEntry.SenderAddress = kvmAddressBytes.ToByteString();

            if (publicEntry.ReceiverAddress.Length == 1)
            {
                publicEntry.ReceiverAddress = ByteString.Empty;
            }

            return(publicEntry.GetHash(HashProvider));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the document id on the basis of <paramref name="entry"/> content.
 /// </summary>
 public static string GetDocumentId(this PublicEntry entry, IHashProvider hashProvider) => entry.GetHash(hashProvider).AsDocumentId();