drivechain-project / drivechain.info

Drivechain Microsite
4 stars 8 forks source link

Update the Drivechain demo video. #3

Open CryptAxe opened 7 years ago

CryptAxe commented 7 years ago

The Drivechain demo video was created before the BMM process was added and has created some confusion. An updated video following the BMM process instead of using the generate rpc command should be recorded and linked on the website.

Extra credit: As the page is in markdown, I can't embed the webm demo video. However, an animated GIF placeholder could be used to create a preview on the page that would lead to the full video if clicked.

Sjors commented 7 years ago

Ah, that explains... Before you make the video, can you also explain in plain text what the steps are? I have a vague understanding of how BMM works now, but it's not obvious how to use the UI or RPC for this between the two clients and in what order.

CryptAxe commented 7 years ago

I recommend looking at these links which will explain much more thoroughly: https://github.com/drivechain-project/docs/blob/master/DeveloperNotes.md https://github.com/drivechain-project/docs/blob/master/bip2-blind-merged-mining.md http://www.truthcoin.info/blog/blind-merged-mining/

And here is my tldr:

  1. Sidechain block creator Simon forms a block on the sidechain, and takes the hash of that block (h*)

  2. Simon creates an OP_BRIBEVERIFY output on the mainchain to bribe mainchain miners to commit that hash into a coinbase output, applying mainchain PoW to the h*.

  3. Mary a mainchain miner accepts the h* bribe, commits it in a coinbase and collects the bribe (after a maturation period like generated coins).

  4. Simon, the sidechain block creator, now that his bribe has work applied to it, can publish his sidechain block along with a proof that it was included in a mainchain block to the sidechain and it will become a sidechain block if it is valid. Simon gets to collect the block's transaction fees after a maturation period.

Let me know if I can clarify anything :)

Sjors commented 7 years ago

These documents only describe the theory, but not how to actually use the RPC / GUI.

When learning about a new system, I find it useful to just enter a bunch of commands, only vaguely understanding their meaning. My math professor used to call this the "magic level" on the pyramid of knowledge. Having done it once, it makes reading an abstract text easier, which then gives me the ability to tweak these commands, etc.

I was able to do step (1) in the UI by going to the Sidechain tab, then to the BMM tab, then clicking Generate Block.

I couldn't find UI for (2). Going through the diff, I found some undocumented new RPC calls:

schermafbeelding 2017-09-01 om 09 29 43

Do I need createbribe to create this OP_BRIBEVERIFY output? That doesn't same to take a hash as an argument though. Or do I need to manually craft a transaction? Any good tools for that?

I assume step (3) is automatic in regnet when I call generate 1?

For step (4), I assume I need to use the "Connect BMM block" form that's below the block I generated in step (1)?

Sjors commented 7 years ago

At what point should a sidechain deposit made with the mainchain wallet show up in the sidechain wallet UI?

Perhaps related, do I understand correctly that the sidechainBMM and mainchainBMM nodes should use separate -datadir paths?

Sjors commented 7 years ago

I think I managed to get to step two now, in the mainchain console:

createbribe 0.1 0 54be...ed90 return_address

Where 0.1 is the amount of BTC to pay the miner for the privilege of including this transaction, 0 is the sidechain block height, followed by h* that the sidechain client provided in step 1, and finally an address you control on the mainchain to receive a refund if needed.

This gets mined - step (3) - using generate 1.

For step (4) you need to enter three values:

  1. mainchain block hash (returned by generate 1 in the previous step)
  2. proof: I haven't figured out where to find this
  3. coinbase: the full hex of the coinbase transaction? E.g. the first transaction you see when doing getblock [mainchain block hash] and then do getrawtransaction [coinbase tx id]
Sjors commented 7 years ago

Found another clue... I think I need to do gettxoutproof ["hash_of_coinbase_tx"] and use that as the second field. Unfortunately nothing happens when I click the Connect Block button.

Also regtest nodes don't connect to each other by default. You need to add a unique port=N to both bitcoin.conf files and then use addnode 127.0.0.1:N onetry to connect one node to the other. The connection succeeded, but I'm not seeing any different behavior.

CryptAxe commented 7 years ago

Also regtest nodes don't connect to each other by default. You need to add a unique port=N to both bitcoin.conf files and then use addnode 127.0.0.1:N onetry to connect one node to the other. The connection succeeded, but I'm not seeing any different behavior.

If you take a look at the testing instructions we have a configuration file recommendation: https://github.com/drivechain-project/testing/blob/master/side.conf

You don't have to do anything that complicated, just connect=localhost :)

As for the rest, like I mentioned here: https://github.com/drivechain-project/drivechain.info/issues/4 we are in the middle of work and changes to BMM so you can still test things individually but until we have actually finished BMM you can't test all of it together.

Sjors commented 7 years ago

Ah, I overlooked that entire repo... Wouldn't it make more sense to move it to the docs repo?

CryptAxe commented 7 years ago

Ah, I overlooked that entire repo... Wouldn't it make more sense to move it to the docs repo?

Yes that would make more sense, and you probably would have seen it if it was there! So ignore what I said in my last comment. Once the testing guide is updated we should move it into the docs repo and archive the testing repo.