1

I am running proof of work function from my deployed contract in ethereum wallet by providing any random number as nonce. As per my understanding the PoW() shouldn't work on every nonce, but in my case everytime the transaction is getting executed ( PoW works for every nonce ). How am I verifying that it is working everytime - by monitoring the balance of msg.sender, difficulty and currentChallenge parameters. Please correct me if I'm wrong at any point , and suggest a solution or an explanation as to what's happening.

2

I think you are referring to this: https://www.ethereum.org/token#proof-of-work. So if it goes through every time the relevant code must be:

if (n < bytes8(difficulty)) throw;       

Have you tried to set the difficulty higher?

uint public difficulty = 10**52;                         // Difficulty 

Also you can trace the execution with log events, like log0('here')

2

I am running proof of work function from my deployed contract in ethereum wallet by providing any random number as nonce.

Please post the code for the function and, more importantly, the reason why you are defining such a function in the first place.

As per my understanding the PoW() shouldn't work on every nonce, but in my case everytime the transaction is getting executed ( PoW works for every nonce ).

Your understanding is off (at least from the content of this question). A PoW function is meant to strengthen the decentralized aspect of a block chain in that a potential attacker's success on the block chain (for example in preventing transactions from being made, double spending, etc.) is not defined by the number of peers the attacker controls but its computational power. Read up on this article for a clearer picture.

How am I verifying that it is working everytime - by monitoring the balance of msg.sender, difficulty and currentChallenge parameters. Please correct me if I'm wrong at any point , and suggest a solution or an explanation as to what's happening.

The balance has nothing to do with the PoW. The PoW is there to show that whoever made the transaction has done so uniquely and only once.

1

You're confusing two unrelated nonces.

One is used by the miner of a block for the PoW. This nonce will very rarely produce a block of sufficient difficulty and will look random, as you expect.

The nonce you are manipulating is the transaction nonce. This simply prevents the same transaction from being replayed. The value increments each time the account sends a transaction.

0

When I look to that example I cannot avoid to think that it should be:

if (n >= bytes8(difficulty)) throw;       

This way the transaction will go through ONLY if you found an hash which is less than the difficulty's hash. Am I missing something?

  • If you have another question, please ask it by clicking the Ask Question button. – Afr Jan 5 '17 at 19:01

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.