ParaState is a Polkadot parachain that extends the frontier of Ethereum with Substrate framework. Providing Dapps L1 security without sacrificing composability.
Let’s write a contract for a quick and easy lottery and deploy it on a ParaState test network
Tools
- Metamask (instraction)
- Web IDE: http://buidl.secondstate.io/parastate
Contact
- Import Your address from Metamask
2. Write Your contract
pragma solidity >=0.4.0 <0.6.0;contract FastLottery { address public owner; constructor() public { owner = msg.sender; } function play() public payable { require(msg.value > 0.001 ether); } function random() private view returns(uint){ return uint(keccak256(abi.encodePacked(msg.sender, now))); } function checkVictory(uint userNumber) public view returns (string) { uint _random = random(); if (_random == userNumber) { return ‘You win!’; } return ‘You loose!’; }}
3. Compile
If you have no errors go to the last step
4. Deploy
Now you can try our contract in action. Enter any number and check the result in the LOG
Now you know how to create your contract in the ParaState network and you can create your contract.
Good luck!
Links
- Website — https://www.parastate.io
- Twitter — https://twitter.com/parastate
- Telegram — https://t.me/parastateofficial
- Discord — https://discord.gg/DgKNeJFBXA
- Medium — https://medium.com/ethereum-on-steroids
- Github — https://github.com/ParaState