A Cursory Overview of How Vaporchains Work

in #vaporchain6 years ago (edited)

In this blog we briefly cover how Vaporchains are created and how they are mined. I am sharing my thoughts on how this protocol currently works to receive feedback and answer some questions y’all might have. This protocol is still in its infancy stage so anything stated here could change with time.

What is Vaporchain?

#Vaporchain is a protocol that runs on Steem where anyone can create, transfer and trade tokens all in a decentralized and trustless manner.

How Do I Create a Vaporchain?

Vaporchains are created by sending a command to @null via a transfer memo.

Example:

!vapor vapor vaporchain-test 0 28483711 20 5000 42053336 50 8 0

Memo ArgumentDefinition
!vaporRequired for detecting Vaporchain commands
vaporVaporchain name
vaporchain-testCreator of the Vaporchain (Sender of Memo)
0Current Vapor Block (Genesis)
28483711Future Steem Block when Vaporchain Activates
20Vaporchain Block Size (Steem blocks per Vapor Block)
5000Miner Reward
42053336Miner Reward Change Every X Blocks
50Miner Deflation %
8Math Precision (Important for calculating numbers)
0Pre-mine Amount for Creator

If the command is valid, arguments 2-11 are then sha256 together, as well as some reference information, and a Consensus is reached.

Example of reference information:
Ref = block_idx_opx_txid (of the Genesis Transfer)
Ref = 28483249_1_0_7dde15d719b9792b2cdd6969137676fde5b09510

Genesis Consensus is Reached As So:

sha256(“vapor,vaporchain-test,0,28483711,20,5000,42053336,50,8,0,ref”)
Answer: fb9111699d58562ffd519a9b091a16352ad61af9afdfe6b504164dee47206dae

What Is A Vapor Block?

Vapor Blocks store all transactions corresponding to token creation and transfers to that particular Vaporchain. A Vapor Block requires a certain number of Steem Blocks (aka Block Size) to be valid. The Vaporchain above, for example, will require 20 Steem blocks before the first Vapor Block can be created. Once the Vaporblock completes, bids can be sent to NULL to try and “mine” it. As so,

!vapor vapor vaporchain-test 1 0087a8d9c6cdb5519ef9370107fed771d89f35486f962970718e10d6c8d82832

Memo ArgumentDefinition
!vaporRequired for detecting Vaporchain commands
vaporVaporchain name
vaporchain-testCreator of the Vaporchain
1Head Block Number
0087a8d9c...block_id of Head Block

Mining Rewards

The highest bidder when the Vapor block is concluding will be the winner and earn mining rewards. Bids sent too late will be ignored.

How Consensus Is Reached For Each Vapor Block

Each Vapor Block must sha256 the following 3 things to find its block_id:

  1. Previous block_id
  2. All Steem Block_IDs (SID) that occurred during Vapor Block
  3. All Vapor Transactions (VTX) that occurred during Vapor Block

If Vapor transactions are null
block_id = sha256(“previous sid1,sid2,sid3...”)

If Vapor transactions are not null
block_id = sha256(“previous sid1,sid2,sid3... vtx1 vtx2 vtx3”)

Below are 3 Vapor Blocks formatted in JSON. The first two have 0 Vapor transactions while the third includes a mining reward to the highest bidder.


