As part of a large project I am attempting using ripemd160 in solidity. Ive boiled down the issue that im having to the code below, when calling ripemd160 I get the error: Error: Returned error: VM Exception while processing transaction: Error: Digest method not supported. I have tried a variety of different bytes arrays passing in and strangely this code works when passed into etc fiddle but not in truffle and ganache. Any suggestions would be greatly appreciated!

function testRipeMD160() public returns(bytes20){
        bytes20 ripemd = ripemd160('0x00');
        return ripemd;

Software versions

Truffle v5.1.48 (core: 5.1.48) Solidity - 0.6.12 (solc-js) Node v14.5.0 Web3.js v1.2.1

Thanks in advance


1 Answer 1


From the official documentation:

When running sha256, ripemd160 or ecrecover on a private blockchain, you might encounter Out-of-Gas. This is because these functions are implemented as “precompiled contracts” and only really exist after they receive the first message (although their contract code is hardcoded). Messages to non-existing contracts are more expensive and thus the execution might run into an Out-of-Gas error. A workaround for this problem is to first send Wei (1 for example) to each of the contracts before you use them in your actual contracts. This is not an issue on the main or test net.

  • Thanks @goodvibration any idea how to send Wei to a precomplied contract I haven't been able to track down any examples for this.
    – MeanTime
    Commented Oct 14, 2020 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.