com.google.bitcoin.core
Class TransactionInput

java.lang.Object
  extended by com.google.bitcoin.core.Message
      extended by com.google.bitcoin.core.TransactionInput
All Implemented Interfaces:
Serializable

public class TransactionInput
extends Message
implements Serializable

A transfer of coins from one address to another creates a transaction in which the outputs can be claimed by the recipient in the input of another transaction. You can imagine a transaction as being a module which is wired up to others, the inputs of one have to be wired to the outputs of another. The exceptions are coinbase transactions, which create new coins.

See Also:
Serialized Form

Field Summary
static byte[] EMPTY_ARRAY
           
 
Fields inherited from class com.google.bitcoin.core.Message
bytes, cursor, MAX_SIZE, offset, params, protocolVersion
 
Constructor Summary
TransactionInput(NetworkParameters params, Transaction parentTransaction, byte[] payload, int offset)
          Deserializes an input message.
 
Method Summary
 void bitcoinSerializeToStream(OutputStream stream)
          Serializes this message to the provided stream.
 Address getFromAddress()
          Convenience method that returns the from address of this input by parsing the scriptSig.
 Script getScriptSig()
          Returns the input script.
 boolean isCoinBase()
          Coinbase transactions have special inputs with hashes of zero.
 String toString()
          Returns a human readable debug string.
 
Methods inherited from class com.google.bitcoin.core.Message
bitcoinSerialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static final byte[] EMPTY_ARRAY
Constructor Detail

TransactionInput

public TransactionInput(NetworkParameters params,
                        Transaction parentTransaction,
                        byte[] payload,
                        int offset)
                 throws ProtocolException
Deserializes an input message. This is usually part of a transaction message.

Throws:
ProtocolException
Method Detail

bitcoinSerializeToStream

public void bitcoinSerializeToStream(OutputStream stream)
                              throws IOException
Description copied from class: Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().

Throws:
IOException

isCoinBase

public boolean isCoinBase()
Coinbase transactions have special inputs with hashes of zero. If this is such an input, returns true.


getScriptSig

public Script getScriptSig()
                    throws ScriptException
Returns the input script.

Throws:
ScriptException

getFromAddress

public Address getFromAddress()
                       throws ScriptException
Convenience method that returns the from address of this input by parsing the scriptSig.

Throws:
ScriptException - if the scriptSig could not be understood (eg, if this is a coinbase transaction).

toString

public String toString()
Returns a human readable debug string.

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.