1

According to the informations that i found here: https://en.bitcoin.it/wiki/Transaction a bitcoin transaction contains,

FOR EVERY INPUT:

  • The Hash of the incoming transaction
  • ScriptSig

FOR EVERY OUTPUT:

  • Value
  • ScriptPubKey

Now my question is: what kind of informations are implicitly contained in the ScriptSig? I know that from ScriptPubKey the destination address can be calculated, but i don't see if any other information can be retrieved from the ScriptSig.

Furthermore, if only the hash of the incoming transaction is stored, how does a node look for the incoming transaction on the blockchain, when it needs to validate the new transaction? And how does it know in which block that transaction is included? If it doesn't know in which block that transaction is, does it have to skim through the whole blockchain just for finding it?

  • Your last paragraph is a separate question and should go in a separate post. But it's already been addressed, e.g. at bitcoin.stackexchange.com/questions/13731/… (see also comments to answer). A full node has already indexed all transactions in the block chain by their hash (txid), so it can find any given transaction without rescanning the whole chain. – Nate Eldredge Feb 11 '17 at 15:43
  • thank you @NateEldredge. is there a specification on how this indexing is made? – a.costa Feb 11 '17 at 20:03
  • It's an implementation detail of the node client software. For Bitcoin Core, you can see en.bitcoin.it/wiki/… – Nate Eldredge Feb 11 '17 at 20:08
  • so that means that when a full node indexes the blockchain it also calculate the hash of every transaction? – a.costa Feb 11 '17 at 20:23
  • Yes, that's correct. – Nate Eldredge Feb 11 '17 at 20:28
1

What data is in scriptSig

scriptSig in a typical p2pkh scenario, which is the vact majority of bitcoin transactions, only contains the public key of the scriptPubKey hash as well as the signature. This means there's no metadata other than the public key and the signature for authorizing the payment.

For non-p2pkh transactions, such as for example p2sh transactions, more data is included in the scriptSig. For example in p2sh multisig, the multiple public keys capable of authorizing the multisig will be revealed. In even more complicated scripts, the scriptSig may reveal significant information, depending on what the scriptPubKey script is requesting. For example, there are snowflake transactions that require scriptSig to be solutions to certain puzzles. However, these transactions are very rare.

How transactions are validated

There are multiple security models in validating a transaction. Transaction validation is a different notion from transaction confirmation which you are talking about. Transaction validation asks whether a transaction is valid – for example, it is of the right format, it follows Kirchhoff's Law (i.e. sum of outputs is less than sum of inputs), and the outputs it spends have not been double spent. Validating a transaction requires access to the current UTXO.

Transaction confirmation on the other hand validates that a transaction has been buried under a certain amount of proof-of-work, for example k = 6 blocks. Checking the confirmation status of a transaction does not require traversing the whole data in the blockchain. It only requires looking at the blockchain headers. In the SPV security model, the transaction confirmation status is checked simply by checking that it was included in a block and buried under a certain amount of proof-of-work. This is done quickly without looking at the whole blockchain data (but just all of the blockchain headers) by providing a proof-of-inclusion which consists of Merkle tree path siblings.

  • ok i understand how merkle tree works. but how does a node, that wants to check if a certain input for a transaction is still unspent, know in which block that transaction was if the only information provided is the hash of the transaction? – a.costa Feb 14 '17 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.