Questions tagged [web3js]

Javascript API and library for Ethereum To develop applications on Ethereum, you can use the web3 object provided by the web3.js library. Under the hood it communicates to a local node through RPC calls. web3.js works with any Ethereum node, which exposes an RPC layer. https://github.com/ethereum/wiki/wiki/JavaScript-API

1,138 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
9
votes
1answer
1k views

web3 websocket connection prevents node process from exiting

I have a node js process that creates a web3 websocket connection, like so: web3 = new Web3('ws://localhost:7545') When the process completes, it does not exit, but rather hangs forever with no ...
8
votes
1answer
1k views

Adding Wallet using web3.eth.accounts.wallet.add

On web3 0.20.1, I am using Infura to deploy a contract to Rinkeby. This probably requires me to add a wallet to web3.accounts to provide the gas needed. When I ran the following nodejs code, Web3 = ...
8
votes
1answer
395 views

getting started with geth and ENS commands: Error: invalid address

I'm starting from square zero, sorry. I'm just trying to get a javascript console up and running so that I can learn more about ENS: http://docs.ens.domains/en/latest/userguide.html#resolving I've ...
6
votes
1answer
710 views

Problem with start() in web3-provider-engine

While trying to connect to a provider(infura) I get the above error below is the full stack trace: bundle.js:54318 Uncaught TypeError: this.provider.sendAsync is not a function at Web3Subprovider....
5
votes
2answers
556 views

How to exchange ETH to DAI with web3 and node.js

I looking for solution how to convert eth to dai with web3 api. something like https://kyber.network/swap/eth_knc (I can send eth to specyfic contract adress and I receive back DAI to the same ...
5
votes
1answer
796 views

Call write function, which doesn't change contract value

I'm new in smart contracts and faced with one problem. After deploying contract to my test local blockchain network, i try to set new value via setter, after that I call get method of contract and it ...
5
votes
2answers
378 views

How to access dynamic list from web3?

In my application players can create and join games. I store every game in a mapping(uint => Game), and send out a GameCreated event whenever a game is created. My issue is efficiently getting a list ...
5
votes
0answers
3k views

Use of web3.js batch requests

