I have a master contract which deploys instances of other contracts.

pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;

contract DataEntityContract {

    DataEntity DE;

    constructor(string memory _name,string[] memory _relatedEntities, string memory _date, string memory _fileName, string memory _annotations) public
        DE = DataEntity(_name, 'URN', _fileName, new string[](0), _relatedEntities, 'references', _annotations, msg.sender, _date);

    struct DataEntity {
        //Event notifications;
        string dataEntityName;
        string rawFileURN;
        string fileName;
        string[] nameChangeHistory;
        string[] sources;
        string references;
        string annotations;
        address createdUpdateBy;
        string when;

    function editDE() public {
        DE.annotations = "edited";

    function getAnnotations() public view returns(string memory) {
        return (DE.annotations);


contract FlattenedDEC
    address owner;
    string public name;
    mapping (string => address) dataEntities;
    string[] public dataEntityNames;
    uint count = 0;
    uint public DataEntitiesCount = 0;
    mapping(uint => Lineage) public lineageInfo;
    mapping(uint => DE) public DataEntities;

    event DataEntityEdited(
        string name,
        string comments,
        address editedBy

    constructor() public
        name = "DataEntityCatalogue Master Contract";
        owner = msg.sender;

    function createNewDataEntity(string memory _name, string[] memory _dataEntities, string memory _date, string memory _fileName, string memory _annotations) public returns(address _new){
        DataEntityContract instance = new DataEntityContract(_name,_dataEntities, _date, _fileName, _annotations);
        return address(instance);

    function editDE(string memory _name) public{
        DataEntityContract de = DataEntityContract(dataEntities[_name]);
        emit DataEntityEdited(_name, "edited", msg.sender);

Now, when I try to call the editDE method in FlattenedDEC or even in DataEntityContract from my dapp I am gettting a jsonrpc error but when I call the same from remix everything works fine.

Here is my react js code:

async editDataEntity(name){
    const web3 = window.web3;
    const networkId = await web3.eth.net.getId();
    const networkData = await FlattenedDEC.networks[networkId];
    const contract = web3.eth.Contract(FlattenedDEC.abi, networkData.address);
    contract.methods.editDE().send({from: this.state.account})
    .on('error',(error) => {
      console.log("error: ", error);
    .on('transactionHash', () => {

This is the error i get:

MetaMask - RPC Error: Error: [ethjs-rpc] rpc error with payload 
  • What error do you get ? – Florian Castelain Feb 21 '20 at 7:45
  • MetaMask - RPC Error: Error: [ethjs-rpc] rpc error with payload {"id":6402969023659,"jsonrpc":"2.0","params":["0xf9010e8203dc85746a528800836170d494ca9a565e46004c9e5f9b2ac2b4ca83d61814c20180b8a4108770750000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064544495445440000000000000000000000000000000000000000000000000000822d45a0186aa938713cc78dfe0089d896b0890ffa693ad77fe521d4d3e5e454d2fbe600a045413f6b3d94d1df175ba42e7790e999fe3a97a44c91451632abb02789e10612"],"method":"eth_sendRawTransaction"} – vteja711 Feb 21 '20 at 12:19
  • @vteja711 Please edit your question and add the error message there so it can get formatted properly. Are you testing against a ganache, a private testnet or a public testnet? – Ismael Feb 21 '20 at 15:40
  • Edited with the error – vteja711 Feb 22 '20 at 14:06


Turns out that whenever this error occurs it is because we are sending the contract some wierd data. So in my case I was not sending proper parameters and was sending an empty name. This took a lot of deugging to come to this conclusion. This actually solved a couple more problems for me.

So, information is that whenever someone gets this error, please check the values that are being passed to the contract methods.

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.