Using web3 to call precompile contract

Viewed 73

I want to call Ecrecover precompile contract using web3. Here is what I've tried

const message = await web3.eth.accounts.sign('Hello world', privateKey);
const tx_call = await customRequest(context.web3, 'eth_call', [
    {
        from: addre,
        value: '0x00',
        gasPrice: '0x01',
        gas: '0x100000',
        to: '0x0000000000000000000000000000000000000001',
        data: {
            hash: message.messageHash,
            v: message.v,
            r: message.r,
            s: message.s,
        }
    },
]);
console.log(tx_call.result) //got undefine

I'm not sure about the data agr is correct. Can anyone help me?

0 Answers
Related