Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 3.22 KB

RSKIP298.md

File metadata and controls

64 lines (42 loc) · 3.22 KB

Bridge peg-out creation index

RSKIP 298
Title Bridge peg-out creation index
Created 18-APR-22
Author JD
Purpose Sca
Layer Core
Complexity 2
Status Draft

Abstract

The Bridge generates the Bitcoin transactions that unlock the BTCs users have previously locked to operate in the network, this process is the peg-out. Since the HSM powpeg started operating, the powpeg nodes are required to provide the evidence the Bitcoin transactions were indeed generated by the Bridge. The evidence is stored in the blockchain in the form of an event, this event is generated in a transactions that requires 4,000 RSK confirmations. The process to fetch this information is tedious and time taking. This RSKIP proposes a better way to handle it.

Motivation

As the network adoption increases, the number of operations per block increases so it becomes even more important to focus on the performance of all the involved parties.

Specification

The proposal is to add an index that relates a given Bitcoin transaction hash, which must correspond to an unsigned peg-out transaction, to an RSK transaction hash. This index will be stored in the Bridge and will be updated by it, and accessed through it.

The proposed changes will imply a consensus change and should be treated as such.

Index

Proposed data structure

  • index key: (DataWord) Combinaton of string pegoutCreationIndex- and a Bitcoin transaction hash (Sha256hash -> 32 bytes). The resulting string should be hashed itself using Keccak256 hashing to end up having a valid 32 bytes long DataWord
  • index value: RSK transaction hash (Keccak256 -> 32 bytes)

Element addition

The elements will be added to the index when a new peg-out is created. This occurs in the updateCollections Bridge method. When this happens, the Bridge now will store in its storage a new entry for the peg-out creation index. This will use the Bitcoin transaction hash logged in RELEASE_REQUESTED event as the key and the current RSK transaction hash as the value.

Element fetching

When a user calls getPegoutCreationRskTxHashByBtcTxHash the Bridge should try to get the parameterized Bitcoin transaction hash from the newly created index. If the element does not exist it should return an empty byte array.

Element removal

Each time a pegnatory signs a peg-out it calls addSignature method, which internally registers the signature, recomposes the transaction and, when the threshold is achieved, it finally releases the peg-out removing it from its storage. At this stage, the Bridge should also remove the index entry as it is no longer needed.

New Bridge method

The Bridge will expose a new method called getPegoutCreationRskTxHashByBtcTxHash with the following signature:

function getPegoutCreationRskTxHashByBtcTxHash(bytes32 btcTxHash) returns bytes32

Copyright

Copyright and related rights waived via CC0.