The web3.js API allows for synchronous RPC batch requests with the example given as: var batch = web3.createBatch(); batch.add(web3.eth.getBalance.request( '...
5
votes
1answer
229 views

web3.eth.compile.solidity(source) throws me Invalid JSON RPC response

I am relatively new to Blockchains and when I execute the following command I am getting an error. contract mortal { address owner; function mortal() { owner = msg.sender; } ...
4
votes
1answer
199 views

Can't debug transactions that fail during the Web3.js estimateGas() call? No Tx Hash

NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station. There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js ...
4
votes
0answers
306 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
0answers
439 views

web3.eth.getBlock returns null

I have a very similar problem as https://github.com/paritytech/parity-ethereum/issues/8788 When I use web3.eth.getBlock for the first 1 million and latest 50,000 blocks (approximately), I get the ...
4
votes
1answer
214 views

DEVp2p Wire Protocol tutorial on geth or Web3.js/Web3.py

I was looking to develop an application using ÐΞVp2p Wire Protocol and I'm having trouble finding an example or tutorial. I was able to find only ÐΞVp2p Wire Protocol's wiki. [Q] Does anybody has a ...
4
votes
0answers
532 views

How can I retrieve transaction hashes using web3 batch requests?

When I send a transaction using Truffle's contract wrappers - or using plain web3 sendTransaction() - I get a tx hash back that I can use to confirm the tx has completed. While using batch requests (...
4
votes
3answers
2k views

Correctly deploying contracts with web3 1.0 and testrpc (invalid opcode error)

I followed the following tutorial: https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2 Now this tutorial is not using the recent version of web3 but ...
4
votes
0answers
226 views

how to get revert at the previous timestamp of evm in testrpc

I am testing my contracts so at some point i need to increase the timestamp of evm that i achieve through evm_timeIncrease but now i want to execute some functions on the basis of current timestamp ...
4
votes
2answers
673 views

Importing a contract from another contract in NodeJS app

I'm using a function in my NodeJS app to deploy contracts. The user inputs the contract he wishes to deploy and the app deploys it. The structure of the app is . ├── app │   ├── models │   │   └── ...
4
votes
0answers
302 views

Contract execution fails with Web3 but works with Remix

I am dealing with a very simple smart contract: contract MyRegistry { struct MyEvent { string date; // yyyy/mm/dd string desc; // potentially long string uint count; // &...
4
votes
0answers
389 views

How to create my own wallet and own blockchain explorer?

I'm running my own private/permissioned ethereum blockchain via geth on Ubuntu. How can i interact with my blockchain to visualize accounts, blocks, transactions etc...? I've tried a lot of tutorials ...
3
votes
2answers
55 views

Auction contract problem regarding highest bid display

I have an Auction contract which has a function like this: function bid() payable{ //calculate and store highest bid value } But because each transaction takes time to mine, so when a user bids ...
3
votes
0answers
84 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
0answers
253 views

Why can't I fetch my Metamask account address with Next.js's getInitialProps?

I'm using Next.js to implement server-side rendering in my Ethereum app, however I can't fetch my Metamask address to display it in the top-right corner of the navigation bar in my index.js file. ...
3
votes
0answers
163 views

Truffle test of two transactions during the same block

I'm trying to test a solidity function that only allows it to be called once per block. E.g. (my desired functionality): Tx1 calls Fn during block #100, and when successful sets a boolean flag for ...
3
votes
0answers
192 views

How to access txpool pending transactions using Netherum?

I want to get list of transactions which are in pending state & queued state in txpool. I can see these transactions in pool using txpool.inspect command. I tried code given in nethereum sample ...
3
votes
1answer
146 views

Web3JS incorrect return value

When I return a string array with web3 I don't get the original array as expected, but rather I get an array of the same size, with the index off by one. So instead of ["One","Two","Three"] I get ["",...
3
votes
0answers
122 views

Quorum :- metamask do not support privateFor feature of quorum

i got to know that metamask do not support privateFor because of which private transaction for quorum dapp was not behaving as expected. so, I can't use metamask for my quorum DApp to switch port and ...
3
votes
1answer
1k views

Error: Returned error: invalid sender

I'm trying to sign transaction and send it to remote node, but I keep getting this error: UnhandledPromiseRejectionWarning: Error: Returned error: invalid sender This is how I perform signing and ...
3
votes
0answers
778 views

NetworkError when attempting to fetch resource. Resource URL: moz-extension://2…/contentscript.js Source Map URL: ../sourcemaps/contentscript.js.map

I get the following error message in Firefox Developer Tools Console following a successful sendTransaction: "Source map error: TypeError: NetworkError when attempting to fetch resource. ...
3
votes
1answer
234 views

Create Accounts Using Web3.js in Browser

TL;DR - Replicated Ethereum Blockchain. Running Local Node. Connecting Local Node to Web3.js in browser using RPC. Want to create addresses & send transactions Details - I have a blockchain that ...
3
votes
0answers
89 views

Retrieve MetaMask version in web3.js

Is there a way to determine the version of the currently installed MetaMask extension from web3.js? I can't find it by inspecting the Web3 instance.
3
votes
0answers
1k views

Mining hangs on Generating DAG in progress

I am trying to initialize rpc using the below command and start miner using miner.start(1); geth --rpcapi eth,web3,personal --rpc --networkid=15 Mining starts successfully with below logs but it ...
3
votes
1answer
628 views

Recover address from signature using web3j

I have signed a data string using the following code snippet in web3js var data = "hello world"; web3.personal.sign(web3.fromUtf8(data), web3.eth.accounts[0], function(error, result) { if (!...
3
votes
0answers
262 views

Error:new bignumber() not a base 16 number

I have built a private chain with two node on two computer. The smart contract was successfully deployed on node1,and i can call the method on node1 ,but when i call the same method on node2,it occur ...
3
votes
1answer
707 views

ERC223 Token Fallback Function Usage

I'm currently writing the "Trade" smart contract which is similar to "Crowdsale" smart contract. The only function that I want to add is "sell" function. In general Crowdsale smart contract is used ...
3
votes
1answer
686 views

Ropsten infura test network + web3 js event listener

I have deployed contracts on ropsten test network. truffle.js ropsten: { provider: function() { return new HDWalletProvider(mnemonic, "https://ropsten.infura.io/<api-token>") }, ...
3
votes
2answers
1k views

Invalid address error

I keep getting Error: Invalid address when trying to run the application. My current setup of web3 using infura node is if (typeof web3 !== 'undefined') { web3 = new Web3(web3.currentProvider); } ...
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. ...
3
votes
0answers
815 views

contract.method.getData getData is undefined

When I use contract.method.getData(params) it throws an error getData is undefined. I searched on github and saw someone used request instead, and I used contract.method.request and it has successed! ...
3
votes
0answers
2k views

How to send transaction with web3.eth.sendTransaction?

I am sending ether by using web3.eth.sendTransaction. But when I send, there is error: Failed to check for transaction receipt: web3.eth.sendTransaction({ from: base_address, to: withdrawer, ...
3
votes
0answers
176 views

Geth - Events not working/firing

I have an API (expressjs - nodejs) listening for different events from my contract. var web3 = new Web3(new Web3.providers.WebsocketProvider("ws://localhost:8546")); var tokenContract = new web3.eth....
3
votes
0answers
81 views

SQL syntax error near `logsBloom` when call web3.eth.sendTransaction

When I am trying to call web3.eth.sendTransaction I receive this error stack: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ...
3
votes
0answers
549 views

web3.eth.getBalance(address) throws an error: Invalid JSON RPC response: “”

var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); web3.eth.getBalance(address) throws an error: Invalid JSON RPC response: "" while address is some existing valid ...
3
votes
0answers
45 views

What are the requirements for contributing a pull request to the Ethereum web3.js repository?

I would like to make a pull request to the web3.js repository (https://github.com/ethereum/web3.js). Are there any requirements, guidelines, etc. I haven't been able to find any information regarding ...
3
votes
0answers
75 views

How to do a disaster recovery in private chains?

How can I do a disaster recovery on a private chain running ethereum, say for instance Quorum ?
3
votes
0answers
481 views

Remote Web3 connection to Parity node running on AWS

I have an Amazon EC2 instance set up running a Parity node. I'm trying to communicate with it via Web3 (using Nethereum.Web3 in C#). If I connect locally with http://127.0.0.1:8545, everything works ...
3
votes
1answer
889 views

SendSignedTransaction web3 v1.0 method call stack underflow

When calling sendSignedTransaction I got: VM Exception while processing transaction: stack underflow Used code is below, using TESTRPC: const serializeTx = async (contractInstance, publicKey, ...
3
votes
0answers
54 views

What RPC APIs are safe to expose?

What RPC APIs are safe to expose (make public, so accessible by anyone), and what are the unsafe ones, and why? I've read: are there "public" ethereum nodes? or any recommendations on ...
3
votes
1answer
501 views

Cannot make subscribe newBlockHeaders work

I'm doing this to get all blocks from the network: var web3 = new Web3(); web3.setProvider(new Web3.providers.IpcProvider("...", net)); web3.eth.subscribe('newBlockHeaders', function (err, result) { ...
3
votes
0answers
596 views

Web3 Event Filtering timeout

This is the code I use to get all events from a certain contract. Solidity: event NewEvent(address indexed contractAddress, address newBOPAddress, address payer, uint commitThreshold, bool ...
3
votes
0answers
312 views

Account and/or Balance not found in Geth for Smart Contract Deployment

Error 'Error: Account does not exist or account balance too low' Overview I'm trying to deploy the greeter smart contract in the ethereum.org/greeter tutorial. I downloaded/validated the ...

1
2 3 4 5
23