Stack Exchange Network

Stack Exchange network consists of 174 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
22 views

how to get the real balance of ETH by eth_getbalance

as I know, the transaction should be confirmed by 11 times then it will be done. but when i use eth_getbalance to get the balance ,it will return some fake balance without confirmed. so How can I get ...
0
votes
1answer
16 views

is there any problem if i put GETH/PARITY and webserver in one server?

my website need to use something about ETH,so i have to setup a geth/parity rpc server. is there any problem if i set the geth/parity rpc in my webserver?
2
votes
1answer
137 views

What is the difference between web3.js and ethers.js?

Can anyone write a short comparison between the most important features of the two libraries?
1
vote
1answer
96 views

How can we parse and deal with BigNumber (BN) args in Solidity events?

In the past, web3 events published numeric events like so: BigNumber { s: 1, e: 17, c: [ 1000 ] } } Now with web3.js 1.0, big numbers come down as objects like this: <BN: de0b6b3a7640000> ...
1
vote
1answer
50 views

How to get the blocks between timestamp

I want to take the blocks between give timestamps. currently I manually use fromBlock: (await web3.eth.getBlockNumber()) - 12343 toBlock: (await web3.eth.getBlockNumber()) - 6172 For getting ...
0
votes
1answer
22 views

Creating contract account with ether balance in original sendTransaction?

trying to send a very simple contract creation transaction that includes a value with it so that the created contract already contains an ether balance. Is this not possible. Basically I'm sending a ...
2
votes
0answers
43 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 ...
1
vote
0answers
35 views

web3 recover address from signature signed by digital bitbox

I use digital bitbox to sign some data and would like to use web3.js to recover the account address. Following https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#recover I couldn't ...
0
votes
1answer
39 views

How can i get my var in Web3, i always get Promise { <pending> }

var gogo =web3.eth.getBalance("0xXXXXXXXXXXXXXX") .then(console.log); console.log(gogo); if (gogo > 123) { console.log('enough.'); } how to run if in this case? Thanks for helping me.
0
votes
1answer
62 views

Web3 Rinkeby Infura Problems

I've got a Smart Contract that works perfectly when deployed to localhost: 8545 (using Ganache) with my Web3 Dapp. But when I put it on Rinkeby, I'm running into problems,. The Contract is super-...
1
vote
0answers
69 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; ...
3
votes
2answers
52 views

Is web3.js an Ethereum blockchain client?

Reason is that I wanted to know what Ethereum blockchain client uPort uses and someone said it's web3.js. I haven't understood this concept enough since I was expecting something like eth, geth or ...
2
votes
1answer
52 views

Why root and status is null in transaction receipts

I deployed a smart contract on my private Parity node with Web3js. I got transaction hash and logs those I submitted at my contract creation. Everything works well, I can call functions correctly. ...
0
votes
1answer
176 views

this.provider.send is not a function

I'm trying some examples from the wiki, nothing is working: var web3 = new Web3(Web3.givenProvider || "https://mainnet.infura.io/v3/5d4d4f7190b94eb4893ef4dbdc782255"); web3.eth.getBalance("...
0
votes
2answers
68 views

Solidity event function not appearing in web3

I have a contract with the following event (using 0.4.24): event UpdateProgress(bool _gameInProgress); I am registering the contract like this: import Web3 from 'web3'; import address from './...
0
votes
1answer
130 views

web3 not connecting to Infura / Rinkeby Testnet

I've successfully deployed my Smart-Contract to the Rinkeby TestNet via Remix. Everything works perfectly from within Remix. But when I try to get my web DApp to fire methods in my Smart-Contract - ...
1
vote
0answers
47 views

Web3: how call the view function at the current time

How can I call the view methods of the contract using web3 relative to the current time, not the time of the creation of the last block? For example, on remix, the current time stamp in the view ...
0
votes
1answer
18 views

Script to automatically transfer ether to another address

Please, can anyone help with a script to use and watch my address for any incoming ether, and once it enters, the script would quickly transfer the ether to another address. I would also love to know ...
1
vote
1answer
145 views

Send signed transaction from nodejs to private SmartContract using webjs in Quorum network not working

Context I have a quorum network mounted following the example of 7nodes. In node 1 I have deployed a smart contract privately, putting the public key of this ("BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+...
1
vote
0answers
134 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 ...
0
votes
1answer
32 views

How to do a for loop with a promise? [closed]

Here is my contract code: $.getJSON('Adoption.json', function(data) { // Get the necessary contract artifact file and instantiate it with truffle-contract var AdoptionArtifact = data; App....
0
votes
2answers
193 views

New web3 method to request account access from dapp browser, no request

Since metamask communicated that they will no longer inject web3 by default (https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8) I tried to use their new ...
0
votes
1answer
71 views

What does Error: Provided address “1.2870172725867908e+48” is invalid, the capitalization checksum test failed

I have assigned my variables here > var contractAddress = 0xb5A5F22694352C15B00323844aD545ABb2B11028 > var cont = new web3.eth.Contract(abi, contractAddress) I am getting the error : ...
2
votes
2answers
102 views

Zeppelin OS: revert Cannot call fallback function from the proxy admin

I have been attempting to create a simple upgradable contract using Zeppelin OS: Following the tutorial I have been able to: - Create a new contract - Deploy it using zos push - Create the proxy ...
1
vote
0answers
18 views

web3js send transaction failed when contract modify mapping data , but remix work

first, web3 version: 1.0.0-beta.36 the contract code is: pragma solidity ^0.4.25; contract Main { struct Model { uint256 key; uint64 createTime; } Model[] public models; mapping(...
0
votes
1answer
21 views

Which type of Projects/Apps are suitable/best to be developed in blockchain/dapp technology? [closed]

Which kind of Apps are best to be developed on the base of blockchain/dapp/web3 technology. Suggest me please as I am looking for an advice for an academic final year project.
1
vote
0answers
79 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 = ..., ...
0
votes
0answers
89 views

Truffle-contract error on deployed contract

Playing around with the gnosis multisig, using truffle-contract to interact with already deployed MultiSigWallet using truffle migrate. Contents of the file I am trying to run: var contract = ...
2
votes
0answers
145 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. ...
1
vote
1answer
29 views

How can I increase EVM time in web3.py?

When working with web3.js, Truffle and Ganache, I can do this: web3.currentProvider.send({method: "evm_increaseTime", params: [numOfSeconds]}); How can I do the equivalent in web3.py? When I do: ...
0
votes
1answer
20 views

Connecting to Ethereum Clients from C application

web3.js is a great library to communicate with client node. I have tried using socket programming from C application to first reach nodejs web app in order to make use of web3.js services to reach a ...
3
votes
1answer
90 views

List holders and tokens for an ERC-721 contract

Given a contract, I want to map the holders to their token ids. For example, the contract 0xFBeef911Dc5821886e1dda71586d90eD28174B7d is an ERC-721 contract for KnownOriginDigitalAsset. Etherscan ...
0
votes
1answer
165 views

How to use infura API with web3 js? [duplicate]

How to use infura API with web3 js? Where should I put secret key?
0
votes
1answer
23 views

How to call function with two different signatures/parameters? [duplicate]

In my contract I have two functions with the same name, but with different number of parameters, like so: function computeVote(uint sku, uint sellerId, uint8 _rating) public {...} and function ...
1
vote
1answer
42 views

Convert contract creation code to contract source code

I already get the bytecode of a contract from web3 through this method: web3.eth.getCode(address), but I am having trouble decoding this code to a human readable form. How do I do it? Take the OMG ...
0
votes
1answer
25 views

can not find specific events and list events of the past the last 1day

I'm wrote this sample but I want to filter specific events 'unsealBid' and list events of the past (e.g. the last 1 or 2 days). const Web3 = require('web3'); const web3 = new Web3('https://mainnet....
0
votes
1answer
30 views

About getPastLogs usage

"getPastLogs" can get past event log. I check the web3 documentation: fromBlock - Number|String: The number of the earliest block ("latest" may be given to mean the most recent and "pending" ...
0
votes
1answer
29 views

Transaction mined but state variables aren't changing

I am able to get the transaction with a block number while calling method of a contract however the state variables don't change unless I mention the "address" and "gas" parameters on web3^0.20.7 ...
2
votes
1answer
67 views

MetaMask expose accounts

From 2nd November MetaMask will not expose user accounts by default anymore and we must do it. I'm confused about how we are supposed to integrate that in our dapps. For example, I have a standard ...
0
votes
1answer
89 views

Unable to interact with DApp deployed on quorum

I am unable to interact with contract using Dapp deployed on Quorum blockchain (using metamask). I am following "https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-...
0
votes
1answer
126 views

Creating transactions with Transaction Data to Metamask

We can use transaction data to submit any Ethereum transaction using Metamask, right? Not only ERC20 transfers, right? Does anyone knows how can I generate hexadecimal transaction data to Metamask ...
0
votes
1answer
43 views

Sending ether to a contract

Beginner in solidity and i'm trying to send ether from an address to a contract. I've tried transferring ether using the Remix compiler test accounts. pragma solidity 0.4.25; contract sendether{ ...
0
votes
2answers
129 views

Sending Signed Transaction returns pending and event:undefined

I am trying to send a signed transaction using web3 1.0 and Infura.io through the browser. When I run it I dont get any errors but the transaction never hits the blockchain so I am confused on whats ...
-1
votes
1answer
74 views

Is there a host node for ETC similar to infura?

I want to connect to a node test using web3's HTTPProvider, and I don't want to spend time deploying a node.
1
vote
1answer
54 views

web3.js Contract return null instead of string

Here is contract: pragma solidity ^0.4.17; contract Demo{ string public data; function Demo()public{ data = "Jiu Wei"; } function getData() public view returns (string) { return ...
0
votes
1answer
54 views

Trying to send signed transaction through web browser using ethereum-tx

I am working on signing and sending a transaction using web3 v1.0 and Infura.io. I have setup a script to run the TX but cannot seem to get ethereum-tx to connect in the browser. <script src="...
0
votes
2answers
79 views

Trouble connecting to web3 1.0 through web browser using Infura.io

I am trying to connect to web3 1.0 through a web browser, I dont see much documentation for 1.0 though. This script says im connected but I think its the previous version as anytime I try and run a 1....
1
vote
1answer
76 views

Getting TX is not defined when trying to send signed transaction [closed]

I am trying to learn how to send a signed transaction using web3 1.0 and Infura.io. I have node.js running locally for testing. I can successfully create an address and check balances but am getting ...
1
vote
1answer
29 views

Event to track transactions on the backend

I'm currently developing a betting website built on top of Ethereum and am facing the following doubt. In my contract there is an event at the end of the placeBet function which tracks the summary of ...
1
vote
2answers
94 views

Read state from smart contract deployed to azure proof of authority ethereum network

I deployed a smart contract to an azure proof of authority network(ethereum). Following the instructions here https://docs.microsoft.com/en-us/azure/blockchain/templates/ethereum-poa-deployment#...