Solidity + Truffle — Not found at Block 50 error solution !

Nicolas Cloutier
2 min readSep 26, 2017

--

If you ever experienced deploying a little bit more complicated than usual smart contrat on the Ethereum mainnet recently, chances are you did encounter that bug.

Well at Kryptopy we did. Here is how we got that error and the main symptoms of it :

1- Contract code does pass all tests in truffle (write as much tests as you can think about even if it takes longer! it is a life saver)
2- Deployment on TestRPC = A1, perfect no error whatsoever
3- Deployment with Geth on Testnet = A1, perfect also
4- Deployment with Geth on Mainnet = Migrations contract hangs, then dies with the : Contract not found at Block 50 error. Need to say about 1 hour of patiently waiting to get that error, and Nothing on etherscan with the txid.

Wow! What the hell happened ? It was working everywhere why isn’t it working on mainnet ?

After countless hours of debugging, hundreds of google search, posting on communities forums and chats (gitter, slack) there was no answer. Nobody seems to know how to fix that.

To find the solution we did use Parity and the included Dapp that shows you what is been deployed and if it is or not. Very useful for debugging as you can see other contracts on the network too.

Soooo… what did we found ? That truffle is never sending the right amount of gas to the Network. We did follow truffle documentation to the letter like probably most of you did. Unfortunately that documentation has some flaws and is not very up-to-date with the latest truffle and its bugs.

The problem seems very complicated at first (we were 3 senior developers searching WHY!). However the solution is quite simple.

Modify your truffle.js or equivalent file and add the following to your network :

(… usual network stuff here),
gas: 4712388,
gasPrice: 25000000000

See all those zeros ? We are all used to put something like 21000 in there… well that doesn’t work ;) The minimum gas price at the time of this writting is around 24 shannon. So if you put 21000 you dont even get 1 shannon. And that is why the error comes and times out. Your transaction is never picked up by the EVM because your gas was too low ! That simple !

Hope this did help you and feel free to share if it did so other people who did encounter the same problem can sort it out finally !

If you found this fix useful any donations are welcome ;) Did cost me $200 and a night of sleep to come up with that ! Cheers !

You can send me a tip at this eth address: 0xCc2fE68fc20627830ca8527BAFcbCE005E8Aae92

--

--

Nicolas Cloutier

Kerberos Blockchain inventor, Solidity developer, Blockchain passionate, Start-up advisor & CEO of Kryptopy Inc. A 3rd generation decentralized social network.