Exemplo n.º 1
0
 public Script GenerateScriptPubKey(KeyId pubkeyHash)
 {
     return(new Script(
                OpcodeType.OP_DUP,
                OpcodeType.OP_HASH160,
                Op.GetPushOp(pubkeyHash.ToBytes()),
                OpcodeType.OP_EQUALVERIFY,
                OpcodeType.OP_CHECKSIG
                ));
 }
Exemplo n.º 2
0
        byte[] Compress()
        {
            byte[] result = null;
            KeyId  keyID  = GetKeyId();

            if (keyID != null)
            {
                result    = new byte[21];
                result[0] = 0x00;
                Array.Copy(keyID.ToBytes(), 0, result, 1, 20);
                return(result);
            }
            ScriptId scriptID = GetScriptId();

            if (scriptID != null)
            {
                result    = new byte[21];
                result[0] = 0x01;
                Array.Copy(scriptID.ToBytes(), 0, result, 1, 20);
                return(result);
            }
            PubKey pubkey = GetPubKey();

            if (pubkey != null)
            {
                result = new byte[33];
                var pubBytes = pubkey.ToBytes();
                Array.Copy(pubBytes, 1, result, 1, 32);
                if (pubBytes[0] == 0x02 || pubBytes[0] == 0x03)
                {
                    result[0] = pubBytes[0];
                    return(result);
                }
                else if (pubBytes[0] == 0x04)
                {
                    result[0] = (byte)(0x04 | (pubBytes[64] & 0x01));
                    return(result);
                }
            }
            return(null);
        }
Exemplo n.º 3
0
 public BitcoinAddress(KeyId keyId, Network network)
     : base(keyId.ToBytes(), network)
 {
 }
 public BitcoinPubKeyAddress(KeyId keyId, Network network) :
     base(NotNull(keyId) ?? Network.CreateBase58(Base58Type.PUBKEY_ADDRESS, keyId.ToBytes(), network), network)
 {
     _KeyId = keyId;
 }
Exemplo n.º 5
0
		public Script GenerateScriptPubKey(KeyId pubkeyHash)
		{
			return new Script(
					OpcodeType.OP_DUP,
					OpcodeType.OP_HASH160,
					Op.GetPushOp(pubkeyHash.ToBytes()),
					OpcodeType.OP_EQUALVERIFY,
					OpcodeType.OP_CHECKSIG
				);
		}
Exemplo n.º 6
0
 public BitcoinAddress(KeyId keyId, Network network)
     : base(keyId.ToBytes(), network)
 {
 }
Exemplo n.º 7
0
		public WitKeyId(KeyId keyId)
			: base(keyId.ToBytes())
		{

		}
Exemplo n.º 8
0
 public WitKeyId(KeyId keyId)
     : base(keyId.ToBytes())
 {
 }
Exemplo n.º 9
0
 public static HDFingerprint FromKeyId(KeyId id)
 {
     return(new HDFingerprint(id.ToBytes().Take(4).ToArray()));
 }