0

I've developed my own private chain for testnet using geth and CLique and i have some issues with web3.js environment. I starts my nodes using the console parameter in order to get to the Web3 console but now i discovered that some functions doesn't work. For example, i call the contract using

myContract.at("addressofminedcontract").foo

but if, following the doc i use

new web3.eth.Contract(jsonInterface[, address][, options])

it doesn't work, returning

"Contract is not a function".

Or again, if i try to call myContract.options i get an error back.The same happens for example with the web3.eth.getPastLogs(options [, callback])

Anyway, it looks like my web3 is not complete or something is missing. How can i solve that? Since geth encapsulates a console environment i thought it was enough, am i missing something?

Thanks guys

1
  • 1
    This is a problem of web3 version, not of geth or private chain
    – Ayushya
    Apr 20, 2018 at 18:07

1 Answer 1

0

Change the web3 version by running following command in the project directory:

npm install [email protected]

The latest web3 which is 1.0 has many changes. And most of the sources you find for web3 have explained according to the old version.

4
  • thank you. In which folder i have to run it? The project folder containing nodes or inside nodes folders instead (where the geth folder is) ? Apr 21, 2018 at 8:33
  • In your project folder. Where there is contracts directory. I am assuming you are using truffle to build the project. If it's otherwise, let me know.
    – Ayushya
    Apr 21, 2018 at 8:35
  • No i'm not using truffle. I deploy in the old fashion using web3deploy code plus the json interface (abi) for calling the smart cotract Apr 21, 2018 at 9:07
  • Then I guess you might be using a globally installed web3. For that you can change its version by npm install -g [email protected]
    – Ayushya
    Apr 21, 2018 at 9:28

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.