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

0
votes
1answer
8 views

how to format contract params expecting bytes32?

I have a contract that expects a bytes32 parameter called "topic" which I pass in like this: web3.utils.hexToBytes(web3.utils.stringToHex("Weather")), I also tried web3.utils.stringToHex("Weather") ...
0
votes
0answers
6 views

How to make ECDSA signature of (value_1, value_2) with web3 on Python?

I want to call function with four parameters. I know how to create two of them, but the last two is the r and s components of ECDSA signature of (param_1, param_2). I tried this (and a lot of ...
0
votes
1answer
16 views

“web3.eth.accounts” doesn't output account address

I follow the instruction video "Code Your Own Cryptocurrency on Ethereum (Full)" from Dapp University on youtube. What is different when i use web3.eth.account. Here is from tutorial Here was i do ...
0
votes
1answer
9 views

Is it possible to deploy a contract from python web3 if I have the ABI and bytecode from Remix?

Question says it all. I have a contract that I've written and compiled via Remix. I've dumped the ABI and Bytecode into local files, and I'm reading them into my python application. I'm following the ...
0
votes
1answer
9 views

ganache-cli: how to persist new created accounts

I start my service by: ganache-cli -d --gasPrice 0 -q --db=./db This persists my 10 defaults created accounts, but when I create new accounts using Web3: web3.eth.personal.newAccount('password') ...
0
votes
0answers
8 views

Ethereum testrp connection

I'm using web3 in an android app and I'm to get the provider to be able to call the function within the web3 library to work but fails. This is the error i get Attempt to invoke virtual method'...
0
votes
1answer
15 views

Metamask not returning current account address with web3js and ganache

How to return the address of my current account from Metamask? I have tried with web3.eth.getCoinbase() but this and metamask has two different address. web3.eth.getCoinbase() returns me the first ...
0
votes
0answers
21 views

How long does a smart contract typically take to complete?

I have been developing an application using a smart contract, the application is similar to this one: https://www.ethereum.org/crowdsale I went ahead and initiated a request, below is the codebase ...
0
votes
1answer
15 views

This contract object doesn't have address set yet, please set an address first

I am in the final stages of developing an application that is similar to https://www.ethereum.org/crowdsale, however, when I click on the create button, my Metamask modal is not popping up to ask me ...
1
vote
0answers
8 views

During gas-free transaction get an error “No relay responded! 4 attempted, 4 pinged”

I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless However, when I'm trying to write some tests it fails and provides me the following error Error:...
1
vote
2answers
24 views

How do I recover the address from message and signature generated with web3.personal.sign?

Is there any way to do that? To recover address in nodejs server-side from signature and message after it was signed with web3.personal.sign client-side? I tried this: https://ethereum.stackexchange....
0
votes
0answers
15 views

Get RPC URL / IP of Metamask's current provider

Suppose I have multiple copies of the same dapp running on different servers which do not directly communicate with each other, for testing purposes, and can manually interact with different dapp ...
0
votes
1answer
14 views

How does the MetaMask work with gas?

I have some web application based on Ethereum. This is how I call some function from a contract: contract.doSomething.sendTransaction(data, {gasPrice: web3.toWei(10, 'Gwei')}, callback...); This ...
0
votes
1answer
14 views

why do i see input data in the transaction details when i didn't pass it as a data parameter

When I create a transaction like below App.contracts.Soccer.deployed().then(function(instance) { return instance.purchaseShoes(name, age, { from: accounts[0], value: value}); }).then(...
1
vote
0answers
7 views

Ocasional connection refused initializing web3

I have an ethereum web application using web3js 1.0.0-beta.34 on a private network. Most of the times everything works fine. Sometimes the connection to the node through a websocket provider fails ...
1
vote
0answers
13 views

Transaction sent from web3 cannot reached all transaction to network node

I used one node endpoint to interact with the network. While sending a transaction from web3.js 0.20 to ethereum network, transaction per second (TPS) I achieved is only 28 TPS. I have configured the ...
0
votes
1answer
14 views

How to send ERC20 Token?

I try to send Token based on Erc20. and I can send Ether and something function but i dont know how to use transfer function in javascript like that. function transfer(address _to, uint256 _value) ...
0
votes
2answers
23 views

eth.sendTransaction successful or not?

I sent 1 ETH on a private chain from node1 to node2. >eth.sendTransaction({ from: "0x30278b135d0f5c10eb0684ff18bfd84912ae0f2b", gasPrice: "5000000000", gas: "21000", to: '...
1
vote
0answers
7 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 ...
0
votes
1answer
24 views

web3.js - cannot interact with smart contract

I want to write a simple js script. I follow many tutorial available from Youtube, forums and website but i seem that i cannot interact from the smart contract. i can interact it from remix. btw the ...
0
votes
0answers
23 views

How do I call my smart contract functions through web3 js?

So I am very new to Blockchain development so sorry in advance! I have deployed a very basic Smart Contract to the Ropsten testnet. I am developing a front-end and from here, I want to withdraw ether/...
2
votes
0answers
11 views

Most efficient way to get all non-zero storage locations for a smart contract?

I'm looking at a mainnet smart contract and want to figure out all storage positions/slots where the storage has a non-zero value. Is there a way to do this other than replaying and tracing all ...
-2
votes
0answers
14 views

I'm unable to use web3 here? [closed]

ethereumJS = require('web3') [Function: Web3] ethereumJS = require('web3') [Function: Web3] ethereumJS = require('web3') [Function: Web3]
0
votes
1answer
22 views

Using AbiEncoderV2 for encoding data in raw transactions

I've come across a use-case to need to pass a struct into a Solidity function. I know this can be done via tuples. However, I need to sign and send this transaction from my node.js back-end using ...
1
vote
1answer
39 views

Error set address/adding data, error: “gas required exceeds allowance or always failing transaction and the function doesn't work”

I'm trying to do a data access control system with smart contract. I have 3 entity: Client: who can get data and set address of Oracle Oracle: who can add data and have getData() function RBAC: Role ...
1
vote
0answers
34 views

Timeout exceeded during the transaction confirmation process

I am trying to figure out the right syntax for solc 0.5.7 and web3 1 beta 52 Follow my source code: contract.sol pragma solidity ^0.5; contract Hello { string public message; constructor (...
0
votes
1answer
25 views

Infura Web Sockets doesn't work on Infura

I have a problem with connecting via Websockets to Infura. I am listening on some events from my smart contract, so when some event is dispatched by calling some method from smart contract, I should ...
-1
votes
0answers
89 views

web3.eth.sendSignedTransaction [closed]

when executing the function web3.eth.sendSignedTransaction, it throws this err { error: Error: Timeout exceeded during the transaction confirmation process. Be aware the transaction could still get ...
0
votes
0answers
25 views

MetaMask - Multiple transactions confirmation

Is it possible to somehow make one pop-up window with one group confirmation for multiple transactions in MetaMask? I need to send to the blockchain multiple pieces of data, 1 piece of data = 1 ...
0
votes
0answers
15 views

Solidity, Web3 - Invalid number of arguments to Solidity function when I have correct number

I created smart contract and I deployed it on Ropsten network using Truffle. I tested it from Remix and it works. I have there 2 view with a same name checkInputData but different number of parameters....
0
votes
0answers
11 views

Track token transfer in the given hash [duplicate]

I am making explorer like etherscan. Etherscan give us the information about token transfer in a transaction.Can you tell me what etherscan do to track the token transfer.I try to get input data from ...
0
votes
0answers
12 views

sendTransaction never resolves on web3.js 1.0.0 beta49 - beta52

My plain vanilla sendTransaction doesn't ever resolve on ganache with web3js 1.0.0 beta52: async function sendTx() { const receipt = await web3.eth .sendTransaction({ to: "0x1...", ...
0
votes
0answers
27 views

Problem with send method in Infura

Newly Infura site has been changed its interface. Before that all methods of our client program was successfully working, but now when I logon to Infura, all whitelists has been removed. I added our ...
0
votes
0answers
27 views

How to send a value from interface to smart contract function

I have the below contract to create document details: pragma solidity ^0.5.0; contract Documents { struct Document { uint256 creationDate; uint32 documentCreationTimestamp; ...
0
votes
0answers
27 views

Use Web3 to recover address from message signed by ethers.js?

On the client we are using ethers: const signingKey = new ethers.utils.SigningKey(privateKey) const message = Date.now() const messageBytes = ethers.utils.toUtf8Bytes(String(message)) const ...
0
votes
1answer
25 views

Make a struct member optional when initializing struct

struct Petition { uint id; string name; string description; uint voteFor; uint voteAgainst; address[] addressOfVotedForUsers; address[] addressOfVotedAgainstUsers; ...
1
vote
1answer
14 views

Metamask Error messages shows only revert

I have a little problem with the error messages I receive from MetaMask. In my dApp I have a modifiers which should throw an error with an error message. However, in MetaMask I only receive the RPC ...
0
votes
1answer
10 views

Is the encoded ABI of a function guaranteed to be unique?

I assume that two functions of different prototypes will yield two different encoded ABIs. Is that correct? With regards to two functions of the same prototype, I tested a pair of functions which ...
0
votes
0answers
15 views

web3.eth.sign vs web3.eth.signTransaction, different or the same?

Does web3.eth.sign do the same thing as web3.eth.signTransaction? For instance, could I sign a transaction with web3.eth.sign? What is happening under the hood with those two methods?
0
votes
0answers
11 views

Subscription to events from first block

I'm trying to subscribe to my events from the first block. I'm using a WebSocketProvider with web3js 1.0.0-beta.34. This is my code: var options = { "address": "...
1
vote
0answers
21 views

How to use the Ethereum Natural Specification Format?

I would like to make use of the Ethereum Natural Specification Format (https://github.com/ethereumproject/wiki/wiki/Ethereum-Natural-Specification-Format) but I do not understand how to implement it. ...
1
vote
1answer
39 views

How to deploy a contract using web3@1.0.0-beta.51 and solc@0.5.7

I want to write some tests using mocha and ganache-cli for my contract. I tried to deploy a compiled contract like so: //ZombieFactory.test.js const assert = require('assert'); const ganache = ...
0
votes
0answers
25 views

ERC20 token transfer transaction reverted

I'm trying to transfer token using ERC20 token transfer method using web3.js (version: 1.0.0-beta.37). I could successfully transfer tokens with Remix as the method is working fine. However, I got the ...
0
votes
0answers
16 views

web3 provider is set to null when try to access for second time

Hello i have issue with my app. I'm using truffle unbox react envoirment. I have simple component which render form and on submit i want to redirect. After i go back to form web3 is null. Here are ...
0
votes
1answer
17 views

Which web3js version should I use for getting DApp output?

I'm using web3js(1.0.0-beta.51) and I wrote the simple code that not returned any output and exact application result which I have expected.
0
votes
1answer
30 views

Error on WebSocket connection to Infura Ropsten (broken close frame)

I am trying to connect to Ropsten with Web3js (1.0) via Infura using their WebSocket provider but I am getting the following error: WebSocket connection to 'wss://ropsten.infura.io/ws' failed: ...
0
votes
0answers
5 views

Web3 lose state when url is chaging in react

I have a strange issue with my web3. Once when app is load my web3 is configured correct. I have a form on which I can submit some data to my contract and everything works great, but when I try to ...
0
votes
0answers
34 views

Can read from smart contract but can't write

I have a app.js script that I am trying to use to interact with a smart contract. I can read from the contract however, I cannot write to it. The called method countMessages() returns the correct ...
1
vote
1answer
60 views

Promise not resolved for web3eth.sendSignedTransaction

I am testing whether transactions that I'm signing offline are accepted by the Ropsten network. I'm submitting the transactions using Web3.js (web3@1.0.0-beta.51) as follows: I connect to an INFURA ...
0
votes
1answer
19 views

No “from” address specified in neither the specified in neither the given options nor the default options

So I already went through this query, but I still couldn't get my doubt solved. Be it any Blockchain Dapp, the same error is coming for me. I used the marriage certificate and kickstart examples. Can ...