Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build an MDF #2

Open
aalness opened this issue Nov 30, 2014 · 0 comments
Open

Build an MDF #2

aalness opened this issue Nov 30, 2014 · 0 comments

Comments

@aalness
Copy link
Owner

aalness commented Nov 30, 2014

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.

@aalness aalness changed the title Build a Rack app for the out-of-band communication required Build a Rack app for the MDFs Nov 30, 2014
@aalness aalness changed the title Build a Rack app for the MDFs Build an MDF Nov 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant