public ClientWorker(ECDSAPublicKey peerPublicKey, IMessageFactory messageFactory, HubConnector hubConnector) { _messageFactory = messageFactory; _hubConnector = hubConnector; PeerPublicKey = peerPublicKey.EncodeCompressed(); _worker = new Thread(Worker); }
public void VerifyTransaction(TransactionReceipt acceptedTransaction, ECDSAPublicKey publicKey, bool useNewChainId) { var address = _crypto.ComputeAddress(publicKey.EncodeCompressed()).ToUInt160(); _publicKeyCache.Add(address, publicKey); VerifyTransaction(acceptedTransaction, useNewChainId); }
public OperatingError VerifySignature(BlockHeader blockHeader, Signature signature, ECDSAPublicKey publicKey) { var result = Crypto.VerifySignatureHashed( blockHeader.Keccak().ToBytes(), signature.Encode(), publicKey.EncodeCompressed(), HardforkHeights.IsHardfork_9Active(blockHeader.Index) ); return(result ? OperatingError.Ok : OperatingError.InvalidSignature); }
/* Sync Verification, verifies the transaction immediately */ public bool VerifyTransactionImmediately(TransactionReceipt receipt, ECDSAPublicKey publicKey, bool useNewChainId) { try { return(_crypto.VerifySignatureHashed( receipt.Transaction.RawHash(useNewChainId).ToBytes(), receipt.Signature.Encode(), publicKey.EncodeCompressed(), useNewChainId )); } catch (Exception) { return(false); } }
private static byte[] EncryptRow(IEnumerable <Fr> row, ECDSAPublicKey publicKey) { var serializedRow = row.Select(x => x.ToBytes()).Flatten().ToArray(); return(Crypto.Secp256K1Encrypt(publicKey.EncodeCompressed(), serializedRow)); }
public static UInt160 GetAddress(this ECDSAPublicKey key) { return(Crypto.ComputeAddress(key.EncodeCompressed()).ToUInt160()); }