# RSKIP-305 Peg-out efficiency improvement (Segwit)

**URL:** <https://research.rsk.dev/t/rskip-305-peg-out-efficiency-improvement-segwit/368>\
**Category:** RSKIP\
**Created:** [July 15, 2022, 9:07pm UTC](https://research.rsk.dev/t/rskip-305-peg-out-efficiency-improvement-segwit/368 "2022-07-15T21:07:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![patogallaiov](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@patogallaiov](https://research.rsk.dev/u/patogallaiov)\
**Post date:** [July 15, 2022, 9:07pm UTC](https://research.rsk.dev/t/rskip-305-peg-out-efficiency-improvement-segwit/368/1 "2022-07-15T21:07:26Z")

</div>

Hello,  
Together with Nicolas Vescovo and Ramses Fernandez-Valencia, we have created a new draft RSKIP `Peg-out efficiency improvement (Segwit)`.

The purpose of the proposal is the introduction of Segwit V0 for use in peg-ins and peg-outs to improve performance, cost reductions, and security.

You can find the text of the RSKIP for details here:

- [RSKIP305 (website version)](https://ips.rsk.co/IPs/RSKIP305.html)
- [RSKIP305 (raw version)](https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP305.md)

---

<div class="post-metadata">

**Author:** ![mirisarri](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@mirisarri](https://research.rsk.dev/u/mirisarri)\
**Post date:** [August 7, 2025, 7:25pm UTC](https://research.rsk.dev/t/rskip-305-peg-out-efficiency-improvement-segwit/368/2 "2025-08-07T19:25:01Z")

</div>

An implementation of this RSKIP has been completed and proposed to be included in the upcoming [Reed network upgrade](https://research.rsk.dev/t/rskip-518-network-upgrade-reed/495) of rskj.

Code changes are open for review

> <https://github.com/rsksmart/rskj/pull/3165>
>
> Implementation of \[RSKIP305\](https://github.com/rsksmart/RSKIPs/blob/master/IPs/…RSKIP305.md)
> 
> \## Description
> Create a new federation type that is segwit-compatible according to \[BIP141\](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki) specification. Signatures are now inserted in the witness script instead of the scriptSig.
> 
> \## Motivation and Context
> This allows for the PowPeg to have up to 20 members max, and a significant reduction in pegout transactions fees (\> 60%)
> 
> \## How Has This Been Tested?
> Unit tests have been included in the PR. Functional testing will be executed before merging to master
> 
> \## Types of changes
> 
> \- \[\] Bug fix (non-breaking change which fixes an issue)
> \- \[x\] New feature (non-breaking change which adds functionality)
> \- \[\] Breaking change (fix or feature that would cause existing functionality to not work as expected)
> 
> \## Checklist:
> 
> 
> \- \[x\] My code follows the code style of this project.
> \- \[x\] My change requires a change to the documentation.
> \- \[x\] I have updated the documentation accordingly.
> \- \[x\] Tests for the changes have been added (for bug fixes / features)
> \- \[x\] Requires Activation Code (Hard Fork)
> 
> 
> \* \*\*Other information\*\*:
> \`fed:segwit\_compatible\_powpeg\_integration\`
> \`rit:disable-tbd-800\`

> <https://github.com/rsksmart/powpeg-node/pull/425>
>
> Related to https://github.com/rsksmart/rskj/pull/3165. Changes required to imple…ment \[RSKIP305\](https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP305.md)
> 
> \## Description
> \- Consider new segwit-compatible Federation type in FederationProviderFromFederatorSupport class
> \- No need to remove signatures from segwit-compatible pegout transactions before getting the unsigned transaction hash, signatures are no longer part of the transaction so they don't affect the hash calculation
> 
> \## Motivation and Context
> Be compatible with rskj changes to support segwit-compatible federations
> 
> \## How Has This Been Tested?
> Unit tests have been included in the PR. Functional testing will be executed before merging to master
> 
> \## Types of changes
> 
> \- \[\] Bug fix (non-breaking change which fixes an issue)
> \- \[X\] New feature (non-breaking change which adds functionality)
> \- \[\] Breaking change (fix or feature that would cause existing functionality to not work as expected)
> 
> \## Checklist:
> 
> 
> \- \[X\] My code follows the code style of this project.
> \- \[\] My change requires a change to the documentation.
> \- \[\] I have updated the documentation accordingly.
> \- \[X\] Tests for the changes have been added (for bug fixes / features)
> \- \[X\] Requires Activation Code (Hard Fork)
> 
> 
> \* \*\*Other information\*\*:
> \`rskj:segwit\_compatible\_powpeg\_integration\`
> \`rit:disable-tbd-800\`

---

<div class="post-metadata">

**Author:** ![mirisarri](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@mirisarri](https://research.rsk.dev/u/mirisarri)\
**Post date:** [August 7, 2025, 7:25pm UTC](https://research.rsk.dev/t/rskip-305-peg-out-efficiency-improvement-segwit/368/3 "2025-08-07T19:25:47Z")

</div>

I would also like to share the result of some tests executed with the code shared above.

- Peg-out with 9 signers, with the current format [https://mempool.space/tx/41e1cd34271a017ad1ac723fe67dfe10033f900b8c2a402afa500f124218e497](https://mempool.space/tx/41e1cd34271a017ad1ac723fe67dfe10033f900b8c2a402afa500f124218e497)

- Peg-out with 9 signers, with the new format (segwit) [https://mempool.space/tx/75d41a1bc3ce8f2f34bf4c1d2169cf292da81bbea332e7d6da882d8a5776f55a](https://mempool.space/tx/75d41a1bc3ce8f2f34bf4c1d2169cf292da81bbea332e7d6da882d8a5776f55a)

- Peg-out with 20 signers, with the new format (segwit) [https://mempool.space/tx/3b953f88bf68f64c64261014eeaee96e9a63227aae7a9265f9c990f0f678e82b](https://mempool.space/tx/3b953f88bf68f64c64261014eeaee96e9a63227aae7a9265f9c990f0f678e82b)

We can see that with this new proposal, even after increasing the amount of members in the PowPeg to 20, peg-out transactions are still at least 40% cheaper.

---

<div class="post-metadata">

**Author:** ![patogallaiov](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@patogallaiov](https://research.rsk.dev/u/patogallaiov)\
**Post date:** [August 7, 2025, 7:46pm UTC](https://research.rsk.dev/t/rskip-305-peg-out-efficiency-improvement-segwit/368/4 "2025-08-07T19:46:26Z")

</div>

Wow, this are great news! Achieving a 62 % improvement over the 66 % projection, is an outstanding result. Huge kudos to everyone who made it happen!

---

<div class="post-metadata">

**Author:** ![adrian.eidelman](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@adrian.eidelman](https://research.rsk.dev/u/adrian.eidelman)\
**Post date:** [August 8, 2025, 1:07pm UTC](https://research.rsk.dev/t/rskip-305-peg-out-efficiency-improvement-segwit/368/5 "2025-08-08T13:07:05Z")

</div>

Thanks for sharing, @mirisarri!
