Bitcoin Forum
March 01, 2021, 08:38:07 PM *
News: Latest Bitcoin Core release: 0.21.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Pay-to-Script-Hash  (Read 131 times)
pf55351
Jr. Member
*
Offline Offline

Activity: 51
Merit: 1


View Profile
June 05, 2018, 11:46:37 AM
 #1

Salve a tutti,
continuo lo studio sul mondo blockchain / bitcoin.
Leggendo qui https://en.bitcoin.it/wiki/Transaction leggo che ci sono due tipi di transazioni o meglio dai post precedenti 3

P2PK
P2PKH

che grazie alle risposte di arulbero ho chiarito di molto

poi leggo anche

P2HS non capisco la modalità, forse serve per transazioni dove il processo è piu complicato, ad esempio firma multipla?

Mi potete spiegare il funzionamento ad esempio di questa trx https://blockchain.info/tx/7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45

Grazie come al solito

1614631087
Hero Member
*
Offline Offline

Posts: 1614631087

View Profile Personal Message (Offline)

Ignore
1614631087
Reply with quote  #2

1614631087
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1614631087
Hero Member
*
Offline Offline

Posts: 1614631087

View Profile Personal Message (Offline)

Ignore
1614631087
Reply with quote  #2

1614631087
Report to moderator
Piggy
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1409



View Profile WWW
June 05, 2018, 01:23:08 PM
 #2

https://blockchain.info/tx/7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45?show_adv=true

Qui ti fa vedere:
Quote
input
ScriptSig: 0[] PUSHDATA(72)[3045022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b248593abc1259512793e7dea61036c601775ebb23640a0120b0dba2c34b79001] PUSHDATA(69)[5141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51ae]
Output Scripts
DUP HASH160 PUSHDATA(20)[1d30342095961d951d306845ef98ac08474b36a0] EQUALVERIFY CHECKSIG

Con questo poi ti puoi aiutare a decodificare gli hash:

http://chainquery.com/bitcoin-api/decodescript

Gli hash contengono:

Quote
{
   "result": {
      "asm": "45022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b2 48593abc125951279 [error]",
      "type": "nonstandard",
      "p2sh": "339gERf4apaDatLrk2pV8E8ekH9R2SVpdj"
   },
   "error": null,
   "id": null
}

Quote
{
   "result": {
      "asm": "1 042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6 eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf 1 OP_CHECKMULTISIG",
      "reqSigs": 1,
      "type": "multisig",
      "addresses": [
         "1Fz5s6qVFwP3MDGeNav4ESQXFMpm8ELzUw"
      ],
      "p2sh": "3P14159f73E4gFr7JterCCQh9QjiTjiZrG"
   },
   "error": null,
   "id": null
}

Immagino il primo sia una definizione  e il secondo la condizione che coinvolge l'indirizzo 1Fz5s6qVFwP3MDGeNav4ESQXFMpm8ELzUw, immagino debba confermare in qualche modo anche lui.

meglio se aspetti qualcuno che ne sappia di piu per conferme Cheesy


goddog
Member
**
Offline Offline

Activity: 154
Merit: 46

8426 2618 9F5F C7BF 22BD E814 763A 57A1 AA19 E681


View Profile
June 07, 2018, 06:29:14 PM
Merited by arulbero (1), Piggy (1)
 #3

