From 8279f41949e5596e9f7cd9635ce008e622383918 Mon Sep 17 00:00:00 2001 From: Pamela Gonzalez Perilli Date: Tue, 22 Oct 2019 15:09:40 -0300 Subject: [PATCH] Add RSKIP for Segwit compatibility --- IPs/RSKIP143.md | 42 ++++++++++++++++++++++++++++++++++++++++++ README.md | 5 ++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 IPs/RSKIP143.md diff --git a/IPs/RSKIP143.md b/IPs/RSKIP143.md new file mode 100644 index 00000000..7e943eae --- /dev/null +++ b/IPs/RSKIP143.md @@ -0,0 +1,42 @@ +# Segwit Compatibility + +|RSKIP |143 | +| :------------ |:-------------| +|**Title** |Segwit Compatibility| +|**Created** |22-OCT-19 | +|**Author** |PGP | +|**Purpose** |Sca,USa | +|**Layer** |Core | +|**Complexity** |2 | +|**Status** |Draft| + +## Abstract + +This document describes the procedure to allow the 2wp proccess to accept segwit transactions sent using a P2SH-PWPKH wallet. + +## Motivation + +The 2wp proccess only allows transaction who has been sent using a P2PKH address. This RSKIP describes how Bridge could accept P2SH-PWPKH[1] since this is one of the most popular wallet nowadays and the segwit transactions uses less space in a block. + +## Specification + +During the execution of the 2wp process, every new transaction is parsed to obtain the public key from it. If this identification cannot be made, then the Bridge considers the transaction as invalid. +The changes related to this RKSIP refer to changing the Bridge code of RegisterBtcTransactions function. This function is responsible of parsing Bridge transactions and obtaining the public key value from the data sent. +RegisterBtcTransactions performs a number of validations to the BTC transaction to verify it's legitimacy. After those validations have passed, it also checks if it's a lock, in that case it performs the lock using the sender's public key. These last two steps are the ones that need to be changed. +• Lock check. This check is currently only considering the input format for P2PKH. +• Sender public key fetching. Before getting the public key, this step validates the input's format, only the P2KH format. +In order to consider P2SH-PWPKH transactions, assuming the result of checking P2PK transcription legitimacy as invalid, it should be checked if it is a P2SH-PWPKH type of transaction. The RegisterBtcTransactions function needs to verify lock check and get the public key format using Segregated Witness format defined in BIP 144 [2]. + +This is the only change required to be able to accept P2SH-PWPKH segwit transactions. + +It has been checked that the functions of the Bitcoin library used support this type of format. + +## References + +[1](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki) https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki + +[2](https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki) https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki + +### Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/README.md b/README.md index 0dbcdbf8..7b3b1015 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,8 @@ RSK Improvement Proposals | 135 |[Managing BridgeMaster Federation Members](IPs/RSKIP135.md)| 25-NOV-16 | SDL | Sca | Core | 2 | Draft | | 138 |[Multi-signed transactions supporting enveloping and multi-key accounts](IPs/RSKIP138.md)| 10-SEP-19 | SDL | Sca | Core | 2 | Draft | | 139 |[Precompile to get transaction refunds](IPs/RSKIP139.md)| 10-SEP-19 | SDL | Sca | Core | 1 | Draft | +| 143 |[Segwit Compatibility](IPs/RSKIP143.md)| 25-OCT-19 | PGP | Sca, Usa | Core | 2 | Draft | + (*) Under evaluation to be implemented in the next reference client release @@ -148,4 +150,5 @@ RSK Improvement Proposals | MMa | Matias Marquez | | | MM | Martin Medina | martin@iovlabs.org | | SDL | Sergio Demian Lerner | sergio@iovlabs.org | -| SMS | Sebastian Matias Sicardi | sebastians@iovlabs.org | +| SMS | Sebastian Matias Sicardi | sebastians@iovlabs.org| +| PGP | Pamela González Perilli | pamela@iovlabs.org |