1 min read
The ScriptSig is the part of a transaction which contains the required signatures and the script which unlocks a UTXO for spending. A ScriptSig pairs with the ScriptPubKey to form a complete and valid script. The ScriptSig is only present in legacy Bitcoin transactions. In SegWit transactions, the ScriptSig is removed from the transaction body and called the Witness Script.
When bitcoin is sent, it is locked using a ScriptPubKey. The ScriptPubKey can be thought of as a riddle, solvable only by the owner of the correct private keys. To spend this bitcoin, the owner must publish the answer to the riddle by signing the transaction with his keys. The published answer to the riddle is the ScriptSig.
Every node verifies that the ScriptSig matches the ScriptPubKey for each transaction they receive, ensuring that no invalid transactions are added to the blockchain. One of the major changes implemented in SegWit was the relocation of the ScriptSig from the legacy transaction body into the Witness portion.