Questions tagged [web3-providers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
16
votes
2answers
9k views

Connecting to hosted web3 provider from NodeJS backend

I'm using these instructions from etherchain. Here's a similar question(seems like duplicate, but it's not). The solution provided there doesn't work for me, because I don't have a local ethereum ...
15
votes
6answers
21k views

Better pattern to detect web3 default account when using metamask

Context: I want to use blockies to render an identicon on the page, i get the defaultAccount from web3, for this, the user has to be logged on to metamask with a selected address from his wallet. The ...
15
votes
4answers
8k views

Infura web3 provider for Events (.get & .watch)

I am using infura for connecting to testnet/mainnet as my server side web3 provider. This works for most requests and operations, but it does not seem to work for Events. const allEvents = (event, ...
6
votes
1answer
3k views

How does Truffle work without a web3 provider?

I have a question about the init project with Truffle. I can't understand how - in app.js - they use the deployed contract without a web3 provider, like this: var provider = new Web3.providers....
5
votes
2answers
2k views

Alternative to filter.watch()

Here's a scenario: Dapp backend connects to a remote Ethereum node using external HTTP RPC: const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/janNFDJkMgDfan")); Dapp ...
4
votes
2answers
1k views

building your own web3 provider

I wonder if there are any tutorials / guides out there that explain how to create your own web3 provider (like metamask), what to consider when creating one, how to handle security/privacy issues, ...
4
votes
2answers
1k views

How to connect truffle using HDWallet provider to Websocket-powered node?

I am using truffle-hdwallet-provider to connect to the node that operates over https and it works perfectly. Now I want to connect to websocket-powered node but keep my HD Wallet provider. I cannot ...
4
votes
1answer
875 views

Check if web3js is connected to node

I have a private chain with several nodes. Connecting to only one works fine. However, if this one goes down, I want to connect to one of the other node. Using web3js 1.0.0 beta 26, according to the ...
4
votes
1answer
2k views

get address of new contract from contract factory

i need to deploy a rental contract at runtime whenever user want's to start the contract. for this purpose i have acontract factory. here is the actual code for facotry pragma solidity ^0.4.8; import ...
4
votes
1answer
3k views

How to set truffle-hdwallet-provider as the Web3 currentProvider inside a web page

https://github.com/trufflesuite/truffle-hdwallet-provider/blob/master/README.md provides sample usage for the deployment configuration inside tuffle.js. I need a sample that update the Web3 ...
4
votes
0answers
368 views

How to Catch Connection Issues to Web3 Provider using Web3.js

My node.js script is able to successfully connect to the Web3 provider when both the private key (using truffle-privatekey-provider) and the provider host URL are correct. let privateKey = ..., ...
4
votes
1answer
370 views

Can I use web3js without setting the provider?

So I have two NodeJS applications, both implementing web3js. The first node is used for creating and signing transactions, then it sends raw signed transaction to the second node. Finally, the second ...
3
votes
1answer
2k views

Injecting a private key into web3.js execution context

I'm trying to achieve what seems like a simple goal but having trouble finding a simple solution to it. Here's my problem: Given a private key, I would like the simplest way to "inject" this key ...
3
votes
1answer
640 views

Unable to detect MetaMask in browser

I'm a bit of a noob in javascript and I need some help. My objective is to create a client-side javascript program that uses Metamask as web3 provider and display the output of some web3 functions on ...
3
votes
3answers
3k views

What are providers in the Ethereum?

The below given code is from the a tutorial given here at one of the tutorials on Truffle // Set the provider for our contract App.contracts.Adoption.setProvider(App.web3Provider); I see we set up a ...
3
votes
2answers
1k views

Uncaught ReferenceError: Web3 is not defined Solidity

I've been working with this project and I downloaded all dependencies and Web3 already but when I test my code it shows me this: Uncaught ReferenceError: Web3 is not defined in line 120. This is ...
3
votes
1answer
1k views

Error: cannot find module 'web 3'

When I am running npm run test (mocha), I am getting this message. Using following: npm install --save mocha ganache-cli web3@1.0.0-beta.26 Please advice. > smart@1.0.0 test C:\Smart > mocha ...
3
votes
1answer
2k views

Truffle + INFURA remote provider deployment. Migrations not running

I am running into the same issue proposed by this question. I cannot resolve it because I am using a remote provider (INFURA), per this document. My code looks like this: var ethwallet = require('...
3
votes
0answers
115 views

How does getDefaultProvider work in ethers.js?

From the docs: This creates a FallbackProvider backed by multiple backends (INFURA and Etherscan). This is the recommended method of connecting to the Ethereum network if you are not running ...
3
votes
1answer
161 views

Metamas - Infura problem. Cannot read property 'currentProvider' of undefined

I got a problem. I am using code below to connect to the eth from node.js app. Everything works perfect as long as I have installed MetaMask in my browser. I can be logged in, logged out, all good ...
3
votes
0answers
1k views

Get RPC URL / IP of Metamask's current provider

Suppose I have multiple copies of the same dapp running on different servers which do not directly communicate with each other, for testing purposes, and can manually interact with different dapp ...
3
votes
0answers
96 views

Invalid JSON RPC response on IOS build with Infura

I am developing a mobile DAPP using ionic frame work, everything was fine when I testing on the browser. However I try to build my app on IOS, and run it on my Iphone7, the web3 doesn't work(did't ...
3
votes
1answer
2k views

Cannot use 'new' with an expression whose type lacks a call or construct signature

A issue in the this.web3 = new Web3(window.web3.currentProvider);the web3.js has output and I type to the code of console.log(window.web3.currentProvider)that window.web3.currentProvider is defined. ...
2
votes
2answers
940 views

How to connect with public Ethereum Blockchain on a backend/web server?

In the backend of a Web application I have to communicate with the public Ethereum Blockchain. On local development machine, I run ganache as testrpc and connect with such a line of code: web3 = new ...
2
votes
1answer
2k views

possible reason for insufficient funds for gas * price + value

I have been researching this whole day, but I have a web3 instance, (the Web3 is version 1.0.0) const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/<myKey>')); ...
2
votes
2answers
861 views

Getting data from contract to the DApp without provider

I have a DApp that uses metamask or mist as a provider. The DApp can read some info from the contract and show it on page using mist or metamask. Is it possible to read contract and show information ...
2
votes
1answer
318 views

How to configure truffle network with IPC provider?

How can I define in truffle the ipc connection to the node? Currently I am using in truffle.js host/port fields, which are used to create a HttpProvider. module.exports = { networks: { dev: { ...
2
votes
1answer
142 views

How can I increase EVM time in web3.py?

When working with web3.js, Truffle and Ganache, I can do this: web3.currentProvider.send({method: "evm_increaseTime", params: [numOfSeconds]}); How can I do the equivalent in web3.py? When I do: ...
2
votes
1answer
4k views

What are the web3 httpProvider options?

I'm not sure I fully understand how web3 interacts with the ethereum blockchain. When testing things out, I just use web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); And ...
2
votes
2answers
85 views

How do you normalize client-side web3 libraries?

In my web front-end, I need the ability to interact with the Ethereum blockchain. It's possible a user has MetaMask installed. It's possible a user is using the web without MetaMask installed. It's ...
2
votes
3answers
849 views

Remix is not connecting to my private network

I have initialized the genesis file then run that command in the console- geth --rpc --rpcaddr 0.0.0.0 --rpcport 8549 --rpccorsdomain "*" --rpcvhosts "*" --rpcapi "network,admin,personal" --...
2
votes
1answer
90 views

Is there dumpprivkey analogue in geth?

I'm creating new address with web3.py with this code: from web3 import Web3 w3 = Web3(Web3.HTTPProvider('http://localhost:8545')) w3.personal.newAccount('the-passphrase') And have few questions: ...
2
votes
2answers
632 views

Ethereum client supporting websocket for development

Is there any ethereum client for development and testing that supports websocket connection. I want to use the subscribe API in web3. testrpc does not support socket connection.
2
votes
1answer
808 views

recommended datatype for “data” in ethereum transaction

I am sending data with my transaction by using following way var tx = {from: eth.coinbase, to:eth.accounts[1], value: web3.toWei(1, "ether"),data:web3.toHex("Test Data")} personal.sendTransaction(tx,...
2
votes
1answer
941 views

socket.timeout timed out when connecting to a remote server with web3.py

I use Web3 to connect to my remote server. 10.xxx.xxx.xxxis ip address of a remote server. First I start the server with this command : parity --chain frontier.json --rpcapi="eth,net,web3,personal,...
2
votes
1answer
209 views

When do you use ganache-cli and when do you use ganache-core?

I have seen two usages over the internet 1. const ganache = require("ganache-cli"); web3.setProvider(ganache.provider()); 2. const ganache = require("ganache-core"); web3.setProvider(ganache....
2
votes
1answer
68 views

Check if the web3 provider supports certain rpc call

For example, when I am using: web3.currentProvider.sendAsync({ method: "eth_signTypedData_v3", params: [customerAddress, data], from: customerAddress, ...
2
votes
1answer
888 views

Transfer ERC20 token using Web3 and angular

I'm trying to make a simple token transfer app using Web3.js and Angular all i want is to transfer some tokens from an address A to an address B. So, I made two functions in an angular service , the ...
2
votes
0answers
640 views

How to fix a web3.py HTTPConnectionPool read timeout error

I have a web3.py program running and everything was seemingly working. I was connecting to my local server via the automatic connection offered in web3.py. I am now getting the following error: ...
2
votes
1answer
237 views

Reliable way of listening to events on frontend

I make a web application, that needs the events from my contract to initialize it's state. I was using infura websocket provider, but it seems to lag a lot and close the connections unexpectedly ...
2
votes
0answers
383 views

How to sign transactions using metamask while developing in nodejs?

I am developing an application in nodejs. I need to interact with my smart contract and also want to sign the transaction using metamask as I don't want to manage they keys. I copied the following ...
2
votes
1answer
309 views

subscription not happen on geth+websocketProvider in web3

I have started geth node (connect to ropsten testnet) on my local OSX system. Command: geth --testnet --fast --bootnodes "enode://...
2
votes
2answers
4k views

Error: Max retries exceeded with url appear when using web3.py

Here is my code: from web3 import Web3, HTTPProvider, IPCProvider web3 = Web3(HTTPProvider('http://localhost:8545')) print(web3.eth.blockNumber) Below is the error: requests.exceptions....
2
votes
0answers
642 views

web3 1.0.0-beta example for etherscan websocket?

Does anyone have a working JS example for wss://socket.etherscan.io/wshandler? Or any alternative websocket providers, besides Infura? The reason I'm looking for Infura alternatives is it fails for ...
2
votes
1answer
487 views

Providing Metamask hooks only using node hosted on server

I am currently looking into hosting an Ethereum node on my web server in order to allow my users to interact with my dApps without needing Metamask (although it could be used). How could I have the ...
2
votes
2answers
380 views

How to connect these **Remix - kovan - parity**?

I have been trying to connect deploy a smart contract from remix onto kovan chain via parity but kept on showing even after trying with all the rpc flags. if possible please throughly explain the ...
2
votes
1answer
292 views

Can we call two contracts in web3.eth.filter method?

I have two contract address and I want to check events on both in one call. I mean, can we pass two contract address in one option param like i do below? let web3 = new Web3(); web3.setProvider(...
2
votes
0answers
301 views

TypeError: filterCreationErrorCallback is not a function

trying to deploy contract to Ropsten network-
2
votes
0answers
351 views

Different uPort provider

I'm trying to integrate uPort in one of my project and, the first thing that I noticed are the different ways to give a provider: from the official repository uPort-lib let web3 = uport.getWeb3() ...
1
vote
3answers
1k views

web3.eth.personal : “Method not found”

When I invoke a method of web3.eth.personal I receive an error as follows: > web3.eth.personal.getAccounts().then(console.log); Promise { <pending>, domain: Domain { domain: ...