This is a wrapper and demo page. Plasma like implementation and Parent smart contract placed in BANKEX/PlasmaParentContract*
The public beta will be deployed on Rinkeby network. Link: TBA
For Beta 1 only basic functions are enabled with non-optimized UI:
Deposit on the main chain
Transact in Plasma chain - split, merge, transfer, express withdraw
Only express withdraw is allowed for user experience - it's a two-step process:
Burn ETH in Plasma by submitting output to address 0x0
Submit proof of such transaction to the smart contract on the main chain to withdraw on the main chain
The function of Web3 to sign arbitrary data is used to proof your ownership of the address.
Sum of the outputs is strictly equal to the sum of the inputs
As there is no standalone client to download and verify blocks, so there is no functionality to proof invalid transactions using the smart contract on the main chain. Wait until Beta 2
UTXOs are not automatically merged into Beta 1
Initial implementation of a single server-side "Operator" service (with some extra functionality for testing) and v0.1 smart contract for Ethereum blockchain that can be used to enforce proper behavior in case of disputes.
The task is to make blockchain transactions as fast as they can be applied virtually to any application.
One of the possible solutions is Plasma - the prominent upgrade to Ethereum blockchain. Our approach is based on this conception.
From a technical point of view Plasma blockchain - is just another blockchain, that can be efficiently settled to parent Ethereum chain and is well protected from the misbehavior of both Plasma operator and Plasma blockchain participants by smart-contract on Ethereum network.
Plasma chain itself has a straightforward structure with assets being undividable and transferred in full from the previous owner to the next one. The transaction has inputs and outputs, with few different types of transactions depending on the required function. For example, we propose type "Merge" to connect two inputs into one output in order to reduce the number of UTXOs that will be followed by the client. Full description will be given when the design is more stable. All chain logic is made using Ethereum crypto primitives - sha3, secp256k1 and 65-byte signatures allowing the use of ecrecover.
Block in Plasma network has a structure of Header:
[BlockNumber, NumberOfTransactions, ParentHash, MerkleTreeRoot, PlasmaOperatorSignature], where
ParentHashreferences to the previous block (by number)
MerkleTreeRootis root hash of a Merkle tree
NumberOfTransactionstransactions in this Plasma block and an array of transactions.
The header is submitted by Plasma network operator to the smart-contract on Ethereum chain. Blocks can only be sent one by one, with sequence numbering is enforced by contract. Any user of Ethereum network can deposit ETH to contract that will trigger, event and will allow Plasma network operator to make a funding transaction in a Plasma chain. Then users can freely transact in Plasma chain, with headers pushed to a parent contract in Ethereum.
When a user wants to settle one of his transactions to the main network, he initiates a withdraw on Ethereum network by providing the reference to the transaction (in the form of
OutputNumberInTX), full transaction and Merkle proof that this transaction was indeed included in that block. Parent contract checks a proof versus submitted root hash for this block. If validation was successful the process of withdrawing starts. After 24 hours it can be finalized. There is a particular kind of transaction in Plasma network that can speed up a process by efficiently burning the input (sending it to
0x0). If this block is not published by the operator, withdrawing can go as usual.
The concept is implemented using JS with conjunction on Web3 and ethereumjs/testrpc on a backend. For the sake of simplicity, all necessary functions are wrapped in REST API calls doing signatures on behalf of a predefined set of the address on a server. Further work will allow users to use wallet apps such as Metamask to initiate transactions in a Plasma network by making a signature on a client side and interacting with a parent contract on Ethereum network as usual.
Here at BankEx, we believe in the efficiency of offloading of some transactions from Ethereum blockchain to Plasma chains especially if the proper incentive is present for Plasma operators to behave appropriately (such incentive can be presented in the form of competing with other operators for obtaining end-users). Another advantage is flexibility of Plasma chain implementation as long as it can be effectively cross-checked by contract on a parent chain. With the new cryptographic primitive added in Metropolis fork, one can extend our PoC implementation with transactions utilizing ring signatures of zkSNARKs for the privacy of end user.
git clone https://github.com/BankEx/PlasmaETHexchange.git cd PlasmaETHexchange
npm install npm run server
Insomnia.json is an Insomnia workspace file with various testing functions, play with it.
!! May require some parameter changes in existing requests to comply with new output numbering.
Will be filled later
To have a more open and welcoming community, BankEx adheres to a code of conduct.
Bug reports, feature requests, patches, well-wishes are always welcome!
I'd love to see your ideas for improving this library!
See also the list of contributors who participated in this project.
PlasmaETHexchange is available under the MIT license. See the LICENSE file for more info.