hi i'mI'm trying to create a API fo my smart contract functions like following:
router.get('/',function (req,res) { var web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/key')); var DataPassContract = web3.eth.contract(abi); var dataPass = DataPassContract.at('contract address'); dataPass.add('myaddress','a','a','a',{ from: 'other address' }, (err, result) => { if (err) throw err; if (result) { res.send('yes'); } }); });
whenWhen executed i want this function to open metamaskMtamask and ask the client to confirm the transaction but when calling it iI get this error:
if (err) throw err;
^
Error: Invalid JSON RPC response: ""
anyAny help would be appreciated.