I tested my first contract and wanted to verify the contract on etherscan:


For some reason I can not verify the code.

I just made a really simple contract. I copied the ERC20 functions and made one fallback and one sucide function. I use the safemath lib. More or less just copied the code and tried some own lines.

In short the code is:

  1. lib safe math functions
  2. constructor with no arguments
  3. erc20 functions
  4. fallback function
  5. suicide function

that's all.

I combined the code and made a flat file with orcale-combine.solidity. To make sure I don't mess it up with the compiler I copied the flat code into REMIX and deployed it.

But it always tells me:

Sorry! The Compiled Contract ByteCode for 'SpeculativeMania' does NOT match the Contract Creation Code for [0xc73adf8d3ee480e483f45c9c84ee88269407e95d].

Contract name(s) found: 'SPECMN' , 'SafeMath' Unable to Verify Contract at this point time.

Just for detailed info. This is the contract source code:

pragma solidity ^0.4.17;
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
library SafeMath {
  function mul(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  function div(uint256 a, uint256 b) internal constant returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  function sub(uint256 a, uint256 b) internal constant returns (uint256) {
    assert(b <= a);
    return a - b;
  function add(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
contract SPECMN {

    using SafeMath for uint256;

    string public constant name     = "Speculative Mania";
    string public constant symbol   = "SPCMN";
    uint8  public constant decimals = 18;
    uint256 public rate = 10;
    // todo
    uint256 public constant _totalSupply = 1000000;
    uint256 public      _totalSupplyLeft = 1000000;
    uint256 tokens                       = 0;
    // vars
    mapping(address => uint256) balances; 
    mapping(address => mapping(address => uint256)) allowedToSpend;
    address public contract_owner;
    uint256 currentBlock = 0;
    uint256 lastblock    = 0;
    // init function
    function SPECMN(){
        currentBlock = block.number;
        lastblock    = block.number;
    // ## ERC20 standards ##

    // Get the total token supply
    function totalSupply() constant returns (uint256 thetotalSupply){
        return _totalSupply;
    // Get the account balance of another account with address _queryaddress
    function balanceOf(address _queryaddress) constant returns (uint256 balance){
        return balances[_queryaddress];

    // Send _value amount of tokens to address _to
    function transfer(address _to, uint256 _value) returns (bool success){
            balances[msg.sender] >= _value
            && _value > 0);
        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to]        = balances[_to].add(_value);
        Transfer(msg.sender, _to,_value);
        return true;
    // Send _value amount of tokens from address _from to address _to
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success){
            allowedToSpend[_from][msg.sender] >= _value
            && balances[_from] >= _value
            && _value > 0);
        balances[_from] = balances[_from].sub(_value);
        balances[_to]   = balances[_to].add(_value);
        allowedToSpend[_from][msg.sender] = allowedToSpend[_from][msg.sender].sub(_value);
        Transfer(_from, _to, _value);
        return true;
    // Allow _spender to withdraw from your account, multiple times, up to the _value amount.
    // If this function is called again it overwrites the current allowance with _value.
    // this function is required for some DEX functionality
    function approve(address _spender, uint256 _value) returns (bool success){
        allowedToSpend[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    // Returns the amount which _spender is still allowed to withdraw from _owner
    function allowance(address _owner, address _spender) constant returns (uint256 remaining){
        return allowedToSpend[_owner][_spender];
    // Triggered when tokens are transferred.
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    // Triggered whenever approve(address _spender, uint256 _value) is called.
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);

    // ## ERC20 standards end ##
    // ## Custom functions ###
    function() payable {
        require(msg.value > 0);
        tokens       = msg.value.mul(rate);
        currentBlock = block.number;
        if(rate > 1 && currentBlock.sub(lastblock) > 3000){
            rate = rate.sub(1);
            lastblock        = currentBlock;
        balances[msg.sender] = balances[msg.sender].add(tokens);
        _totalSupplyLeft     = _totalSupplyLeft.sub(tokens);

    function shutThatShitDown() public {
        require(msg.sender == contract_owner);

    event RateChange(uint256 _rate);
    event MoneyTransfered(address indexed _owner, uint256 _msgvalue);


I'm quite sure I am messing something up with the library

  • The way you're adding the library looks OK, aren't you supposed to put the name of the contract you're deploying? Your contract is called SPECMN, but it looks like you're telling it you want to deploy a contract called SpeculativeMania – Edmund Edgar Oct 12 '17 at 2:30
  • Well, I tried various options like: Speculative Mania, SpeculativeMania, SPCMN. Didn't succeed :/ – kn1g Oct 12 '17 at 13:44
  • Right now I think I somehow need to fill in a corresponding lib address. But where do I get this address? – kn1g Oct 12 '17 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.