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,259 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
1answer
305 views

Can i delete some old files inside chaindata folder?

I am running geth with fast sync, Can i delete some old files inside chaindata folder so that my ssd will have some empty space or it will create some problems ?
2
votes
0answers
85 views

How can I check the total gas used by a transaction?

I am trying to figure out the total gas used by a transaction. It appears gasUsed = cumulativeGasUsed but both values don't check out with the following check: gasPrice = 100000000000 Number(...
2
votes
0answers
459 views

Multiple instances of web3 to talk to multiple chains

I am building an oracle to watch for an event on one chain and respond by sending a transaction to another chain. Creating multiple instances of Web3 (version 1.0.0-beta.26) is fine but how do I ...
2
votes
1answer
317 views

How can I use solc solidity compiler on truffle webpack?

When I try to import solc, it raises an error which says: ERROR in ./~/require-from-string/index.js Module not found: Error: Can't resolve 'module' in 'C:\users\bisrat\Desktop\webpacksample\...
2
votes
0answers
268 views

Provider not set or invalid when using Web3 1.0

I'm trying to use Web3 1.0 to call the balanceOf function on my contract. The error I get during runtime is as follows: Error: Provider not set or invalid. The code causing the problem is as follows:...
2
votes
0answers
552 views

Web3.js filtering on allEvents

I'm struggling to figure out how to add a filter to allEvents requests. My current code: const contract = getState().web3Reducer.get('contract'); contract.getPastEvents('allEvents', { ...
2
votes
0answers
144 views

web3.eth.subscribe give response blank

I am using web3 1.0.0 on nodejs all working fine but web3.eth.subscribe not working for pendingTransactions, I don't understand what is the issue. I'm using web3 version : 1.0.0 OS : windows ...
2
votes
1answer
76 views

event not returning expected data

When I start my app I listen for posts from the latest block. After a post has been made I'm supposed to return author (address), title (string) and an id (uint). But what I get in the author and id ...
2
votes
2answers
389 views

Difference between eth.newAccount and personel.newAccount

Can anyone explain the difference between `eth.accounts.create()` and `eth.personal.newAccount()` and which one we should use and why? As I am new to ethereum so its very confusing for me. Thanks
2
votes
0answers
338 views

Truffle constant functions run out of gas, how to simulate a local node

I am new to solidity and web3. I am getting familiar with Truffle, testrpc and web3 1.x. I am also using React as a front end. I know that functions that don't change the smart contract state can ...
2
votes
0answers
396 views

undefined contract address when trying to deploy with web3 and Metamask

I am trying to develop a simple wallet type contract but having troubles deploying it. I am trying to deploy it using the method described here. I am using truffle and web3 along with Metamask. Now, ...
2
votes
0answers
56 views

Smart contract state storage under the hood and scalability

I know smart contract state is being added in block, Does this true always ? When I add or update an array of struct in contract what happens under the hood ? Is there any limit for such data ...
2
votes
0answers
434 views

Send transaction with metamask and web3

