Skip to content

Build an MDF #2

@aalness

Description

@aalness

Hand-wavy design

MDFs (mutually distrusting functionaries) will each run a node on each blockchain as well as an API service which will require endpoints like:

  1. /generate?address=<payee address>&nonce=<random nonce>
  2. /peg?txid=<transaction hash>
  3. /sign?txid=<transaction hash>&tx=<serialized partially signed transaction>

/generate

Someone wanting to pay into a sidechain will hit this endpoint on each MDF with a payee address and a nonce. The MDFs will then record the payee address and nonce and calculate the P2SH address and redeemScript (using Contracthashtool#generate) the user will be paying to.

It returns the P2SH address to pay into on success. Each MDF should return the same result.

/peg

The user will hit this endpoint with the transaction hash of a transaction they made on the blockchain paying to the P2SH address from the previous step after the confirmation period has lapsed. The MDF contacted will create a transaction on the sidechain paying to the payee address with an appropriate output value in accordance with the predefined peg ratio wrt the output amount in the referenced blockchain transaction.

It returns the partially signed sidechain transaction.

/sign

The user will then hit this endpoint of M-1 MDFs to gather the required number of signatures for the sidechain transaction. The txid parameter is the hash of the transaction on the initial blockchain. The tx parameter is the serialized partially signed sidechain transaction. It is assumed that the MDFs can quickly retrieve the payee address and nonce from their database given the P2SH address seen in the output of the txid transaction and feed them into Contracthashtool#claim in order to derive a private key for signing.

It returns the partially (or potentially completely) signed transaction on success.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions