Example #1
0
        static byte[] Sign(byte[] hashData, DevWalletAccount account)
        {
            var key = account.GetKey();

            if (key == null)
            {
                throw new Exception("DevWalletAccount missing key");
            }

            var publicKey = key.PublicKey.EncodePoint(false).AsSpan().Slice(1).ToArray();

            return(Neo.Cryptography.Crypto.Default.Sign(hashData, key.PrivateKey, publicKey));
        }
Example #2
0
                static byte[] CreateSignatureRedeemScript(DevWalletAccount account)
                {
                    var key = account.GetKey();

                    if (key == null)
                    {
                        throw new Exception("DevWalletAccount missing key");
                    }

                    using var sb = new Neo.VM.ScriptBuilder();
                    sb.EmitPush(key.PublicKey.EncodePoint(true));
                    sb.Emit(Neo.VM.OpCode.CHECKSIG);
                    return(sb.ToArray());
                }