0

Our app has a javascript web client. For the purpose of this question, our client is only interested in knowing if the user has a ECR20 token, i.e. query the users token balance. To get this knowledge, the web client has to run web3? So does this mean the device running the web client has to also have a local Ethereum node with the whole blockchain data? And, as just querying the balance is not a transaction (?) requiring something to be written and does not require new block, does the whole network of nodes run the balance query?

0

For web3 to function, you need at least one functioning node. It does not have to be on your local system, though.
You could use a remote node and direct the web3 provider to the said node.
Example of free nodes is https://infura.io .
https://infura.io/docs/#introduction for more information

just use

var web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/'));
  • Thanks, that was useful. So our client connects to a remote node to do the users token balance query. The node has the balance info stored in its blockchain data. The query does not write anything (change the state). Is the query run by every Ethereum node? – Kari Ilkkala Oct 24 '17 at 20:23
  • What you are doing is basically a call. It runs on the remote node and returns the data to you, then discards the transaction. So it is not sent to the network. (Only the remote node runs it) – Adibas03 Oct 24 '17 at 20:32

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.