-2

I am using web3.py and ganache to tranfer Ether between two account. In the tutorial that I'm learning from a part of code is like below:

nonce=wb3.eth.get_transaction_count(account_1)
tx={
    'nonce':nonce  ,
    'to':account_2,
    'value':wb3.to_wei(1, 'ether'),
    'gas':2000000,
    'gasPrice':wb3.to_wei('50', 'gwei')
    
    }

I understand that in block chain nonce should be a unique number to create a random hash. But in the code above, I can just use exact transaction count (for example 3) for nonce variable. Could anyone explain it to me please?

i tried some other numbers and it will be cause an error.

TylerH
  • 20,799
  • 66
  • 75
  • 101

0 Answers0