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,191 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
532 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
141 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
362 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
332 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
389 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
55 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
422 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
287 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
998 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
502 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
540 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
880 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
387 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
448 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
528 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
435 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
749 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
299 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
747 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
437 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
318 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
522 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
542 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
593 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
626 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
289 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
152 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
332 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
62 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
429 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
319 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
412 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
593 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
13 views

Filter past events with condition

Is it possible to filter past events with a boolean condition? For example I have the following event: event ExampleEvent(uint256 exampleNumber); In my js code I can filter these events with the == ...
1
vote
0answers
17 views

How to get event from geth ethereum node using web3.js

I have created a simple contract where I am trying to write a value to a state variable in solidity smart contract, and emit that written value. I am using Truffle v5.1.28 (core: 5.1.28) Solidity - 0....
1
vote
0answers
15 views

Getting name/decemals of unstandardized token on Ethereum blockchain with web3.js

I understand how to call methods of name/symbol or decemals on ERC-20 tokens but what about tokens that do not have such.. for example this token here https://etherscan.io/token/...
1
vote
1answer
22 views

Does the term “Ethereum ECDSA signature” have a consistent meaning?

If you were writing some instructions and one of them was: Provide the Ethereum ECDSA signature of the file using the person's Ethereum address. Would the above instruction have a consistent meaning ...
1
vote
1answer
28 views

The send transactions “from” field must be defined using Infura web3

when I try to send my transaction using infura I get this error "The send transactions "from" field must be defined" My problem is my web3 object. When I used Metamask and ...
1
vote
0answers
60 views

Txpool not receiving any new pending transactions

This seems to happen randomly during an influx of new transactions. I am running a node with high txpool limits. --txpool.globalslots 1000000 --txpool.accountslots 128 --txpool.accountqueue 512 --...
1
vote
1answer
24 views

Correct approach of replicating smart contract balances

We are storing user balances on smart contract and as well as on our local db, so that we dont always have to query blockchain for user balance. For this we use contract events to update balances ...

1 2 3
4
5
24