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 25, 2019
1 parent a687bfe commit 28115e9
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 allows the 2wp proccess to accept segwit transaction sent using a P2SH-PWPKH wallet.

## Motivation

The 2wp proccess only allows transaction who has been sent using a P2PK 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 needs less space in a block.

## Specification

During the execution of the process, it parse each new transaction sent to obtain public key from it. If this identification cannot be made, 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 to parse the transactions and obtaining the public key value of the data sent to it.
RegisterBtcTransactions performs a number of validations to the BTC transaction to verify it legitimacy. After those validations, it will also check if it's a lock, and in case it is, it will then perform the lock using the sender's public key. These last two steps need to be changed.
• Lock check. This check is only considering the input format for P2KH.
• Sender public key fetching. Before getting the public key, this step will validate the input's format, only using the P2KH format.
In order to consider P2SH-PWPKH transactions, asuming the result of checking P2PK transcription legitmy as invalid, it should be checked if it is of P2SH-PWPKH type of transaction. The RegisterBtcTransactions function needs to verify lock check and gets the public key format using Segregated Witness format defined in BIP 144 [2].

The only change required to be able to accept P2SH-PWPKH is what must be done in the function just mentioned.

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/RSKIP142.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 28115e9

Please sign in to comment.