Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: rfisher1968 on January 24, 2016, 04:06:43 PM



Title: Why are scripts needed in transaction?
Post by: rfisher1968 on January 24, 2016, 04:06:43 PM
In the below transaction I know why the scripts are needed. The question I have is why can't you just do something like:

input_txid + output_txid + HASH160(pubkey) + amount + fee + signature(input_txid + output_txid + HASH160(pubkey) + amount + fee)

Hoping for some input, good or bad.

Code:
#394788

raw: 53230eac52e135d99960da6b88aad87641a022b5e6fb5bda75da7878b3154fef

01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2a032406061d4d696e656420627920416e74506f6f6c20626a3731e324fd2056a4b87ff012000093f60100ffffffff0100f90295000000001976a91402a61d2066d19e9e2fd348a8320b7ebd4dd3ca2b88ac00000000

{
   "lock_time":0,
   "size":127,
   "inputs":[
      {
         "prev_out":{
            "index":4294967295,
            "hash":"0000000000000000000000000000000000000000000000000000000000000000"
         },
         "script":"032406061d4d696e656420627920416e74506f6f6c20626a3731e324fd2056a4b87ff012000093f60100"
      }
   ],
   "version":1,
   "vin_sz":1,
   "hash":"53230eac52e135d99960da6b88aad87641a022b5e6fb5bda75da7878b3154fef",
   "vout_sz":1,
   "out":[
      {
         "script_string":"OP_DUP OP_HASH160 02a61d2066d19e9e2fd348a8320b7ebd4dd3ca2b OP_EQUALVERIFY OP_CHECKSIG",
         "address":"1F1MAvhTKg2VG29w8cXsiSN2PJ8gSsrJw",
         "value":2500000000,
         "script":"76a91402a61d2066d19e9e2fd348a8320b7ebd4dd3ca2b88ac"
      }
   ]
}


Title: Re: Why are scripts needed in transaction?
Post by: achow101 on January 24, 2016, 04:11:53 PM
In the below transaction I know why the scripts are needed. The question I have is why can't you just do something like:

input_txid + output_txid + HASH160(pubkey) + amount + fee + signature(input_txid + output_txid + HASH160(pubkey) + amount + fee)

Hoping for some input, good or bad.

Code:
#394788

raw: 53230eac52e135d99960da6b88aad87641a022b5e6fb5bda75da7878b3154fef

01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2a032406061d4d696e656420627920416e74506f6f6c20626a3731e324fd2056a4b87ff012000093f60100ffffffff0100f90295000000001976a91402a61d2066d19e9e2fd348a8320b7ebd4dd3ca2b88ac00000000

{
   "lock_time":0,
   "size":127,
   "inputs":[
      {
         "prev_out":{
            "index":4294967295,
            "hash":"0000000000000000000000000000000000000000000000000000000000000000"
         },
         "script":"032406061d4d696e656420627920416e74506f6f6c20626a3731e324fd2056a4b87ff012000093f60100"
      }
   ],
   "version":1,
   "vin_sz":1,
   "hash":"53230eac52e135d99960da6b88aad87641a022b5e6fb5bda75da7878b3154fef",
   "vout_sz":1,
   "out":[
      {
         "script_string":"OP_DUP OP_HASH160 02a61d2066d19e9e2fd348a8320b7ebd4dd3ca2b OP_EQUALVERIFY OP_CHECKSIG",
         "address":"1F1MAvhTKg2VG29w8cXsiSN2PJ8gSsrJw",
         "value":2500000000,
         "script":"76a91402a61d2066d19e9e2fd348a8320b7ebd4dd3ca2b88ac"
      }
   ]
}
Scripts allow you to do other things since they specify how you that output can be spent. Those allow special nonstandard transactions for both experimenting and creating more features.