Vapor Block 1:{
"previous": "fb9111699d58562ffd519a9b091a16352ad61af9afdfe6b504164dee47206dae",
"sids": [
"01b2a07f219659269dc77b474550844bd8c5f5e6",
"01b2a080df850b093b40effa9d2f764bc92b54e8",
"01b2a081c35877b0c5c738418181145792920c13",
"01b2a0822db18eb1c78c0e049d426379f44c5e69",
"01b2a08305c54eb19b708a17b4373e9640715f16",
"01b2a0849cf8babcbb2fc676bd744a8d4633f692",
"01b2a085bbee90c928b9def87b3acef1c9db940d",
"01b2a086ad761a319a060fc71e7f22644808bd33",
"01b2a08779635a4d2a3595d8729eba932f98c2ac",
"01b2a08811a660f4f21bc50c4365ad93bad30026",
"01b2a089f604b306129ff068df79d98ac749257d",
"01b2a08a0932dd9111d0635fea09cf1bb01a1e41",
"01b2a08b1e1d2ef46a85ca66846d7dd0bba1c76a",
"01b2a08cd629c7b784e62891515818eed7577caa",
"01b2a08dd81b7a6275842a31ebc55415a32ddb19",
"01b2a08e2aa61a1a3346d5d540081d8fc1e80250",
"01b2a08f892b5c61e5706fbfdbcde66c1edb8f73",
"01b2a090a2d8f6eea01f55a6c5eb837eaf30c7e7",
"01b2a0916f27f7019bf61495a01ca2c26a36d121",
"01b2a092b87d9a7037bc27eb7a52dc096328858e"
],
"vtxs": [],
"block_id": "0087a8d9c6cdb5519ef9370107fed771d89f35486f962970718e10d6c8d82832"
}

------
NO BIDS SENT
------


Vapor Block 2:{
"previous": "0087a8d9c6cdb5519ef9370107fed771d89f35486f962970718e10d6c8d82832",
"sids": [
"01b2a0938aceac6699c58c363e3046ffb5b53d25",
"01b2a0944fd3d106d159c7dcb3fddef990c5071c",
"01b2a0957e9a9be62663b5edace54c094cacf846",
"01b2a0967356936a97a3cadb23d50a0c26d32036",
"01b2a09716cfc467dce16a96254410c28fa62b33",
"01b2a098856740dc00d2a63a8f11865716cf1915",
"01b2a09917d4366dc40803dff0c9c4a456e91c9e",
"01b2a09a48843e70e46932a693a34719d891a9b6",
"01b2a09b0714b7879214696e71e0bbee9447b545",
"01b2a09cbeb4ec4bc2c389fbfb8af482fb3b87a0",
"01b2a09d000911c8998648335496467c0ceefa29",
"01b2a09e0f4e5d0828bd14241d7723ebcaf4d535",
"01b2a09f7615cbc73dbd4d9af39e66f1a8afee08",
"01b2a0a0a9b477f7c9c8f96b287ba7f0cfff84f8",
"01b2a0a17d28ae5a3919f62b2b53785820857abd",
"01b2a0a255e226e78879525075b9143b280286e3",
"01b2a0a3a44cec177dfffa1d5946d0648bc0435f",
"01b2a0a4c44506c1529135064597754119dfdce0",
"01b2a0a52b9cfbfc98497d79c9a2fbb41b300eb8",
"01b2a0a626e0af2e25fdcdc248a648bb6f0d89fb"
],
"vtxs": [],
"block_id": "a3a31f032bd1607b3c8434d14d0b2396eb0d0c4b52f3a54d3c6af8e34bda8184"
}

------
BID SENT
------

!vapor vapor vaporchain-test 2 a3a31f032bd1607b3c8434d14d0b2396eb0d0c4b52f3a54d3c6af8e34bda8184


Vapor Block 3:{
"previous": "a3a31f032bd1607b3c8434d14d0b2396eb0d0c4b52f3a54d3c6af8e34bda8184",
"sids": [
"01b2a0a7615a7fc7d6d6eaf7f0d5a4dbb69c713d",
"01b2a0a835ae2cc8a9407219198835f6bde88d63",
"01b2a0a903ca626891d43a9f2afa3a765a1544e1",
"01b2a0aa9ccc43047d07b9f449950dafad973a04",
"01b2a0ab5de417b4824938b314f5f259dbea422b",
"01b2a0acd381753bd93661d149d2c73e44b1e403",
"01b2a0ad5a4a9208f92c8b6634e4340d42619807",
"01b2a0ae27d6dcf07961baa468b3e4c5d571b973",
"01b2a0aff84d0ca7d8b71caf81fcb8293bafdef5",
"01b2a0b0bb6eda88fd7f5a003cf0f43317557060",
"01b2a0b15a4ff2107894ff807bde232053027d99",
"01b2a0b223adfdf8271c9ee57ff4bcbb3ba185ec", ←Includes winning Bid
"01b2a0b32eb2dd5706e6537a2b666feaea309636",
"01b2a0b4c6b8afe919cde64a214ee59e88e44f97",
"01b2a0b59b57a2f429694729b034510568030a36",
"01b2a0b6aabe799364a6545149e13df9f7827142",
"01b2a0b776ff12764013229ca67e1f6f38f1c6c0",
"01b2a0b891adbd666cc96b657e2a67ba8b066c6a",
"01b2a0b9163d5b90ebc3986e1b3c248231c695f1",
"01b2a0ba7243405d9e4b4f166fc9408e73521cc9"
],
"vtxs": [
"reward,fulltimegeek,5000.0,28483762_21_0_5ac31101d03144bd0ba09dbead10f46da57a4863"
],
"block_id": "e5e3b02256d32a9099b9d3dd2d72b0a696e07cc81921a49ccb7edc8915ceaac5"
}

