Beispiel #1
0
        public async Task <EthECDSASignature> SignAndCalculateVAsync(byte[] hash, BigInteger chainId)
        {
            var signature = await _ethExternalSigner.SignAsync(hash);

            if (_ethExternalSigner.CalculatesV)
            {
                return(new EthECDSASignature(signature));
            }

            var publicKey = await _ethExternalSigner.GetPublicKeyAsync();

            var recId  = EthECKey.CalculateRecId(signature, hash, publicKey);
            var vChain = EthECKey.CalculateV(chainId, recId);

            signature.V = vChain.ToBytesForRLPEncoding();
            return(new EthECDSASignature(signature));
        }
 public override async Task SignExternallyAsync(IEthExternalSigner externalSigner)
 {
     await externalSigner.SignAsync(this).ConfigureAwait(false);
 }