Code:
$ bitcoin-cli getrawtransaction 7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45
0100000001c8cc2b56525e734ff63a13bc6ad06a9e5664df8c67632253a8e36017aee3ee40000000009000483045022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b248593abc1259512793e7dea61036c601775ebb23640a0120b0dba2c34b79001455141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51aefeffffff0120f40e00000000001976a9141d30342095961d951d306845ef98ac08474b36a088aca7270400
Code:
$ bitcoin-cli decoderawtransaction 0100000001c8cc2b56525e734ff63a13bc6ad06a9e5664df8c67632253a8e36017aee3ee40000000009000483045022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b248593abc1259512793e7dea61036c601775ebb23640a0120b0dba2c34b79001455141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51aefeffffff0120f40e00000000001976a9141d30342095961d951d306845ef98ac08474b36a088aca7270400
{
  "txid": "7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45",
  "hash": "7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45",
  "version": 1,
  "size": 229,
  "vsize": 229,
  "locktime": 272295,
  "vin": [
    {
      "txid": "40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8",
      "vout": 0,
      "scriptSig": {
        "asm": "0 3045022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b248593abc1259512793e7dea61036c601775ebb23640a0120b0dba2c34b790[ALL] 5141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51ae",
        "hex": "00483045022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b248593abc1259512793e7dea61036c601775ebb23640a0120b0dba2c34b79001455141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51ae"
      },
      "sequence": 4294967294
    }
  ],
  "vout": [
    {
      "value": 0.00980000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 1d30342095961d951d306845ef98ac08474b36a0 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9141d30342095961d951d306845ef98ac08474b36a088ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "13fLLox43yXYvfoZadXpGbkTUXkW8bhqut"
        ]
      }
    }
  ]
}
Code:
$ bitcoin-cli getrawtransaction 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8
0100000001da75479f893cccfaa8e4558b28ec7cb4309954389f251f2212eabad7d7fda342000000006a473044022048d1468895910edafe53d4ec4209192cc3a8f0f21e7b9811f83b5e419bfb57e002203fef249b56682dbbb1528d4338969abb14583858488a3a766f609185efe68bca0121031a455dab5e1f614e574a2f4f12f22990717e93899695fb0d81e4ac2dcfd25d00ffffffff01301b0f000000000017a914e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a8700000000
Code:
$ bitcoin-cli decoderawtransaction 0100000001da75479f893cccfaa8e4558b28ec7cb4309954389f251f2212eabad7d7fda342000000006a473044022048d1468895910edafe53d4ec4209192cc3a8f0f21e7b9811f83b5e419bfb57e002203fef249b56682dbbb1528d4338969abb14583858488a3a766f609185efe68bca0121031a455dab5e1f614e574a2f4f12f22990717e93899695fb0d81e4ac2dcfd25d00ffffffff01301b0f000000000017a914e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a8700000000
{
  "txid": "40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8",
  "hash": "40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8",
  "version": 1,
  "size": 189,
  "vsize": 189,
  "locktime": 0,
  "vin": [
    {
      "txid": "42a3fdd7d7baea12221f259f38549930b47cec288b55e4a8facc3c899f4775da",
      "vout": 0,
      "scriptSig": {
        "asm": "3044022048d1468895910edafe53d4ec4209192cc3a8f0f21e7b9811f83b5e419bfb57e002203fef249b56682dbbb1528d4338969abb14583858488a3a766f609185efe68bca[ALL] 031a455dab5e1f614e574a2f4f12f22990717e93899695fb0d81e4ac2dcfd25d00",
        "hex": "473044022048d1468895910edafe53d4ec4209192cc3a8f0f21e7b9811f83b5e419bfb57e002203fef249b56682dbbb1528d4338969abb14583858488a3a766f609185efe68bca0121031a455dab5e1f614e574a2f4f12f22990717e93899695fb0d81e4ac2dcfd25d00"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.00990000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a OP_EQUAL",
        "hex": "a914e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "3P14159f73E4gFr7JterCCQh9QjiTjiZrG"
        ]
      }
    }
  ]
}
Code:
$ bitcoin-cli decodescript 5141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51ae
{
  "asm": "1 042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf 1 OP_CHECKMULTISIG",
  "reqSigs": 1,
  "type": "multisig",
  "addresses": [
    "1Fz5s6qVFwP3MDGeNav4ESQXFMpm8ELzUw"
  ],
  "p2sh": "3P14159f73E4gFr7JterCCQh9QjiTjiZrG"
}
Code:
$ bitcoin-cli decodescript a914e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a87
{
  "asm": "OP_HASH160 e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a OP_EQUAL",
  "reqSigs": 1,
  "type": "scripthash",
  "addresses": [
    "3P14159f73E4gFr7JterCCQh9QjiTjiZrG"
  ]
}
viene usata la chiave privata di 1Fz5s6qVFwP3MDGeNav4ESQXFMpm8ELzUw per firmare la transazione multisig che richiede una sola firma.
comunque ho le idee abbastanza confuse su quale sia il reale funzionamento. ad esempio mi aspettavo di poter vedere gli indirizzi che compongono il multisig nella transazione in ingresso, pero' vedo solo l'indirizzo risultante.... bho....

thank you for taking time to read my post.
arulbero
Legendary
*
Offline Offline

Activity: 1723
Merit: 1776


View Profile
June 07, 2018, 08:32:53 PM
 #4

Ne abbiamo parlato anche qui https://bitcointalk.org/index.php?topic=4313499.msg39492037#msg39492037

Nel multisig si usano solo le chiavi pubbliche, non gli indirizzi; in questo caso c'è una sola chiave pubblica (multisig 1 su 1) che serve per la verifica, l'indirizzo che vedi 1Fz5... è solo per comodità di lettura.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!