Post
Topic
Board Tokens (Altcoins)
Re: 🌟 [ANN][AIRDROP] Genesis Coin UPDATE | Fast. Secure. Flexible | FREE Airdrop 🌟
by
URCRYPTOKNIGHT
on 29/10/2017, 23:01:43 UTC
Joined your telegram group and retweeted/followed on twitter. Really interesting idea with the coin, I like that transactions will be sent and confirmed within 15 seconds, one question (may be a noob question) what exactly is the SafeMath code and how does it prevent overflows? Looking forward to the project, thanks in advance dev's

Hello,

Thanks for your question Smiley

I'll try to give an answer as simply as I can.

Basically an overflow occurs when a value is attempted to be created that is outside either the maximum or minimum specified value. Token contracts including Genesis use the uint256 type to store values such as account balances, transfer amounts etc. Of course, you wouldn't want a value created outside of the specified values and if it does happen, it can really screw up the program/app/contract etc that you're using, making is less secure and unreliable. Not good.

The SafeMath code, thanks to OpenZeppelin, is used in a lot of contracts to prevent overflows from occurring. It does that as it basically checks each operation to make sure that the value isn't outside of the specified value in the contract. If it does, it stops the execution by throwing it meaning that nothing will be executed on the contract and therefore nothing happens. Without it, there's a chance that it doesn't throw and that's when it can cause problems.

Here is the code from Zeppelin if you wanted it Smiley https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol


Thank you for that explaination, now we noobs understand it a little more better. hopefully we can be a part of that 16.000.000 token supply.