Git Product home page Git Product logo

0xbitcoin-token's Introduction

0xBitcoin

Deployed on Ethereum

0xbitcoin_small

An ERC20 token that is mined using PoW through a SmartContract

  • No pre-mine
  • No ICO
  • 21,000,000 tokens total
  • Difficulty target auto-adjusts with PoW hashrate
  • Rewards decrease as more tokens are minted
  • Compatible with all services that support ERC20 tokens

How does it work?

Typically, ERC20 tokens will grant all tokens to the owner or will have an ICO and demand that large amounts of Ether be sent to the owner. Instead of granting tokens to the 'contract owner', all 0xbitcoin tokens are locked within the smart contract initially. These tokens are dispensed, 50 at a time, by calling the function 'mint' and using Proof of Work, just like mining bitcoin. Here is what that looks like:

 function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success) {

   
    uint reward_amount = getMiningReward();

    
    bytes32 digest =  keccak256(challengeNumber, msg.sender, nonce );

     
    if (digest != challenge_digest) revert();

    //the digest must be smaller than the target
    if(uint256(digest) > miningTarget) revert();
 

     uint hashFound = rewardHashesFound[digest];
     rewardHashesFound[digest] = epochCount;
     if(hashFound != 0) revert();  //prevent the same answer from awarding twice

    balances[msg.sender] = balances[msg.sender].add(reward_amount);

    tokensMinted = tokensMinted.add(reward_amount);

    //set readonly diagnostics data
    lastRewardTo = msg.sender;
    lastRewardAmount = reward_amount;
    lastRewardEthBlockNumber = block.number;
    
    //start a new round of mining with a new 'challengeNumber'
     _startNewMiningEpoch();

      Mint(msg.sender, reward_amount, epochCount, challengeNumber );

   return true;

}

As you can see, a special number called a 'nonce' has to be passed into this function in order for tokens to be dispensed. This number has to fit a special 'puzzle' similar to a sudoku puzzle, and this is called Proof of Work. To find this special number, it is necessary to run a mining program. A cpu miner exists for mining 0xbitcoin tokens and it can be downloaded here:

https://github.com/0xbitcoin/0xbitcoin-miner

Transfer ERC20 Tokens

https://0xbitcoin.org/wallet


HOW TO TEST

Deployed on Ropsten: 0x9D2Cc383E677292ed87f63586086CfF62a009010

npm install -g ethereumjs-testrpc (https://github.com/ethereumjs/testrpc) testrpc

truffle test

0xbitcoin-token's People

Contributors

ethereumdegen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.