Created
July 29, 2020 19:34
-
-
Save anurag-arjun/021aa96c0a195bb97098801db71f08f4 to your computer and use it in GitHub Desktop.
Matic-Reddit-submission
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Matic Network's Great Reddit Scaling Bake-Off submission | |
The Matic team has put together a Proof-of-Concept for the Reddit Scaling Bake-Off. We think Matic is the most apt solution for the scaling requirements of Reddit, keeping in mind it’s current and future needs. | |
We believe that the Matic Layer 2 platform is the most complete solution out there in terms of the features and fits right in with what Reddit requires: | |
* Security via Plasma predicates on Ethereum: Reliable exits to Ethereum (Proof-of-Stake based decentralized multi-operator Plasma construction which mitigates mass exit occurrence) | |
* Composability (EVM Support), | |
* Extremely high scalability with each sidechain (multiple sidechains in future, hence suitable for the scale of Reddit) | |
* Ability to add custom smart contract features (via Ethereum Plasma predicates) for future product innovation | |
>***TL;DR:*** *The Matic sidechain processed 3mn transactions over 12 hours with a total gas fees of USD 3.52 as part of the Great Reddit Scaling Bake-Off PoC.* | |
> | |
>The PoC used a few addresses only for the purpose of the demo, and the total throughput with millions of user addresses can go up to 7200 TPS per sidechain. | |
The PoC touches upon various aspects of the solution required – scalability that will need to meet Reddit’s requirements over time (more sub-reddits using Community Points), faster transaction times, inexpensive minting of Community Points, decentralization, accessible developer tooling, use of meta-transactions to pay for gas on behalf of users, open source code, extensibility, ability to exit back to Ethereum, if needed and more. | |
**What is Matic?** | |
Matic Network is a Layer 2 scaling solution for Ethereum that provides hybrid Proof-of-Stake and Plasma-enabled sidechains. We just released version 1 of our mainnet in May 2020 – [https://blog.matic.network/the-matic-network-mainnet-is-now-live/](https://blog.matic.network/the-matic-network-mainnet-is-now-live/). | |
Matic implements an account-based variant of MoreVP ([More Viable Plasma](https://ethresear.ch/t/account-based-plasma-morevp/5480)), with support for custom Plasma [predicates](https://plasma.build/t/predicates-in-matic-plasma/86). The Plasma framework with predicates is used to guarantee the security of assets and specific smart contracts using Plasma predicates, while arbitrary smart contracts are secured by a Proof-of-Stake network, with validators staking Matic tokens on Ethereum. Matic sidechains are essentially EVM-enabled chains and are conducive to ready deployment of Solidity smart contracts, essentially making it an easy tool for Ethereum developers to use it for scaling their dApps/Protocols. | |
**We are submitting the following:** | |
* A live proof-of-concept which demonstrates the scale required for the bakeoff and future requirements | |
* **We did over 3,000,000 (3 million) transactions in our scaling PoC bulk run over a period of \~12 hours (yes that’s 3 mn transactions):** | |
* 1,000,000 point claims (minting & distributing points) | |
* 1,000,000 subscriptions and 1,000,000 burns | |
* 1,000,000 transfers | |
* Proof-of-Concept repo – [https://github.com/maticnetwork/reddit-bakeoff-poc](https://github.com/maticnetwork/reddit-bakeoff-poc) | |
* A detailed explanation of the demo is given here: [https://github.com/maticnetwork/reddit-bakeoff-poc/blob/develop/README.md](https://github.com/maticnetwork/reddit-bakeoff-poc/blob/develop/README.md) | |
* The following contracts have been deployed on [Mumbai testnet](https://mumbai-explorer.matic.today/) – | |
* SubredditPoints: [0xc4f93FeF8086c452134B0F15a5AE963ACe6A7748](https://mumbai-explorer.matic.today/address/0xc4f93FeF8086c452134B0F15a5AE963ACe6A7748/transactions) | |
* Distributions: [0xd7ab2634121e7afCE48b2A8Ea5db908869158D3E](https://mumbai-explorer.matic.today/address/0xd7ab2634121e7afCE48b2A8Ea5db908869158D3E/transactions) | |
* Subscriptions: [0x94B8f2A9a36Be215F2D4211DFee523f204f0a897](https://mumbai-explorer.matic.today/address/0x94B8f2A9a36Be215F2D4211DFee523f204f0a897/transactions) | |
* Refer [https://github.com/maticnetwork/reddit-bakeoff-poc/blob/develop/README.md#workflows](https://github.com/maticnetwork/reddit-bakeoff-poc/blob/develop/README.md#workflows) for the end-to-end flow of the PoC | |
* User requests a claim from Owner account, and submits the claim to the distributions contract which then (internally) calls Subreddit Points contract to mint tokens. | |
* User can transfer SubredditPoints tokens to another user | |
* User submits subscribe transaction to place a subscription intent, thereby burning some amount of their tokens. | |
* Wiki for more information on the PoC and relevant Matic links can be found here: [https://github.com/maticnetwork/reddit-bakeoff-poc/wiki](https://github.com/maticnetwork/reddit-bakeoff-poc/wiki) | |
* Single user scripts can be found here – [https://github.com/maticnetwork/reddit-bakeoff-poc/tree/develop/scripts](https://github.com/maticnetwork/reddit-bakeoff-poc/tree/develop/scripts) | |
* Single user scripts with meta-transaction support (gas to be paid on behalf of the user) can be found here: | |
* [Gas Station Network](https://www.opengsn.org/): [https://github.com/maticnetwork/reddit-bakeoff-poc/tree/gsn](https://github.com/maticnetwork/reddit-bakeoff-poc/tree/gsn) | |
* Bulk transaction scripts can be found here: [https://github.com/maticnetwork/reddit-bakeoff-poc/tree/reddit\_benchmark](https://github.com/maticnetwork/reddit-bakeoff-poc/tree/reddit_benchmark) | |
* The bulk transaction run of 3 million transactions can be found here | |
* Bulk transaction logs can be found here: [https://drive.google.com/…/1r1X0RNTIpE0w4MY599t9TO8PHvdQXqqz](https://drive.google.com/drive/folders/1r1X0RNTIpE0w4MY599t9TO8PHvdQXqqz) | |
* A previous run of the bulk transactions having 300k transactions can be found here – [https://www.notion.so/maticnetwork/Reddit-PoC-bulk-transaction-script-results-5aac772b3c0b424b93c7700ad53dc30c](https://www.notion.so/maticnetwork/Reddit-PoC-bulk-transaction-script-results-5aac772b3c0b424b93c7700ad53dc30c) | |
* Total cost of the PoC (1 mn transactions each – total 3 mn txs) – \~3.52 US$ at current price | |
* Claim and mint points: \~71 Matic tokens (\~1.4 US$) | |
* Subscribe and burn points: \~52 Matic tokens (\~1.02 US$) | |
* Transfer points: \~56 Matic tokens (\~1.1 US$) | |
* A live mainnet (we just launched in May 2020 after 2+ years of development!) | |
* Very cheap transactions | |
* Atleast \~4000 TPS, but we have gotten around 17,000 TPS while [benchmarking](https://github.com/maticnetwork/monitoring-tools/tree/master/benchmarking) | |
* Block time is \~2 seconds | |
* [Code](https://github.com/maticnetwork), which is already open source – audited by 3 different audit firms | |
* [Documentation](https://docs.matic.network/), including [architecture](https://docs.matic.network/docs/contribute/matic-architecture) | |
* EVM compatible interface – [web3js](https://web3js.readthedocs.io/) and other web3 library support | |
* Standard Solidity support to enable existing smart contracts to be deployed without major rework | |
* EVM compatibility results in support for all Ethereum developer and user tooling | |
* Most wallets such as [Portis](https://docs.portis.io/#/configuration?id=network), [Torus](https://docs.tor.us/torus-wallet/developing-with-torus-wallet/networklist), [Fortmatic](https://docs.fortmatic.com/web3-integration/network-configuration#switch-network-to-custom-node), [Metamask](https://metamask.io/) and others already have support for the Matic mainnet sidechain | |
* Most [libraries](https://docs.matic.network/docs/develop/getting-started) readily usable on Matic | |
* Compatibility with common utilities & toolchains | |
* Third-party permissionless [integrations](https://docs.matic.network/docs/integrate/quickstart) | |
* HSM and hardware wallet support | |
* Account-based [Plasma MoreVP implementation](https://docs.matic.network/docs/contribute/contracts/plasma_contracts/account_based_plasma), with [Plasma predicates](https://docs.matic.network/docs/contribute/contracts/plasma_contracts/predicates) support to enable more expressive, custom fraud proofs, if required | |
* Reddit smart contracts can be modified and appropriate fraud proofs via predicates can be written to ensure changes can be done later | |
* [Decentralization:](https://docs.matic.network/docs/contribute/contracts/stakingmanager) Validators operating the Plasma chain need to stake Matic tokens on our staking smart contracts deployed on Ethereum. They can be slashed in case they resort to adversarial behavior. | |
* [GSN](https://www.opengsn.org/) and [Biconomy](https://biconomy.io/) support for meta-transactions (Reddit can pay gas fees on behalf of their users) | |
* [Fast exits/withdrawals](https://blog.matic.network/faster-plasma-exits-with-nuo/) from Ethereum to Matic via our tokenized NFT/ERC721 exit mechanism | |
* [https://medium.com/matic-network/enabling-faster-plasma-exits-3ca5a936f215](https://medium.com/matic-network/enabling-faster-plasma-exits-3ca5a936f215) | |
* [https://github.com/maticnetwork/reddit-bakeoff-poc/wiki/Withdraw:-How-to-exit-from-Matic-chain](https://github.com/maticnetwork/reddit-bakeoff-poc/wiki/Withdraw:-How-to-exit-from-Matic-chain) | |
* Fully functional [Blockchain explorer](https://explorer.matic.network/) | |
* Tokens can be withdrawn to Ethereum in case the Matic sidechain goes down by way of our [Plasma MoreVP](https://ethresear.ch/t/account-based-plasma-morevp/5480) mechanism | |
* Plasma contracts have been audited by a leading audit firm | |
* Inexpensive minting on Matic directly | |
* As and when users do want to exit to Ethereum, they can do so via the [MintableERC20](https://github.com/maticnetwork/reddit-bakeoff-poc/blob/develop/contracts/root/predicate/MintableERC20Predicate.sol) predicate. Once they exit to Ethereum, the exited token amount is burned on the Matic sidechain and correspondingly minted on the mapped Ethereum Subreddit ERC20 token contract. The only requirement here is that the Ethereum and Matic ERC20 token contracts be mapped in advance once in the Matic Plasma contracts on Ethereum. | |
More details on the submission can be found on our blog post on this: [https://blog.matic.network/matic-goes-to-the-great-reddit-scaling-bakeoff/](https://blog.matic.network/matic-goes-to-the-great-reddit-scaling-bakeoff/). | |
Looking forward to what's in store! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment