-
Notifications
You must be signed in to change notification settings - Fork 52
Direct links between transaction inputs and outputs
In the Bitcoin blockchain, transactions have inputs and outputs. A transaction output is the source for an input in a subsequent transaction. In the raw blockchain data a transaction input knows the hash of the transaction that contains the source output. The input also knows the index of the source output from the source transaction. Relying on this way to establish links between inputs and outputs in the SQL database would lead to expensive SQL queries.
In order to allow for better SQL queries, after the raw data is transferred to the SQL database, for each input a direct link to the source output is calculated. In other words, for each row in table TransactionInput we determine the Id of the corresponding row from table TransactionOutput. This Id is saved in column TransactionInput.SourceTransactionOutputId. Having this Id allows for simpler and better performing SQL queries.