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 28, 2019
1 parent a687bfe commit 8279f41
Show file tree
Hide file tree
Showing 2 changed files with 46 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 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/).
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -148,4 +150,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 8279f41

Please sign in to comment.