Skip to content

Commit

Permalink
Add RSKIP for Segwit compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Pamela Gonzalez Perilli authored and Pamela Gonzalez Perilli committed Oct 29, 2019
1 parent a9686ac commit 800cdaa
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
42 changes: 42 additions & 0 deletions IPs/RSKIP143.md
Original file line number Diff line number Diff line change
@@ -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 change the 2wp proccess to accept segwit transactions sent using a P2SH-PWPKH wallet.

## Motivation

The 2wp proccess only accepts transactions that were sent using a P2PKH address. This RSKIP describes how Bridge could accept P2SH-PWPKH[1] addreses since this is one of the most popular wallet nowadays and the segwit transactions use 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.
This RKSIP proposes changing the Bridge code of RegisterBtcTransactions function. This function is responsible for 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 its 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 is accepted.
• Sender public key fetching. Before getting the public key, this step validates the input's format, only the P2KH format.
Assuming it is not possible to get the P2PKH public key from the transaction's input, it should be checked if it is a P2SH-PWPKH type of input. The RegisterBtcTransactions function needs to verify if it is a lock transaction and then 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/).
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ 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 |
| 144 |[Parallel Transaction Execution for Unitrie](IPs/RSKIP144.md)| 13-OCT-19 | SDL | Sca | Core | 3 | Draft |
| 145 |[Strunct Transaction Format](IPs/RSKIP145.md)| 20-FEB-17 | SDL | Sca | Core | 2 | Draft |

Expand All @@ -150,4 +151,5 @@ RSK Improvement Proposals
| MMa | Matias Marquez | |
| MM | Martin Medina | [email protected] |
| SDL | Sergio Demian Lerner | [email protected] |
| SMS | Sebastian Matias Sicardi | [email protected] |
| SMS | Sebastian Matias Sicardi | [email protected]|
| PGP | Pamela González Perilli | [email protected] |

0 comments on commit 800cdaa

Please sign in to comment.