# Capítulo 7: *"Advanced Transactions and Scripting"* ###### tags: `MB` [TOC] ## Material Principal Para esta sesión socrática debes leer el tutorial [¿Cómo crear una dirección multifirma con Bitcoin Core? ](/_C5BG4QkT8SE4KZIOC9x1Q) También debes leer el [Capítulo 7: *"Advanced Transactions and Scripting"*](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch07.asciidoc) del Libro **Mastering Bitcoin**. Estos son los enlaces a la versión del [libro en inglés](https://github.com/bitcoinbook/bitcoinbook) y la versión del [libro en español](https://drive.google.com/file/d/18NDHehFLGBDi_EVQQ59wQ2I99cvrrTJZ/view?usp=sharing). **Se recomienda leer en inglés, ya que es la versión más actualizada y completa**, pero es tu elección. Hemos estructurado las sesiones de acuerdo con los capítulos del libro en inglés. :::info :bangbang: **Importante:** Los términos técnicos siempre se dirán en inglés para facilitar el aprendizaje del idioma y la inmersión en el desarrollo de software de Bitcoin y LN. [Ver metodología de traducción](https://docs.google.com/document/d/1uPy771hf2xUElcaOR_Sk9NTqODeg9QZENYWL9leQc1g/edit?usp=sharing). ::: ## Lecturas complementarias | Contenido | Tiempo (min) | |:-------- |:--------:| |[Segregated Witness And Its Impact On Scalability](https://btctranscripts.com/scalingbitcoin/hong-kong-2015/segregated-witness-and-its-impact-on-scalability/)| 60| |[P2Pkh P2Wpkh P2H P2Wsh](https://btctranscripts.com/scalingbitcoin/tokyo-2018/edgedevplusplus/p2pkh-p2wpkh-p2h-p2wsh/)| 15| |[Script](https://en.bitcoin.it/wiki/Script)| 60| |[Miniscript](https://bitcoin.sipa.be/miniscript/)| 60| |[Timelock](https://en.bitcoin.it/wiki/Timelock)| 15| |[Transaction Timelocks](https://teachbitcoin.io/presentations/transaction_timelocks.html#/)| 20| |[OP CHECKMULTISIG](https://en.bitcoin.it/wiki/OP_CHECKMULTISIG)| 15| |[Bitcoin Transaction Malleability](https://eklitzke.org/bitcoin-transaction-malleability)| 20| ## Preguntas de Aprendizaje :::warning 🛑 Antes de resolver las preguntas del capítulo, revisa las instrucciones de trabajo de la sesión [aquí](https://hackmd.io/tJ56-ztCT6WERvNdx1N10g#Instrucciones-de-aprendizaje) ::: 1. What is a ++script++? What is a ++multisignature script++? 2. How are **P2SH** addresses codified? 3. What is a **P2SH**?, What is the difference between **P2SH** and a **P2PKH** (Pay To Pubkey Hash)? 4. What is a **P2MS** (Pay To Multisig)? 5. An extended public key (++XPUB++) it's a special type of public key, what does it mean? 6. What is _Miniscripting_? 7. What is a timelock?, What is the function of **nLocktime**?, Is it the same as a **CLTV**? 8. What is **nSequence**? 9. What are the ++Conditional Clauses++ or ++Flow Control++ scripts? Give some examples. 10. What is a Segregated Witness? Give some examples. 11. There is a bug in the CHECKMUTLISIG ++opcode++. Why don't we just fix it? 12. P2SH shifts the burden of fees and complexity from the sender to the spender. Why would you want to do this? 13. Provide a scenario in which you'd personally use a multisig transaction for. :::spoiler _En español_ 1. ¿Qué es un ++script++?, ¿qué es un ++script multifirma++? 2. ¿Cómo se codifican las direcciones **P2SH**? 3. ¿Qué es un **P2SH**?, ¿cuál es la diferencia entre un **P2SH** y un **P2PKH** _(Pay To Pubkey Hash)_? 4. ¿Qué es un **P2MS** _(Pay To Multisig)_? 5. Una clave pública extendida (++XPUB++) es un tipo especial de clave pública, ¿qué significa esto? 6. ¿Qué es _Miniscripting_? 7. ¿Qué es un bloqueo de tiempo?, ¿qué función tiene el **nLocktime**?, ¿es lo mismo que **CLTV**? 8. ¿Qué es **nSequence**? 9. ¿Qué son las ++Conditional Clauses++ o Scripts con ++Flow Control++? Da algunos ejemplos. 10. ¿Qué es un _Segregated Witness_? Da algunos ejemplos. 11. Existe un bug en el ++opcode++ de CHECKMUTLISIG. ¿Por qué no simplemente lo corregimos? 12. ¿_P2SH_ transfiere la carga de los ++fees++ y su complejidad desde el que envía a quien gasta? ¿Por qué harías esto? 13. Menciona un escenario en el cual tú personalmente usarías una transacción multifirma. ::: ## Ejercicios :::info 1. Using *testnet*, gather the public keys of your group partners to **create a multisig address** and deposit an amount of *test-coins* to this address. 2. With your group partners, _**spend**_ the transaction to deposit the *test-coins* to a new single address. ::: :::spoiler _En español_ :::info 1. Usando la *testnet*, recopila las llaves públicas de tus compañeros de grupo para **crear una dirección multifirma** y deposita una cantidad de *test coins* a esta dirección. 2. Con tus compañeros de grupo _**gasten**_ la transacción para depositar los *test coins* a una nueva dirección simple. :::