plasma
擴(kuò)展性方面荒辕,通過(guò)添加子鏈擴(kuò)展主鏈,每個(gè)子鏈內(nèi)部有自己的共識(shí)機(jī)制犹褒,子鏈產(chǎn)生的區(qū)塊會(huì)被打包到主鏈中抵窒,使主鏈變成了blockchain of blockchain。
性能方面叠骑,由于增加了更多鏈李皇,所以提高了TPS,但是在賬戶由子鏈退出到主鏈過(guò)程中,因?yàn)樽渔準(zhǔn)荱TXO賬戶模型宙枷,需要在主鏈中搜索所有區(qū)塊查找包含該賬戶的所有交易掉房,當(dāng)區(qū)塊數(shù)量特別大時(shí)plasma采用mapreduce去解決,但性能上有隱患慰丛。
plasma cash
為了解決上述問(wèn)題plasma cash在子鏈中的幣是有ID的且不可分割的卓囚,每個(gè)ID綁定一個(gè)pub key。這樣退出搜索整個(gè)鏈的時(shí)候只需要查找包含該ID的區(qū)塊诅病,而不是所有區(qū)塊哪亿,并且可以引入checkpoint粥烁,在某個(gè)point上記錄該ID的balance,這樣更快的得到退出時(shí)得到的幣蝇棉。
plasma debit
plasma cash雖然解決了退出性能問(wèn)題讨阻,但是幣的不可分割性導(dǎo)致了無(wú)法進(jìn)行小額交易。為了解決引入了plasma debit篡殷。具體解決方法如下英文描述变勇,由此得出plasma debit在性能,可用性上更具優(yōu)勢(shì)贴唇。
In Plasma Cash, the transaction Merkle tree is divided into slots, each of which stores a fixed denomination of ETH (the amount that was deposited) and tracks a public key. Each transaction in that slot updates the public key currently associated with that coin.
In Plasma Debit, each slot would track not only a public key, but a number a between 0 and v, where v is the total amount of ETH that was deposited into that account on the main chain. v does not change, but a can vary in each transaction, and represents the portion of the current coin that is owned by the owner. The remainder of the money deposited in that slot is owned by the operator. A transaction in which a is changed, like any other transaction, requires a signature from the current coinholder. (The operator does not need to sign the update, since their consent is impli
ed by their inclusion of the transaction.)
When a coin is withdrawn, the coinholder receives a, and the operator receives v – a. (The exit rules need to be altered slightly to allow either the owner or the operator to exit a coin.)
When a coin is initially created, a is equal to v. The operator can increase v (and thus increase their balance held in the coin) by depositing additional ETH into that coin, using a separate operatorTopUp function on the parent chain’s contract.