Giter Site home page Giter Site logo

Comments (3)

prototypik avatar prototypik commented on May 21, 2024

The provider is the RPC service running that you hook into to execute transactions on an Ethereum blockchain.

If I run testrpc in my terminal (with testrpc installed of course), its default configuration would launch an RPC enabled Ethereum node with 10 local accounts at https://127.0.0.1:8545. That is my provider. I then tell my app to create a new Web3 instance, and give it the provider: https://127.0.0.1:8545 so that it can interact with this locally running private Ethereum node. All transactions are automatically mined (because it's testrpc and is designed for fast testing). The blockchain is completely local, and completely separate from the main Ethereum network. Anything you do with this provider does not affect the actual Ethereum network.

I honestly have no idea what QtSyncProvider is, or does. Google didn't help either.

It seems like it's another option provided by Web3 for instantiating a new provider? Are you running something like testrpc by any chance? Or maybe geth?

from react-ethereum-dapp-example.

phoniks avatar phoniks commented on May 21, 2024

Okay, great - that all makes sense to me. Thanks for the explanation! I'd still be curious to know if anyone else could provide some insight on the QtSyncProvider though.

from react-ethereum-dapp-example.

leopoldjoy avatar leopoldjoy commented on May 21, 2024

@phoniks Are you using Parity locally? What line does the error reference? Did you follow all of the dev environment setup instructions?

If you would like to change the Web3 provider, please change line 8 of web3.js instead of line 15 because each page load only needs to create one Web3 instance (line 15 is for globally exporting the Web3 instance that already exists from line 8).

I am not familiar with QtSyncProvider, the only mentions of it that I can find are here in the old ethereum.js README that is three years out of date and these old web3.js issues that are also nearly three years old. It doesn't seem to be a currently supported feature.

My reference to "local" in my comment that says "instantiate new web3 local instance" is simply about the fact that the web3 variable is a local variable as opposed to a global variable (not blockchain related).

Any provider can be used to interact with a remote or local Ethereum blockchain. Line 8 is connecting to a local Ethereum blockchain and the provider is implicitly a WebsocketProvider, not an HttpProvider. Line 8 could alternatively be written as:

window.web3 = new Web3(new Web3.providers.WebsocketProvider('ws://127.0.0.1:8546'));

from react-ethereum-dapp-example.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.