0
/* DeomToken Contract */
contract DemoToken {
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;

/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);

/* Initializes contract with initial supply tokens to the creator of the contract */
function DemoToken(
    uint256 initialSupply,
    string tokenName,
    uint8 decimalUnits,
    string tokenSymbol
    ) {
    balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
    totalSupply = initialSupply;                        // Update total supply
    name = tokenName;                                   // Set the name for display purposes
    symbol = tokenSymbol;                               // Set the symbol for display purposes
    decimals = decimalUnits;                            // Amount of decimals for display purposes
}

/* Send coins */
function transfer(address _to, uint256 _value) {
    require (balanceOf[msg.sender] >= _value) ;          // Check if the sender has enough
    require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
    balanceOf[msg.sender] -= _value;                     // Subtract from the sender
    balanceOf[_to] += _value;                            // Add the same to the recipient
    Transfer(msg.sender, _to, _value);                   // Notify anyone listening that this transfer took place
}

// todo check balance 


function getBalance(address addr) returns(uint) {
    return balanceOf[addr];
}

function proofOfwork(){
//help me to fill it ! Thanks 




}

}

0

What do you mean "block generation rate"? The Ethereum blocks are mined outside of the smart contracts already, you don't need to worry about mining blocks. If you're just looking for a way to have the tokens generated by looking for hashes 0xbitcoin which is just tokens generated by burning electricity.

  • Thx . Sorry for the confusing word "block generation rate " . Yes ! You got me ! I just try to write a method to control the speed of token generating . – Kimmy Mar 1 '18 at 23:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.