Why We Chose Matic Network to Scale Our Games
By porting our Ethereum contracts to the Matic sidechain, our games benefit from near-instant transactions and higher transactional throughput, while maintaining the trustlessness, fairness, and decentralization of blockchain architecture.
Layer 1 - Ethereum
The current state of the Ethereum root chain only supports 25 transactions per second and often takes 15-20 seconds to reach finality in order to maintain its decentralization. As a result, any games featuring transactions signed by the user are unbearably slow, oftentimes too slow to even maintain user interest.
For example, our slot machine game deployed on-chain on the Ropsten test network requires output from the contract to determine the outcome of the play, which is then sent to our Decentraland app to display in the 3D Metaverse. If game logic lives on the root Ethereum blockchain, on-chain finality requires over 15 seconds from the initial transaction to determine the outcome.
From a player perspective, this is displayed by the slot reels spinning for 15 seconds before ultimately stopping in place. The end product is a suboptimal user experience.
Layer 2 - Matic Network
Matic seeks to solve this throughput and speed problem for games and other applications built on Ethereum. Matic’s account-based implementation of Plasma allows for our Ethereum contracts to be seamlessly ported over to their compatible VM equipped sidechain. Not only does Matic end up delivering a better user experience with faster finality time for in-game transactions - Matic also allows for our games to support a much wider user base as their sidechain has been tested to support 7,000-10,000 transactions per second and only costs 1/100th of the amount in ETH gas (as compared to the Ethereum main net).
This increase in-game efficiency only occurs once user funds have been deposited and are movable within the Matic Network sidechain ecosystem. There is a process of depositing and exiting this architecture as outlined on the Matic documentation using Matic.js:
User deposits tokens in Matic contract on the mainchain.
Once deposited tokens get confirmed on the main chain, the corresponding tokens will be reflected on the Matic sidechain.
The user can now transfer tokens to anyone they want or interact with any contract instantly with negligible fees. The Matic chain has faster blocks (approximately 1 second). That way, the transfer will be done almost instantly.
Once a user is ready, they can withdraw remaining tokens from the mainchain by establishing proof of remaining tokens on Root contract (contract deployed on Ropsten/Ethereum main chain) within 7 days. This creates an NFT that represents the number of funds requested in the exit.
In the future, the user may also get a fast exit via DEx’s or Lending protocols (coming soon!).
The Matic Network team is currently developing a native Decentraland-based UX for depositing and exiting from the Matic sidechain from within the Decentraland Metaverse. Since our games require users to use the Matic sidechain, this process is an essential step in our user onboarding experience. We will detail this flow in another blog post soon.
Deploying a contract to the Matic Network
The process of deploying a smart contract to Matic is very easy and straight-forward. You simply configure the Matic Testnet RPC on MetaMask, and once that is done you may use Remix, or Truffle, or any similar tool for deployment (I personally prefer the Remix editor as you simply click Deploy and you will receive a MetaMask popup to confirm the transaction). When you click the MetaMask Confirm button you’ll see just how fast Matic Network is. If you’re accustomed to waiting 30 seconds or more to deploy a contract to the Ethereum main net you’ll be pleased to find it’s almost instantaneous on the Matic sidechain.
Beta Launch in August
As we gear up for our beta launch in August, we are excited to roll out our slots games on Matic Network to start our beta testing phase. In the near future, we plan on releasing various other games using this same Matic Network architecture to deliver an optimal in-game experience while maintaining the security of distributed consensus.
Comments
Post a Comment