In block 3 you can see an example of tokens being rewarded to a miner. The other two remaining types of Vapor Transactions (Transfer,Trade) will be shown in future posts.

Sort:  

Damn your name fits.. even in laymans terms I don't understand.. it's all Geek to me 😆

This is far from laymans terms ... there's absolutely no way I was able to explain this without the nerdy details. My future posts for Vaporchain will probably be less complex and manageable. I will also try to add images as references.

Geek or no geek you know I trust you

Hey @fulltimegeek this is super interesting and I'm trying to wrap my head on the structure first. The first question that popped up is: can we directly store the commands in JSON or is there a length limit ?

Then,

vaporchain-test Creator of the Vaporchain (Sender of Memo)

Curious if we really need this information when sending the memo?

20 Vaporchain Block Size (Steem blocks per Vapor Block)

Does that mean there will be one Vapor block every 20 Steem blocks?

Maybe not last question, do you have an example on how to send a bid?

Wow, thank you for the great questions!

can we directly store the commands in JSON or is there a length limit ?

You should be able to do that. The Vaporchain Transfer and Trade commands will be in JSON. The reason why I didn't use JSON in the transfer's memo is due to a couple of reasons:

  1. It's quicker to detect a valid Vaporchain memo if I only have to scan the first argument "!vapor"
  2. Less clutter in the memo makes it easier to follow visually

vaporchain-test Creator of the Vaporchain (Sender of Memo)

Curious if we really need this information when sending the memo?

Yes, we do. That is because any user can create their own Vaporchain called "vapor" like we did. Each Vaporchain is tied to its creator indefinitely.

Maybe not last question, do you have an example on how to send a bid?

There is an example between Vapor Block 2 and Vapor Block 3. I'll paste it again below:

!vapor vapor vaporchain-test 2 a3a31f032bd1607b3c8434d14d0b2396eb0d0c4b52f3a54d3c6af8e34bda8184

That BID was sent AFTER Vapor Block 2 and BEFORE Vapor Block 3.

That BID was sent AFTER Vapor Block 2 and BEFORE Vapor Block 3.

Oh thank you, missed it.

!vapor vapor vaporchain-test 2 a3a31f032bd1607b3c8434d14d0b2396eb0d0c4b52f3a54d3c6af8e34bda8184

Is 2 the bid number, the actual value we want to give to get the reward?

The "2" is the block you're mining, which should always be the most recent one created by the Vaporchain.

Did I miss where the user input the bid value?

The input for the amount is taken from the Steem Blockchain not from the memo. All transfers on the Steem Blockchain already require a minimum amount of 0.001 STEEM/SBD before sending. So, that is what Vaporchains read. They only work with STEEM though.

Oh yes that's obvious, thank you very much.

During the bidding process, only one winner will be able to obtain the reward and all the other ones will lose their bid because sending an amount to @null is like burning STEEM coins. Is it right?

If understood correctly, one alternative could be to share the reward proportionally among all the bidders.

I did put some thought into that option when I first started but it ends up defeating the whole purpose of Proof-of-Burn. This is because the same person could have multiple accounts and if he never burns his STEEM he'll just keep getting his money back.

If users can outbid each other to get the block reward you are encouraging centralization. Programmers will be able to scan the blockchain at the last possible moment and outbid everyone else at the very last second, giving them such an incredible advantage that all the less savvy users will be pushed out instantly.

What I'd like to see is a lottery system where everyone who bids has a proportionate chance of winning depending on how much they bid.

Either that or all bids will have to be blind by being cast at the last second on the same block.

I also think it makes more sense to bid with SBD, since it makes more sense to burn our debt... however, I just recently made the claim that SBD should be eliminated altogether so it's hardly worth mentioning.

I also have to wonder how this system stops the bid-winner from posting bad blocks (fake transactions) or posting blank blocks with no transactions.

For the most part I'm very impressed by this project. This is an entirely new consensus algorithm. Proof-of-burn! Whoever nukes the most Steem gets the block reward... crazy. I had no idea there would be block rewards involved.

I have to say, when I heard you were calling it Vaporchain my brain immediately thought Vaporware. The name makes a little more sense now that I know Steem is being vaporized to mine a new chain. Best of luck with proof-of-vapor! Very wow, much exciting.

What could be interesting is to experiment with different ways to distribute the mining rewards. All would be proof-of-burn type, because all amounts are sent to @null in any case, but the distribution mechanism could be different. Here are some:

  • only one winner (current proposal),
  • re-distribute proportionally to the amount sent by each miner,
  • proportionate lottery system.

The mining mechanism could be a parameter in the vapor chain creation command.

Just a suggestion, I'm fine with the current proposal if we can get the first vapor chain faster :)

Programmers will be able to scan the blockchain at the last possible moment and outbid everyone else at the very last second, giving them such an incredible advantage that all the less savvy users will be pushed out instantly.

I also came to that realization when I was drawing this up. Currently, the only deterrent they have is the risk of the bid arriving too late and being invalid. Would you risk sending 100 STEEM in the last 3 seconds in hopes that it'll get added to the last block?

What I'd like to see is a lottery system where everyone who bids has a proportionate chance of winning depending on how much they bid.

I shall put some thought into that. I haven't considered having more than one miner per block. I will brainstorm on how that changes the game theory and complexity of the protocol.

Either that or all bids will have to be blind by being cast at the last second on the same block.

Something like this could also work, but that would eliminate all the non-techies from participating because they need to scan,verify and broadcast all in 3 seconds. They won't have 10 minutes to do it like I originally planned.

I also have to wonder how this system stops the bid-winner from posting bad blocks (fake transactions) or posting blank blocks with no transactions.

The bid winner can't change transactions because he can't change Steem blocks. All validators detect the same bid winner and just add one VTX ("reward,de_winner,5000,ref") at the end of the Vapor block. It's not something the winner does alone.

Currently, I think the easiest solution would be to keep everything the same and just provide the "bid snipping" software you're referring to. That way nobody has an advantage. And if you want to risk sending your bid too late, you're free to do so :)

One minor thing I'll be changing is how the amount is converted to string. It will be in decimal format only if necessary for accuracy.

Before:

reward,fulltimegeek,5000.0,28483762_21_0_

After:

reward,fulltimegeek,5000,28483762_21_0_

Good thing Vaporchains aren't live yet or that would've caused a fork.

@fulltimegeek I still cannot wrap my head who is computing the block containing this vtx, or any block to be honest. Is it the one starting the vaporchain who is responsible to write the following vapor blocks and are they stored on steem blocks?

Looking forward for the transfer and trade articles.

I still cannot wrap my head who is computing the block containing this vtx

Anyone that scans the blockchain up to that point using the same validator/rules. There are currently 3 types of Vaporchain transactions (VTX) that validators must be able to handle.

  • Bids (validator finds highest bid, if any)
  • Vapor Transfers (validator confirms user has tokens before sending)
  • Vapor Trades (validator confirms trade was successful)

Since all valid transactions must be accepted, and we are all running the same validator, we should all come to the same Consensus every block.

If a Vapor Block has no vtxs, a validator is not even required because all you have to do is hash previous and sids together. As so,

