public void TestCrypto_Verify() { var engine = GetEngine(true); IVerifiable iv = engine.ScriptContainer; byte[] message = iv.GetHashData(); byte[] privateKey = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; KeyPair keyPair = new KeyPair(privateKey); ECPoint pubkey = keyPair.PublicKey; byte[] signature = Crypto.Sign(message, privateKey, pubkey.EncodePoint(false).Skip(1).ToArray()); engine.CurrentContext.EvaluationStack.Push(signature); engine.CurrentContext.EvaluationStack.Push(pubkey.EncodePoint(false)); engine.CurrentContext.EvaluationStack.Push(message); InteropService.Invoke(engine, InteropService.Crypto.ECDsaVerify).Should().BeTrue(); engine.CurrentContext.EvaluationStack.Pop().ToBoolean().Should().BeTrue(); byte[] wrongkey = pubkey.EncodePoint(false); wrongkey[0] = 5; engine.CurrentContext.EvaluationStack.Push(signature); engine.CurrentContext.EvaluationStack.Push(wrongkey); engine.CurrentContext.EvaluationStack.Push(new InteropInterface(engine.ScriptContainer)); InteropService.Invoke(engine, InteropService.Crypto.ECDsaVerify).Should().BeTrue(); engine.CurrentContext.EvaluationStack.Peek().ToBoolean().Should().BeFalse(); }
public Contract GetContract() { ECPoint publicKey = (ECPoint)comboBox1.SelectedItem; uint timestamp = dateTimePicker1.Value.ToTimestamp(); using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(publicKey.EncodePoint(true)); sb.EmitPush(timestamp); // Lock 2.0 in mainnet tx:4e84015258880ced0387f34842b1d96f605b9cc78b308e1f0d876933c2c9134b sb.EmitAppCall(UInt160.Parse("d3cce84d0800172d09c88ccad61130611bd047a4").ToArray()); return(Contract.Create(publicKey.EncodePoint(true).ToScriptHash(), new[] { ContractParameterType.Signature }, sb.ToArray())); } }
public void TestCheckSig() { var engine = GetEngine(true); IVerifiable iv = engine.ScriptContainer; byte[] message = iv.GetSignData(ProtocolSettings.Default.Magic); byte[] privateKey = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; KeyPair keyPair = new KeyPair(privateKey); ECPoint pubkey = keyPair.PublicKey; byte[] signature = Crypto.Sign(message, privateKey, pubkey.EncodePoint(false).Skip(1).ToArray()); engine.CheckSig(pubkey.EncodePoint(false), signature).Should().BeTrue(); engine.CheckSig(new byte[70], signature).Should().BeFalse(); }
public void TestCheckSig() { var engine = GetEngine(true); IVerifiable iv = engine.ScriptContainer; byte[] message = iv.GetHashData(); byte[] privateKey = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; KeyPair keyPair = new KeyPair(privateKey); ECPoint pubkey = keyPair.PublicKey; byte[] signature = Crypto.Sign(message, privateKey, pubkey.EncodePoint(false).Skip(1).ToArray()); engine.VerifyWithECDsaSecp256r1(StackItem.Null, pubkey.EncodePoint(false), signature).Should().BeTrue(); engine.VerifyWithECDsaSecp256r1(StackItem.Null, new byte[70], signature).Should().BeFalse(); }
private bool VerifyKeyAndSignature(Signature signature, out ECPoint pubKey) { pubKey = null; // 0. only support ecdsa and secp256k1 for now, hashing is sha256 if (signature.SignatureType != SignatureType.Ecdsa || signature.PublicKey.CurveType != CurveType.Secp256r1) { return(false); } // 1. check public key bytes try { pubKey = ECPoint.FromBytes(signature.PublicKey.Bytes, ECCurve.Secp256r1); } catch (Exception) { return(false); } // 2. check if public key matches address if (("21" + pubKey.EncodePoint(true).ToHexString() + "ac").HexToBytes().ToScriptHash().ToAddress() != signature.SigningPayload.Address) { return(false); } // 3. check if public key and signature matches return(Crypto.Default.VerifySignature(signature.SigningPayload.Bytes, signature.Bytes, pubKey.EncodePoint(false))); }
public void TestContract_Update() { var engine = GetEngine(false, true); var script = new byte[1024 * 1024 + 1]; engine.CurrentContext.EvaluationStack.Push(script); InteropService.Invoke(engine, InteropService.Contract.Update).Should().BeFalse(); string manifestStr = new string(new char[ContractManifest.MaxLength + 1]); script = new byte[] { 0x01 }; engine.CurrentContext.EvaluationStack.Push(manifestStr); engine.CurrentContext.EvaluationStack.Push(script); InteropService.Invoke(engine, InteropService.Contract.Update).Should().BeFalse(); manifestStr = ""; engine.CurrentContext.EvaluationStack.Push(manifestStr); engine.CurrentContext.EvaluationStack.Push(script); InteropService.Invoke(engine, InteropService.Contract.Update).Should().BeFalse(); var manifest = ContractManifest.CreateDefault(script.ToScriptHash()); byte[] privkey = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; KeyPair key = new KeyPair(privkey); ECPoint pubkey = key.PublicKey; byte[] signature = Crypto.Sign(script.ToScriptHash().ToArray(), privkey, pubkey.EncodePoint(false).Skip(1).ToArray()); manifest.Groups = new ContractGroup[] { new ContractGroup() { PubKey = pubkey, Signature = signature } }; var snapshot = Blockchain.Singleton.GetSnapshot(); var state = TestUtils.GetContract(); state.Manifest.Features = ContractFeatures.HasStorage; var storageItem = new StorageItem { Value = new byte[] { 0x01 }, IsConstant = false }; var storageKey = new StorageKey { Id = state.Id, Key = new byte[] { 0x01 } }; snapshot.Contracts.Add(state.ScriptHash, state); snapshot.Storages.Add(storageKey, storageItem); engine = new ApplicationEngine(TriggerType.Application, null, snapshot, 0); engine.LoadScript(state.Script); engine.CurrentContext.EvaluationStack.Push(manifest.ToString()); engine.CurrentContext.EvaluationStack.Push(script); InteropService.Invoke(engine, InteropService.Contract.Update).Should().BeTrue(); }
public InvocationTransaction GetTransaction() { AssetType asset_type = (AssetType)comboBox1.SelectedItem; string name = string.IsNullOrWhiteSpace(textBox1.Text) ? string.Empty : $"[{{\"lang\":\"{CultureInfo.CurrentCulture.Name}\",\"name\":\"{textBox1.Text}\"}}]"; Fixed8 amount = checkBox1.Checked ? Fixed8.Parse(textBox2.Text) : -Fixed8.Satoshi; byte precision = (byte)numericUpDown1.Value; ECPoint owner = (ECPoint)comboBox2.SelectedItem; UInt160 admin = Wallet.ToScriptHash(comboBox3.Text); UInt160 issuer = Wallet.ToScriptHash(comboBox4.Text); using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(issuer.ToArray()); sb.EmitPush(admin.ToArray()); sb.EmitPush(owner.EncodePoint(true)); sb.EmitPush(precision); sb.EmitPush(amount.GetData()); sb.EmitPush(Encoding.UTF8.GetBytes(name)); sb.EmitPush((byte)asset_type); sb.EmitSysCall("Neo.Asset.Create"); return(new InvocationTransaction { Attributes = new[] { new TransactionAttribute { Usage = TransactionAttributeUsage.Script, Data = Contract.CreateSignatureRedeemScript(owner).ToScriptHash().ToArray() } }, Script = sb.ToArray() }); } }
/// <summary> /// Creates the script of signature contract. /// </summary> /// <param name="publicKey">The public key of the contract.</param> /// <returns>The created script.</returns> public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using ScriptBuilder sb = new(); sb.EmitPush(publicKey.EncodePoint(true)); sb.EmitSysCall(ApplicationEngine.System_Crypto_CheckSig); return(sb.ToArray()); }
public static MyWallet Load(string path, string password) { MyWallet wallet = new MyWallet(); byte[] aes_key = Encoding.UTF8.GetBytes(password).Sha256().Sha256(); byte[] aes_iv = new byte[16]; using (AesManaged aes = new AesManaged()) using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { fs.Read(aes_iv, 0, aes_iv.Length); using (ICryptoTransform decryptor = aes.CreateDecryptor(aes_key, aes_iv)) using (CryptoStream cs = new CryptoStream(fs, decryptor, CryptoStreamMode.Read)) using (BinaryReader reader = new BinaryReader(cs)) { int count = (int)reader.ReadVarInt(); for (int i = 0; i < count; i++) { byte[] privateKey = reader.ReadBytes(32); bool compressed = reader.ReadBoolean(); ECPoint publicKey = ECCurve.Secp256k1.G * privateKey; UInt160 publicKeyHash = publicKey.EncodePoint(compressed).ToScriptHash(); wallet.accounts.Add(new WalletEntry(privateKey, publicKey, publicKeyHash, compressed)); } } } Array.Clear(aes_key, 0, aes_key.Length); return(wallet); }
public void TestContract_Update() { var snapshot = Blockchain.Singleton.GetSnapshot().Clone(); snapshot.PersistingBlock = new Block() { }; var nef = new NefFile() { Script = new byte[] { 0x01 }, Compiler = "", Version = new Version(1, 2, 3, 4).ToString() }; nef.CheckSum = NefFile.ComputeChecksum(nef); Assert.ThrowsException <InvalidOperationException>(() => snapshot.UpdateContract(null, nef.ToArray(), new byte[0])); var manifest = TestUtils.CreateDefaultManifest(); byte[] privkey = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; KeyPair key = new KeyPair(privkey); ECPoint pubkey = key.PublicKey; var state = TestUtils.GetContract(); byte[] signature = Crypto.Sign(state.Hash.ToArray(), privkey, pubkey.EncodePoint(false).Skip(1).ToArray()); manifest.Groups = new ContractGroup[] { new ContractGroup() { PubKey = pubkey, Signature = signature } }; var storageItem = new StorageItem { Value = new byte[] { 0x01 }, IsConstant = false }; var storageKey = new StorageKey { Id = state.Id, Key = new byte[] { 0x01 } }; snapshot.AddContract(state.Hash, state); snapshot.Storages.Add(storageKey, storageItem); state.UpdateCounter.Should().Be(0); snapshot.UpdateContract(state.Hash, nef.ToArray(), manifest.ToJson().ToByteArray(false)); var ret = NativeContract.Management.GetContract(snapshot, state.Hash); snapshot.Storages.Find(BitConverter.GetBytes(state.Id)).ToList().Count().Should().Be(1); ret.UpdateCounter.Should().Be(1); ret.Id.Should().Be(state.Id); ret.Manifest.ToJson().ToString().Should().Be(manifest.ToJson().ToString()); ret.Script.ToHexString().Should().Be(nef.Script.ToHexString().ToString()); }
public static WalletEntry Create(byte[] privateKey, bool compressed = true) { ECPoint publicKey = ECCurve.Secp256k1.G * privateKey; UInt160 publicKeyHash = new UInt160(publicKey.EncodePoint(compressed).Sha256().RIPEMD160()); return(new WalletEntry(privateKey, publicKey, publicKeyHash, compressed)); }
private void button1_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() != DialogResult.OK) { return; } ECPoint point = (ECPoint)comboBox1.SelectedItem; KeyPair key = (KeyPair)Program.CurrentWallet.GetKey(point); byte[] pubkey = point.EncodePoint(false).Skip(1).ToArray(); byte[] prikey; using (key.Decrypt()) { const int ECDSA_PRIVATE_P256_MAGIC = 0x32534345; prikey = BitConverter.GetBytes(ECDSA_PRIVATE_P256_MAGIC).Concat(BitConverter.GetBytes(32)).Concat(pubkey).Concat(key.PrivateKey).ToArray(); } CX509PrivateKey x509key = new CX509PrivateKey(); x509key.AlgorithmName = "ECDSA_P256"; x509key.Import("ECCPRIVATEBLOB", Convert.ToBase64String(prikey)); Array.Clear(prikey, 0, prikey.Length); CX509CertificateRequestPkcs10 request = new CX509CertificateRequestPkcs10(); request.InitializeFromPrivateKey(X509CertificateEnrollmentContext.ContextUser, x509key, null); request.Subject = new CX500DistinguishedName(); request.Subject.Encode($"CN={textBox1.Text},C={textBox2.Text},S={textBox3.Text},SERIALNUMBER={textBox4.Text}"); request.Encode(); File.WriteAllText(saveFileDialog1.FileName, "-----BEGIN NEW CERTIFICATE REQUEST-----\r\n" + request.RawData + "-----END NEW CERTIFICATE REQUEST-----\r\n"); Close(); }
public void Serialize(BinaryWriter writer) { CheckFields(); writer.Write(rangeSig); writer.WriteVarBytes(C.EncodePoint(true)); writer.WriteVarBytes(mask); }
public static BorromeanSignatureType Generate(List <byte[]> x, List <Cryptography.ECC.ECPoint> P1, List <Cryptography.ECC.ECPoint> P2, List <int> indices) { List <byte[]> s1 = new List <byte[]>(); List <byte[]> alpha = new List <byte[]>(); List <ECPoint>[] L = new List <ECPoint> [2]; L[0] = new List <ECPoint>(); L[1] = new List <ECPoint>(); BorromeanSignatureType boroSig = new BorromeanSignatureType(); boroSig.InitSField(); for (int i = 0; i < AMOUNT_SIZE; i++) { int naught = indices[i]; int prime = (naught + 1) % 2; byte[] a = SchnorrNonLinkable.GenerateRandomScalar(); ECPoint L1 = Cryptography.ECC.ECCurve.Secp256r1.G * a; L[naught].Add(L1); alpha.Add(a); if (naught == 0) { byte[] s2 = SchnorrNonLinkable.GenerateRandomScalar(); byte[] c2 = Crypto.Default.Hash256(L1.EncodePoint(true)); ECPoint L2 = Cryptography.ECC.ECCurve.Secp256r1.G * s2 + P2[i] * c2; L[prime].Add(L2); boroSig.s1.Add(s2); } else { boroSig.s1.Add(new byte[32]); } boroSig.ee = ScalarFunctions.Add(boroSig.ee, Crypto.Default.Hash256(L[1][i].EncodePoint(true))); //Check This Part } for (int i = 0; i < AMOUNT_SIZE; i++) { if (indices[i] == 0) { boroSig.s0.Add(ScalarFunctions.MulSub(boroSig.ee, x[i], alpha[i])); } else { byte[] s2 = SchnorrNonLinkable.GenerateRandomScalar(); ECPoint LL = Cryptography.ECC.ECCurve.Secp256r1.G * s2 + P1[i] * boroSig.ee; byte[] cc = Crypto.Default.Hash256(LL.EncodePoint(true)); boroSig.s1[i] = ScalarFunctions.MulSub(cc, x[i], alpha[i]); boroSig.s0.Add(s2); } } return(boroSig.Exports()); }
public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.Push(publicKey.EncodePoint(true)); sb.Add(ScriptOp.OP_CHECKSIG); return sb.ToArray(); } }
public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(publicKey.EncodePoint(true)); sb.Emit(OpCode.CHECKSIG); return sb.ToArray(); } }
public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(publicKey.EncodePoint(true)); sb.EmitSysCall(InteropService.Neo_Crypto_CheckSig); return(sb.ToArray()); } }
public static Contract CreateSignatureContract(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.Push(publicKey.EncodePoint(true)); sb.Add(ScriptOp.OP_CHECKSIG); return(new Contract(sb.ToArray())); } }
public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.Push(publicKey.EncodePoint(true)); sb.Add(ScriptOp.OP_CHECKSIG); return(sb.ToArray()); } }
public static SignatureContract Create(ECPoint publicKey) { return new SignatureContract { RedeemScript = CreateSignatureRedeemScript(publicKey), PublicKeyHash = publicKey.EncodePoint(true).ToScriptHash(), publicKey = publicKey }; }
internal static void CheckValidator(ECPoint eCPoint, DataCache <StorageKey, StorageItem> .Trackable trackable) { var st = new BigInteger(trackable.Item.Value); st.Should().Be(0); trackable.Key.Key.Should().BeEquivalentTo(new byte[] { 33 }.Concat(eCPoint.EncodePoint(true))); trackable.Item.IsConstant.Should().Be(false); }
public static SignatureContract Create(ECPoint publicKey) { return(new SignatureContract { RedeemScript = CreateSignatureRedeemScript(publicKey), PublicKeyHash = publicKey.EncodePoint(true).ToScriptHash(), publicKey = publicKey }); }
public void TestCrypto_Verify() { var engine = GetEngine(true); IVerifiable iv = engine.ScriptContainer; byte[] message = iv.GetSignData(ProtocolSettings.Default.Magic); byte[] privateKey = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; KeyPair keyPair = new(privateKey); ECPoint pubkey = keyPair.PublicKey; byte[] signature = Crypto.Sign(message, privateKey, pubkey.EncodePoint(false).Skip(1).ToArray()); engine.CheckSig(pubkey.EncodePoint(false), signature).Should().BeTrue(); byte[] wrongkey = pubkey.EncodePoint(false); wrongkey[0] = 5; Assert.ThrowsException <FormatException>(() => engine.CheckSig(wrongkey, signature)); }
/// <summary> /// 智能合约:用公钥创建的地址脚本,当用自己的账户给别人转账时, /// 就会调用这个合约来验证签名 /// </summary> /// <param name="publicKey">公钥</param> /// <returns></returns> public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(publicKey.EncodePoint(true)); //放自己的公钥 sb.Emit(OpCode.CHECKSIG); //签名验证,用公钥来检查是否是自己的签名 return(sb.ToArray()); } }
public static Contract CreateSignatureContract(ECPoint publicKey) { return(new Contract { RedeemScript = CreateSignatureRedeemScript(publicKey), ParameterList = new[] { ContractParameterType.Signature }, PublicKeyHash = publicKey.EncodePoint(true).ToScriptHash(), }); }
public void TestCrypto_Verify() { var engine = GetEngine(true); IVerifiable iv = engine.ScriptContainer; byte[] message = iv.GetHashData(); byte[] privateKey = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; KeyPair keyPair = new KeyPair(privateKey); ECPoint pubkey = keyPair.PublicKey; byte[] signature = Crypto.Sign(message, privateKey, pubkey.EncodePoint(false).Skip(1).ToArray()); engine.VerifyWithECDsaSecp256r1(message, pubkey.EncodePoint(false), signature).Should().BeTrue(); byte[] wrongkey = pubkey.EncodePoint(false); wrongkey[0] = 5; engine.VerifyWithECDsaSecp256r1(new InteropInterface(engine.ScriptContainer), wrongkey, signature).Should().BeFalse(); }
protected override string DeriveAddress(PhantasmaKeys keys) { ECPoint pKey = ECCurve.Secp256k1.G * keys.PrivateKey; var publicKey = pKey.EncodePoint(true); var bytes = ByteArrayUtils.ConcatBytes(new byte[] { 0 }, publicKey.SHA256().RIPEMD160()); return(bytes.Base58CheckEncode()); }
protected override string DeriveAddress(PhantasmaKeys keys) { ECPoint pKey = ECCurve.Secp256k1.G * keys.PrivateKey; var publicKey = pKey.EncodePoint(false).Skip(1).ToArray(); var kak = SHA3Keccak.CalculateHash(publicKey); return("0x" + Base16.Encode(kak.Skip(12).ToArray())); }
public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(publicKey.EncodePoint(true)); sb.Emit(OpCode.PUSHNULL); sb.EmitSysCall(ApplicationEngine.Neo_Crypto_VerifyWithECDsaSecp256r1); return(sb.ToArray()); } }
public static VerificationContract CreateSignatureContract(ECPoint publicKey) { return(new VerificationContract { ContractType = KeyType.Transparent, Script = CreateSignatureRedeemScript(publicKey), ParameterList = new[] { ContractParameterType.Signature }, PublicKeyHash = publicKey.EncodePoint(true).ToScriptHash(), }); }
public static byte[] CreateRingSignatureRedeemScript(ECPoint payloadPubKey, ECPoint viewPubKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(payloadPubKey.EncodePoint(true)); sb.EmitPush(viewPubKey.EncodePoint(true)); sb.Emit(OpCode.CHECKRINGSIG); return(sb.ToArray()); } }
public static byte[] CreateSignatureRedeemScript(ECPoint publicKey) { using (ScriptBuilder sb = new ScriptBuilder()) { sb.EmitPush(publicKey.EncodePoint(true)); sb.Emit(OpCode.PUSHNULL); sb.EmitSysCall(InteropService.Crypto.ECDsaVerify); return(sb.ToArray()); } }
public override void Deserialize(BinaryReader reader) { this.publicKey = ECPoint.DeserializeFrom(reader, ECCurve.Secp256r1); base.RedeemScript = CreateSignatureRedeemScript(publicKey); base.PublicKeyHash = publicKey.EncodePoint(true).ToScriptHash(); }