I'm new to the topic but can I somehow sendTransaction via contract instance? What I'm missing here? I simply want to send some ether to contract. var abi =[ { "constant": true, "...
2
votes
1answer
293 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
1answer
1k views

token transfer fails in crowdsale contract

I have a token contract and a crowdsale contract. When I try to send ether to the crowdsale contract from accounts[3] (or any other really), I get an opcode error: Error: VM Exception while ...
2
votes
0answers
173 views

web3 installer not installing dist folder?

I've tried to install web3 with node.js by doing npm install web3 --save, but when I check the node_modules folder, there's no dist folder and its web3.min.js file anywhere. Any ideas on how or why? ...
2
votes
0answers
529 views

Unable to send eth with the web3 API

I'm new to this web3 API and I'm trying to use it with NodeJS. I've not been able to make a single transaction from one address to another. I've been able to successfully retrieve the balance of my ...
2
votes
0answers
546 views

how to hook up web3 injected by metamask in angularjs

i need to connect to ropsten testnet through metamask but the problem is i wrote the code in node js and it works fine . but how to hook up the web3 into the angularjs 1.
2
votes
0answers
896 views

How to sign a message using Ethereum private key, locally without running a full node?

I need to sign locally, on a client (preferably in a browser) a message using my Ethereum private key. How can it be done without running full node locally? Message does not need to be sent to ...
2
votes
0answers
392 views

Contract state and variable changes in pending transactions

I have a simple contract: pragma solidity ^0.4.0; contract Festival { address owner; uint8 max; address[] entered; function Festival(uint8 _max) { max = _max; owner ...
2
votes
3answers
2k views

Accessing web3 object in Chrome terminal using React

I am receiving a "not defined" error when trying to access the web3 object in Chrome terminal. My current setup: running testrpc web3 object successfully instantiated in App.js built app using React ...
2
votes
0answers
206 views

How can I get my dapp interface to work on Mist? I'm using truffle framework and it works with Metamask

I can't get my interface to work on Mist using truffle contract abstraction. After building and testing successfully with Metamask I thought I'd test it on Mist as well and, surprise, it doesn't work. ...
2
votes
0answers
465 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 - (...
2
votes
0answers
310 views

How do I connect to the local node run by Mist/Ethereum Wallet 0.9.0 from Web3 JavaScript app API?

How do I connect to the local node run by Mist/Ethereum Wallet 0.9.0 from Web3 JavaScript app API? I see in official site that it suggests using web3 = new Web3(new Web3.providers.HttpProvider("http:...
2
votes
2answers
539 views

Deploying a contract that calls a contract

What is best practice on deploying a contract called within another contract with web3.js? I have previously gone under the assumption that the contracts must be mined separately, and the caller must ...
2
votes
2answers
436 views

Deploying to rinkeby doesn't work

It seems I have a bit of trouble deploying a contract to testnet through infura this is my code: var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('https://rinkeby....
2
votes
0answers
756 views

What can I do about an “Invalid sender” contract deployment error?

When deploying a smart contract, I get this message: "Error: invalid sender undefined." See details below. Why is this happening? What do I need to do differently? I wrote the smart contract below ...
2
votes
0answers
303 views

TypeError: filterCreationErrorCallback is not a function

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

How can I use web3 on the server

I have a meteor app and would like to use web3 on the server. Wneh I call a web3 function I always get the following error: TypeError: XMLHttpRequest is not a function What do I have to do, that I ...
2
votes
1answer
756 views

how to call web3.isAddress() via JSON-RPC?

web3.isAddress (and other web3 methods such as toWei) works fine in the geth console, but when called from RPC (or IPC), it always returns {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"...
2
votes
0answers
447 views

Why is dynamic array length not updated after addition of new element?

I created a struct as follows: struct Node{ // each node models each device on the network address nodeAdress; // adress of the node uint trustValue; // trust value ...
2
votes
0answers
323 views

how can I detect if an address contained a contract that called selfdestruct?

I would like to create a web3-based JS function like this: function hasSelfDestructed(address) { if (... address was a contract, but has called selfdestruct ...) return true else return ...
2
votes
0answers
524 views

Truffle - Migrations cannot be found

I have recently done a fresh install of truffle v2.1.1 as I want to compare this version to the recently updated version. truffle init Works as expected. However, when doing; truffle migrate --...
2
votes
0answers
355 views

Truffle/Web3: myContract.method.estimateGas causes BigNumber error

I get the following error when running truffle test: { BigNumber Error: new BigNumber() not a number: [object Object] at raise (/Users/danielyakobian/.nvm/versions/node/v7.5.0/lib/node_modules/...
2
votes
0answers
546 views

Why is there a difference between eth.estimateGas and the real cost in testRPC?

When I want to deploy a smart contract, I use the eth.estimateGas before deploying my smart contract. This gave me 688180 Gas. let bytecode = compiledContract.contracts['Document'].bytecode; let ...
2
votes
0answers
599 views

web3.eth.sendTransacton- callback not woriking as expected

When I use eth.sendTransaction({ to:eth.accounts[0], from: eth.accounts[1], value:web3.toWei(1099807516000000000000,"ether") }); I get error like : Error: Insufficient funds for gas * price + ...
2
votes
0answers
181 views

Mining is taking too much cpu memory( i.e more than 100% of one core), how to reduce it?

What I have 1. I have step up four private blockchain of ethereum. 2. when i start mining on one core( miner.start(1) ) , it is taking too much cpu memory( i.e 100% or more) What I Want 1. ...
2
votes
0answers
645 views

Connect to node via IPC

As per my knowledge, RPC connection to a node is quite unsafe. so the alternative is connecting to a node via IPC. But how to connect to node via IPC? I have used web3 for connecting to node via RPC ...
2
votes
0answers
290 views

geth taking a long time to mine a block

I'm using the embark framework to deploy some smart contracts to a private Ethereum network. The problem is, the network behaves differently on separate machines, even though they're similarly spec'd -...
2
votes
0answers
153 views

How the multisignature process working after completed the contract process

I completed a contract creation process using Ethereum Wallet source code. How can I use this contract from a web3 client (not from Mist) ? Can you give some example workflows for using ...
2
votes
0answers
335 views

Constant function returns empty (string)?

I have the following code: web3 var fromAddr = u.addr; var contractAddr = this.addr; var abi = this.abi; var contract = web3.eth.contract(abi).at(contractAddr); console.log(...
2
votes
0answers
3k views

Web3.js Error: provider not set after TestContract.at(address);

I'm new to web3.js and ethereum, and i'm trying to play with it coupled with meteor and angular 1.5. I defined a component that creates a simple contract but i'm stuck after calling TestContract.at(...
2
votes
1answer
63 views

Deploying Network; Using Different PC for different user

I am using MIX IDE in Windows. I have created a new smart contract in Contract.sol, I have 4 Pages of html and there are 4 users. Each html page is controlled by each user. The pages are also ...
2
votes
0answers
431 views

Contract storage not being updated after sendTransaction

First of all, sorry about the code written in Portuguese. I have the following contract: contract GerenciadorBoletos { struct Boleto { uint codigoBarra; uint ...
2
votes
1answer
351 views

convert padded topics address to valid address string

I am parsing some information from the topics array. I receive 32bit padded addresses in some indexes. Is there a web3 utility function or useful helper method to get these back into normal sized ...
2
votes
1answer
421 views

How do I close web3 such that mocha tests exit properly?

I'm writing a simple NodeJS (Node 9.4.0) server that's using web3 (1 beta) to interact with Ethereum. I've created a simple utility web3 as follows: const Web3 = require('web3') const url = process....
2
votes
2answers
1k views

web3 js eth.contract equivalent in PHP

var Web3 = require('web3'); var web3 = new Web3(); web3.setProvider(new web3.providers.HttpProvider("http://blahblah.com:8545")); var token = web3.eth.contract(ABI).at("x0x_contract_address") How ...
2
votes
1answer
598 views

Can I send a whisper (shh) message to an Ethereum address?

It seems that we can only send a message by creating new symmetric keys and key pairs ( shh.newSymKey() and shh.newKeyPair() Then post shh.post() a message using the parameters: symKeyId which ...
1
vote
0answers
15 views

How to get the non-packed solidityKeccak hash in Python Web3

For Web3.solidityKeccak(['bool'], [True]) , Python Web3 yields: 0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2 This matches the output of keccak256(abi.encodePacked(true)) in ...
1
vote
0answers
12 views

Verifying ETH Deposit Contract signatures using Chainsafe BLS library

I am attempting to verify BLS signatures using the Chainsafe BLS library. I am attempting to independently verify signatures associated with deposits to the ETH Deposit Contract. In order to test that ...

1 2 3
4
5
26