2

I have a question regarding Ethereum and DAPP ..

I have a smart contract that basically store a document and I integrated it with a user interface that let the user go to the website and search for that document .. very simple idea.

the problem is and correct me if i'm wrong .. the process of storing the document to the Ethereum blockchain require a gas but the process of getting that document is gasless ..

and I think that the user need to have a wallet to use the website and search for the document .. even if the process does not require any gas

Am I right? because that what I understand

and if I am right .. is there a way where the user can enter and use the website without having to install a wallet or doing anything beside searching for the document that he need?

I'm using web3.js

and i tried this code:

var contract
var addresse = //my contract addresse;
var api = // api ;

contract = new web3.eth.Contract(api, addresse);  

but i got :

"Uncaught TypeError: web3.eth.Contract is not a constructor"

2
  • Regarding the TypeError: ethereum.stackexchange.com/questions/72689/…
    – sea212
    Feb 25, 2020 at 23:31
  • yes the problem was the web3 version is 0 .. so I replace web3.eth.Contract with web3.eth.contract and it work but now it say :Uncaught TypeError: Cannot read property 'isEntity' of undefined
    – iias121
    Feb 25, 2020 at 23:36

1 Answer 1

1

Yes, you're right, you can interact with a smart contract without having a wallet.

By connecting with a Provider, so you will only have read-only access to the Contract, without sending a transaction (Can’t alter the smart contract state).

By creating an instance of the contract:

7
  • I updated my Question .. Please chuck it out.
    – iias121
    Feb 25, 2020 at 23:18
  • Try this contract = web3.eth.contract(ABI).at(contractAddress); Btw, be careful not to confuse ABI and API, think of "ABI" as an "API" at a low level.
    – Adam Boudj
    Feb 25, 2020 at 23:24
  • it says: Uncaught ReferenceError: ABI is not defined
    – iias121
    Feb 25, 2020 at 23:43
  • you named it api
    – Adam Boudj
    Feb 25, 2020 at 23:45
  • yeah sorry about that .. now when the user try to search or read its says ` Uncaught TypeError: Cannot read property isEntity of undefined ` where isEntity is a function in my contract
    – iias121
    Feb 25, 2020 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.