0

i'm trying to do abit of testing with testrpc and noticed that when I deploy my contract the block number in the testrpc is pretty random, I tried to do it 3 times and I get either the value of 2 or 13. I assumed that the block number should be at 1 since it's the first transaction which is the deployment of contract. In addition, when I do transactions with my contract sometimes the block number skips numbers too.

Is this really how it should be or is there something wrong that I am doing?

1

TestRPC - now rebranded to Ganache - by default will create a new block each transaction.

If you are deploying the contracts via Truffle then it's possible that some of those 13 transactions are from it deploying its Migrations contract and interacting with that - as part of its deployment process.

Both Truffle and Ganache give you a way to ways to inspect the contents of your test Ethereum blockchain - and the transactions that were included in each block e.g. by using truffle console or Ganache's "Built-in blockchain explorer" you should be able to look into the internals of what is happening a bit more.

I would suggest using some of the development tools to look into the types of transactions as a way of understanding the root cause

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.