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
4answers
7k 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, ...
11
votes
6answers
18k 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 ...
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
1answer
575 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

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
1answer
266 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
439 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
2k 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
939 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 ...
3
votes
2answers
987 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
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
74 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
942 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, ...
2
votes
2answers
473 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
1k 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
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 ...
2
votes
1answer
1k 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 ...
2
votes
2answers
797 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
195 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
2k 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
1answer
48 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
1answer
723 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
857 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
67 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
39 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
706 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
1answer
43 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 ...
2
votes
0answers
252 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 = ..., ...
2
votes
1answer
187 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
183 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
263 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
3k 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
609 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
2answers
545 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
442 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
334 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
264 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
291 views

TypeError: filterCreationErrorCallback is not a function

trying to deploy contract to Ropsten network-
2
votes
0answers
336 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
2answers
591 views

How to expose the underlying web socket connection from the WebSocketProvider?

Using web3.js version 1(beta) and using the WebsocketProvider to make a connection via const Web3 = require('web3') const web3 = new Web3('ws://localhost:8546') const provider = web3.providers....
1
vote
1answer
80 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: ...
1
vote
1answer
213 views

How to integrate rinkeby test network with centralised server?

I am new to ethereum blockchain. I want to create ICO platform based website. I have created smart contract and deployed on rinkeby test network. I used python web3.py library to integrate python with ...
1
vote
2answers
1k views

TypeError: Cannot set property 'method' of undefined when using WebsocketProvider

I'm using: web3 v0.20.6 web3-providers-ws v1.0.0-beta.34 First question - can web3-providers-ws be used with web3 v0.20.*? Second question (problem) - I get an error when probably trying to send ...
1
vote
1answer
79 views

GUI does not work for contract

I developed an contract as follows and I got "certificate of guarantee". It means that it works well. Now I want to design a web application as UI to interact with smart contract. I did it with HTML ...
1
vote
2answers
290 views

Unable to work with web3.js on geth

This is my code: function send() { Web3.providers.HttpProvider.prototype.sendAsync = Web3.providers.HttpProvider.prototype.send; var web3 = new Web3("http://localhost:8545"); var data =...
1
vote
1answer
476 views

How to interact with a network without a wallet installed?

I'm making a Dapp for users who don't have a wallet installed and have no ETH address. I would like users to use my account for all transactions. I'd like to sign my transactions with the contract ...
1
vote
1answer
64 views

web3.isConnected returns False web3.py

Here is the code I have: from web3 import Web3 infura_url = 'https://infura.io/project/MyProjectID' web3 = Web3(Web3.HTTPProvider(infura_url)) print(web3.isConnected()) The problem is that it ...