5

If I want to issue a token on Ethereum, but have that token function according to its own proof of work algorithm (for example, double SHA256 like Bitcoin), is it possible to do that? And if so how could I implement it?

6

A token on Ethereum is basically a balance in an Ethereum contract. A contract could be programmed to issue tokens when it receives its own proof of work. (double sha256 is readily available, since the Ethereum Virtual Machine has a precompiled contract for sha256).

Here's a starter example of a "token" contract.

Note that even though the constructor assigns the contract a total supply, only the contract can issue the tokens. The contract can be examined to see when it does actually issue the tokens. In the current example, anyone may request tokens from the contract by calling transfer. Instead, the code in transfer could be replaced by issue like:

function issue(bytes _proofOfWorkNonce, address _to) returns (bool success) {
  // combine _proofOfWorkNonce with other data stored in the contract
  // do other checks as desired
  if (sha256(sha256(_proofOfWorkNonce)) < target) {
    balances[msg.sender] -= 25;
    balances[_to] += 25;
    // more logic to update contract state...   
    return true;
  }
  return false;
}

Above is an idea. target is one of the other data stored in the contract. (Bit flipping, which may be required as in Bitcoin, is not done.)

  • what is the reason behind implementing an own POW? – delete May 1 '18 at 9:27
  • @delete I think that should be a separate question. – eth May 3 '18 at 7:36
3

Yes it is possible. All you need is to create a contract that will verify a Proof-of-Work each time tx to this contract is made. The most closest case is already implemented in BTCrelay

1

Are you trying to fairly distribute your sub-currency? You could always give it to people who mine your blocks, then require that it is claimed in a certain amount of time (say a week) that way you're not holding onto infinitely long promises.

If you did it like this, you can get "proof of work for free" without requiring any more work to be done.

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.