block_id = sha256(“previous sid1,sid2,sid3...”)

Thanks, understood, that is where the vapor name is coming, it's like implicit blocks.

Do you plan to release a validator library? And to run the validator is a full node needed?

Do you plan to release a validator library?

Yes, I plan on releasing software that automates the validation process.

And to run the validator is a full node needed

Not a Steem full node but maybe just a node that knows all the previous VTXs that have occurred on the network for that particular Vaporchain.

To make validation easy for everyone, I'm planning on verifying the first Vaporchain and dumping all the blocks, via Steem posts, so anyone can find them. But, I do hope people will run their own validator in the future. By me dumping all the Vapor blocks on the Steem blockchain, it gives anybody a chance to mine it because they can always find the most recent block_id by going to my page. And since the blocks will be 10 minutes apart, they'll have plenty of time to copy and paste the correct answer to send a bid.

Then more sophisticated and automated method of bidding could be implemented, knowing what other players have bid before. I imagine most bid would appear in the last steem block before the next vapor block, similarly to an eBay auction.

Posted using Partiko Android

I was looking for a good pic or gif to use for this post and I think I now found one :)

Great work, I think lol....
but does this mean that the vast majority of people on Steem who don't have a single clue to what you just wrote won't be able to 'mine' for themselves, thus again, leaving the techies who do understand, to mine like crazy and give themselves a huge head start..again ?
Also, I mentioned on someone else's post recently, there was a guy called @biophil who started something called 'Pocket tokens'. Is this a similar sort of thing ?

Steem who don't have a single clue to what you just wrote won't be able to 'mine' for themselves

I'm going to make it ridiculously easy for anybody to mine the first Vaporchain. If you know how to copy and paste and send a transaction within 10 minutes ... you can mine it. The only way you won't be able to mine it, is if someone keeps out bidding you every block.

Also, I mentioned on someone else's post recently, there was a guy called @biophil who started something called 'Pocket tokens'. Is this a similar sort of thing ?

I don't know, ask him because I never figured out how that works.

Thanks for replying. My problem is I don't understand enough to ask the right questions! Following with interest Sir :-)

Pocket tokens are similar to this and my project steem-state. I believe they use comments instead of memos, as well as don’t require transactions to be included in specific blocks.

Well.. there is always someone first.. that's the problem with contribution.
But I totally understand you.
I think 'Pocket tokens' is only 1 (?) Token, while with vaporchains you can create many tokens. One for every app or community for example.

Thanks! I mentioned them because I got some only last week on a post and I'd never seen them before and the accounts that sent them were inactive for a long time so it was simply strange!

Like @nathen007 says, I hope there's a guide for dumbos. I really don't know what your doing but it sounds interesting.

This is just under the hood stuff to explain how the concept works. The end user will not have to worry about any of this when creating, transferring or mining tokens.

Vaporchain software will make it painless.

"Vaporchain software will make it painless."
music to my ear because code talk i don't understand ( so wish I learned to code, maybe i will find the time next year)

Sounds like your idea is working then! Well done, Sir!

Yup, everything is lookin' good!

Screen Shot 2018-12-12 at 12.15.22 PM.png

HOORAY!!!!!!!!!!!!! I'm shocked, Steemit Inc. for the last year tried to do something that you managed to do in less than a month. I am impressed!!!

I don't know if I did this in less than a month because I've been brainstorming how to do it since I tried to make the Monsterchain for Steem Monsters (Summer 2018). It has taken a lot of thought.

Thanks for the support @cranium :)

Wow that is enough code to be thankful I have technicians that handle this stuff for me! I get sucked into looking at the syntax because I coded basic back in the day so it makes sense on a very basic level.

What is awesome about this is that you are leading the way and innovating and being a great example of progressing in times of regression.

So glad to have you selected as witness and appreciate your support.

Thank you so much for your continued support @zekepickleman ... I also appreciate the witness vote and all the kind things you've said about me on the blockchain :)

I'll keep trying to lead the way to a better world.

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.029
BTC 56446.21
ETH 2966.07
USDT 1.00
SBD 2.17