Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Add formatting for future viewers
Source Link
Shane Fontaine
  • 18.3k
  • 20
  • 56
  • 83

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.

hi i'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');
            }
    });
});

when executed i want this function to open metamask and ask the client to confirm the transaction but when calling it i get this error

if (err) throw err;
                 ^

Error: Invalid JSON RPC response: ""

any help would be appreciated

I'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');
            }
    });
});

When executed i want this function to open Mtamask and ask the client to confirm the transaction but when calling it I get this error:

if (err) throw err;
                 ^

Error: Invalid JSON RPC response: ""

Any help would be appreciated.

added 16 characters in body
Source Link
Rob Hitchens
  • 55.6k
  • 11
  • 91
  • 146

hi i'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');
            }
    });
});

when executed i want this function to open metamask and ask the client to confirm the transaction but when calling it i get this error

if (err) throw err; ^

Error: Invalid JSON RPC response: ""

if (err) throw err;
                 ^

Error: Invalid JSON RPC response: ""

any help would be appreciated

hi i'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');
            }
    });
});

when executed i want this function to open metamask and ask the client to confirm the transaction but when calling it i get this error

if (err) throw err; ^

Error: Invalid JSON RPC response: ""

any help would be appreciated

hi i'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');
            }
    });
});

when executed i want this function to open metamask and ask the client to confirm the transaction but when calling it i get this error

if (err) throw err;
                 ^

Error: Invalid JSON RPC response: ""

any help would be appreciated

Bumped by Community user
Bumped by Community user
Bumped by Community user

hi i'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');
        }
});

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');
            }
    });
});

});

when executed i want this function to open metamask and ask the client to confirm the transaction but when calling it i get this error

if (err) throw err; ^

Error: Invalid JSON RPC response: ""

any help would be appreciated

hi i'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');
        }
});

});

when executed i want this function to open metamask and ask the client to confirm the transaction but when calling it i get this error

if (err) throw err; ^

Error: Invalid JSON RPC response: ""

any help would be appreciated

hi i'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');
            }
    });
});

when executed i want this function to open metamask and ask the client to confirm the transaction but when calling it i get this error

if (err) throw err; ^

Error: Invalid JSON RPC response: ""

any help would be appreciated

Source Link
Loading