public BitcoinWitPubKeyAddress(WitKeyId segwitKeyId, Network network) : base( NotNull(segwitKeyId) ?? Network.CreateBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, segwitKeyId.ToBytes(), 0, network), network) { this.Hash = segwitKeyId; }
private static string NotNull(WitKeyId segwitKeyId) { if (segwitKeyId == null) { throw new ArgumentNullException("segwitKeyId"); } return(null); }
public BitcoinWitPubKeyAddress(string bech32, Network expectedNetwork = null) : base(Validate(bech32, ref expectedNetwork), expectedNetwork) { var encoder = expectedNetwork.GetBech32Encoder(Bech32Type.WITNESS_PUBKEY_ADDRESS, true); byte witVersion; var decoded = encoder.Decode(bech32, out witVersion); _Hash = new WitKeyId(decoded); }
public BitcoinWitPubKeyAddress(string bech32, Network expectedNetwork) : base(Validate(bech32, expectedNetwork), expectedNetwork) { if (expectedNetwork.GetBech32Encoder(Bech32Type.WITNESS_PUBKEY_ADDRESS, false) is Bech32Encoder encoder) { byte witVersion; var decoded = encoder.Decode(bech32, out witVersion); _Hash = new WitKeyId(decoded); } else { throw expectedNetwork.Bech32NotSupported(Bech32Type.WITNESS_PUBKEY_ADDRESS); } }
public override Script GetScriptCode(Network network) { if (!CanGetScriptCode(network)) { throw new InvalidOperationException("You need to provide the P2WSH redeem script with ScriptCoin.ToScriptCoin()"); } if (_OverrideScriptCode != null) { return(_OverrideScriptCode); } WitKeyId key = PayToWitPubKeyHashTemplate.Instance.ExtractScriptPubKeyParameters(network, Redeem); if (key != null) { return(key.AsKeyId().ScriptPubKey); } return(Redeem); }
public Script GenerateScriptPubKey(WitKeyId pubkeyHash) { return(pubkeyHash.ScriptPubKey); }
public Script GenerateScriptPubKey(WitKeyId pubkeyHash) { return pubkeyHash.ScriptPubKey; }
public BitcoinWitPubKeyAddress(WitKeyId segwitKeyId, Network network) : base(new[] { (byte)OpcodeType.OP_0, (byte)0x00 }.Concat(segwitKeyId.ToBytes(true)).ToArray(), network) { }
public virtual BitcoinAddress CreateP2WPKH(WitKeyId witKeyId, Network network) { return(new BitcoinWitPubKeyAddress(witKeyId, network)); }
internal BitcoinWitPubKeyAddress(string str, byte[] key, Network network) : base(str, network) { _Hash = new WitKeyId(key); }