Beispiel #1
0
 public TxOut(Money value, KeyId keyId)
 {
     Value = value;
     SetDestination(keyId);
 }
Beispiel #2
0
 private bool IsTo(KeyId keyId)
 {
     return ScriptPubKey.GetDestination() == keyId;
 }
Beispiel #3
0
		private static Script CombineSignatures(Script scriptPubKey, TransactionChecker checker, byte[][] sigs1, byte[][] sigs2, HashVersion hashVersion)
		{
			var template = StandardScripts.GetTemplateFromScriptPubKey(scriptPubKey);

			if(template is PayToWitPubKeyHashTemplate)
			{
				scriptPubKey = new KeyId(scriptPubKey.ToBytes(true).SafeSubarray(1, 20)).ScriptPubKey;
				template = StandardScripts.GetTemplateFromScriptPubKey(scriptPubKey);
			}
			if(template == null || template is TxNullDataTemplate)
				return PushAll(Max(sigs1, sigs2));

			if(template is PayToPubkeyTemplate || template is PayToPubkeyHashTemplate)
				if(sigs1.Length == 0 || sigs1[0].Length == 0)
					return PushAll(sigs2);
				else
					return PushAll(sigs1);
			if(template is PayToScriptHashTemplate || template is PayToWitTemplate)
			{
				if(sigs1.Length == 0 || sigs1[sigs1.Length - 1].Length == 0)
					return PushAll(sigs2);

				if(sigs2.Length == 0 || sigs2[sigs2.Length - 1].Length == 0)
					return PushAll(sigs1);

				var redeemBytes = sigs1[sigs1.Length - 1];
				var redeem = new Script(redeemBytes);
				sigs1 = sigs1.Take(sigs1.Length - 1).ToArray();
				sigs2 = sigs2.Take(sigs2.Length - 1).ToArray();
				Script result = CombineSignatures(redeem, checker, sigs1, sigs2, hashVersion);
				result += Op.GetPushOp(redeemBytes);
				return result;
			}

			if(template is PayToMultiSigTemplate)
			{
				return CombineMultisig(scriptPubKey, checker, sigs1, sigs2, hashVersion);
			}

			return null;
		}
Beispiel #4
0
 public void AddOutput(Money money, KeyId keyId)
 {
     AddOutput(new TxOut(money, keyId));
 }
Beispiel #5
0
 public BitcoinPubKeyAddress CreateBitcoinPubKeyAddress(KeyId dest)
 {
     return(new BitcoinPubKeyAddress(dest, this));
 }
Beispiel #6
0
 private static Script PayToPubkeyHash(KeyId pubkeyHash)
 {
     return new PayToPubkeyHashTemplate().GenerateScriptPubKey(pubkeyHash);
 }
		public BitcoinPubKeyAddress(KeyId keyId, Network network)
			: base(keyId, network)
		{
		}
		public Script GenerateScriptPubKey(KeyId pubkeyHash)
		{
			return new Script(
					OpcodeType.OP_DUP,
					OpcodeType.OP_HASH160,
					Op.GetPushOp(pubkeyHash.ToBytes()),
					OpcodeType.OP_EQUALVERIFY,
					OpcodeType.OP_CHECKSIG
				);
		}
 public virtual BitcoinPubKeyAddress CreateP2PKH(KeyId keyId, Network network)
 {
     return(new BitcoinPubKeyAddress(keyId, network));
 }
Beispiel #10
0
 public StealthSpendKey(KeyId id, StealthPayment payment)
 {
     _ID = id;
     _Payment = payment;
 }
Beispiel #11
0
 public BitcoinPubKeyAddress(KeyId keyId, Network network) :
     base(NotNull(keyId) ?? Network.CreateBase58(Base58Type.PUBKEY_ADDRESS, keyId.ToBytes(), network), network)
 {
     _KeyId = keyId;
 }
Beispiel #12
0
 public TxOut AddOutput(Money money, KeyId keyId)
 {
     return(AddOutput(new TxOut(money, keyId)));
 }
Beispiel #13
0
 private static Script PayToPubkeyHash(KeyId pubkeyHash)
 {
     return(PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(pubkeyHash));
 }
Beispiel #14
0
 private void SetDestination(KeyId keyId)
 {
     ScriptPubKey = new PayToPubkeyHashTemplate().GenerateScriptPubKey(keyId);
 }
Beispiel #15
0
		public WitKeyId(KeyId keyId)
			: base(keyId.ToBytes())
		{

		}
Beispiel #16
0
		private static Script PayToPubkeyHash(KeyId pubkeyHash)
		{
			return PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(pubkeyHash);
		}
Beispiel #17
0
 public Key GetKey(KeyId pubKeyId)
 {
     return _Keys.FirstOrDefault(k => k.PubKey.ID == pubKeyId);
 }
Beispiel #18
0
 public BitcoinAddress(KeyId keyId, Network network)
     : base(keyId.ToBytes(), network)
 {
 }
Beispiel #19
0
 public BitcoinAddress(KeyId keyId, Network network)
     : base(keyId.ToBytes(), network)
 {
 }