Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

5
votes
0answers
368 views

Connecting to remote Geth client from AWS hosted server via web3 needs fix

There is a general problem that is affecting most everyone who tries to initialize AWS hosted servers with a remote Geth instance. It would be great to have documentation to address a fix or at least ...
4
votes
0answers
257 views

Why is web3j java not generating correct return types for my contract

Here is my contract: pragma solidity ^0.4.17; contract SignVerify { function recoverAddr(bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (address) { return ecrecover(msgHash, v, r,...
4
votes
0answers
447 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
0answers
217 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
0answers
258 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
2k 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( '...
4
votes
0answers
373 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
0answers
74 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
0answers
67 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
0answers
81 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 ...
3
votes
0answers
307 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 ...
3
votes
0answers
189 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
0answers
712 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 ...
3
votes
0answers
147 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
66 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
453 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
41 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
420 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
0answers
727 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
51 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
0answers
514 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
394 views

Does sendRawTransaction behave the same as sendTransaction with nonce parameter.

In the Javascript API wiki it states that if you send a transaction with sendTransaction() and the optional nonce parameter set you can overwrite your pending transaction. nonce: Number - (...
3
votes
0answers
271 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 ...
3
votes
0answers
3k views

Sign and send transaction (call contract function)

I am using ethereumjs-accounts providerfor transaction signer in HookedWeb3Provider. And I am trying to call contract function which send tokens. It's my params for sign transaction. let tx_params = ...
3
votes
0answers
836 views

Error: filter not found - when watching for latest blocks

Found block 3258499 Found block 3258502 Found block 3258587 Error: filter not found at Object.InvalidResponse (/home/ubuntu/node_modules/web3/lib/web3/errors.js:35:16) at /home/ubuntu/...
3
votes
0answers
717 views

ERC20 Transfer Event error or intended?

I'm trying to get an Event "Transfer" for the ERC20 Token with web3 function getTransactionReceipt event Transfer(address indexed _from, address indexed _to, uint256 _value) You can see the term ...
3
votes
0answers
1k views

web3 filter option not working

var filter = web3.eth.filter({fromBlock: 350000, toBlock: 'latest',address:"0x075da4ebae466b80d451b0627296d5d38b3e99c1"}); var myResults1 = filter.watch(function (error, log) { console.log(error);...
3
votes
0answers
23 views

Cant HTML portion in MixIDE

When I add web3.eth.defaultAccount = web3.eth.accounts[0] this code under <script> tag in html. I can't see my entire webpage in Mix IDE. Let me know how to resolve this
3
votes
0answers
130 views

How to use an accessor for imbricated data types?

I'm looking at information about accessors in solidity/js for more complex data structures than just a public array/mapping. How can i access the array in that code for: struct AnotherStruct {....} ...
2
votes
0answers
30 views

Why I can't use two functions with same name, but different parameters

I have a function which returns address but it gives me error if I try to read it. I'll explain by a quick example: Solidity: contract TestOneReturn { mapping(uint => uint) m_Data; ...
2
votes
0answers
36 views

web3: getPastEvents works in Truffle on instance, not in web3 script on page

I am looking to collect the previously logged events of a certain type using getPastEvents. It does not seem to work in my web3 script on my site but it does work in truffle console on a deployed ...
2
votes
0answers
47 views

Using web3.js, how can I get a TX hash before sending?

I'm using web3.eth.accounts.signTransaction() to obtain a rawTransaction, but I also need the transaction hash. calling web3.eth.sendSignedTransaction() will give me the hash, but I need to get it ...
2
votes
0answers
66 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 ...
2
votes
0answers
27 views

Can I send transaction to a view|pure function?

This is the contract: uint public result; address public owner; constructor() public { owner = msg.sender; } function add(uint a, uint b) public returns(uint) { result = a + b; return ...
2
votes
0answers
104 views

Transaction not mined error when deploying to quorum maker server

I get the following error when attempting to deploy my zeppelin erc20 token to a quorum server(used quorum maker). (master) $ node migrations/2_proj.js ``````` transactionHash ...
2
votes
0answers
25 views

What Web3JS method do I call to know what value to use for the gas price with sendSignedTransaction?

I am using Web3JS 1.0+ to send transactions to my smart contract. I've been using the following constant for the gas price in my code that I got a long time ago from a tutorial. What is the "...
2
votes
0answers
36 views

web3 - get all contract public variables?

I have an abstract worker contract and few that inherit from it. Those contracts have some public variables, each one different. I want to display them on my website. Is there any way to return all ...
2
votes
0answers
130 views

truffle-hdWallet-provider not return correact address when using private key

I want to access MyEtherWallet account address from truffle-hdwallet-provider. This is the code. ``` var HDWalletProvider = require("truffle-hdwallet-provider"); var privateKey = process.env.KEY; ...
2
votes
0answers
280 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. ...
2
votes
0answers
72 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.
2
votes
0answers
685 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 ...
2
votes
0answers
42 views

Estimated gas is always low

web3.eth.estimateGas is always calculating low gas for the transaction. Here is a reference to a trasaction in ropsten. https://ropsten.etherscan.io/tx/...
2
votes
0answers
214 views

Using Web3 v1.0.0 in a web application: issue with XHR2

I am building a simple Vue-based web application which uses Web3 v1.0.0 (the latest version available). Currently, I'm struggling to make something as simple as the following run: import Web3 from '...
2
votes
0answers
61 views

Initialize Metamask from front-end use of Nodejs

Building a simple ERC-20 Token payment screen for a simple shopping cart. I am having an issue figuring out how to use Metamask to allow others to make secure payments. As we dont have access to other ...
2
votes
0answers
146 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
0answers
99 views

miner shows 0x0000000… while getting block details using eth.getBlock()

I have created a private ethereum POA network using a bootnode and 6 nodes , of them 3 are miners .But every time i do a successful transaction over network , the miner returned by the getBlock of eth ...
2
votes
0answers
20 views

Data Scientist wanting to simulate a DAO on private network, unsure of where to begin

My apologies for such a broad question, I couldn't find anything remotely similar to my case and I've got lots of questions - I'll try to narrow the scope down here. Premise: I'm a data science ...
2
votes
0answers
194 views

Comparing solidity sha3 with web3 sha3 inside smart-contract

The problem is that sha3 in solidity returns bytes32 and I have a string returned from IPFS by oraclize, and if hash calculated in solidity and returned to web3js (bytes32 got interpreted as a string) ...
2
votes
0answers
180 views

Is the signature generated by “web3.personal.sign” different with “web3.eth.sign”?

Are web3.personal.sign and web3.eth.sign difference in value of generate signature ? Or both of them generate an equal output ? I could test web3.eth.sign using testRPC, however web3.personal.sign ...
2
votes
0answers
168 views

Async/Await problems with web3.eth.getAccounts

I'm working on a simple Ethereum project, but since I'm not certain whether the issue I'm having is to do with Web3 or Async/Await, I decided to post this question to both Stackoverflow and Ethereum ...