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/...

1
vote
1answer
11 views

Can't call a function in a contract, returning something from another contract

I use private geth + web3js (in truffle this works good) Here is an example worked as expected: the first contract: pragma solidity ^0.4.24; import "./Second.sol"; contract First { Second ...
1
vote
1answer
17 views

Estimate Gas Price (not Gas) using Web3

Using Web3, we are able to estimate the amount of gas needed for a transaction let estimatedGas = web3.eth.estimateGas({ to: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", data: "...
0
votes
0answers
10 views

Simulating similar website with remix but only interact with metamask with deployed contracts (web3Currentprovider)

I am creating a website which can interact with metamask (or mist). This website will be similar to remix. It can interact with contracts (these contracts have been deployed). Where should I start to ...
0
votes
0answers
9 views

Simulating similar website with remix but only interact with metamask with deployed contracts [on hold]

I am creating a website which can interact with metamask (or mist). This website will be similar to remix. It can interact with contracts (these contracts have been deployed). Where should I start to ...
0
votes
1answer
12 views

Using the same event name in different contracts

Suppose I have two different contracts, and I implement an event in each one of them. If I use the same event name in both contracts, will it make it more difficult (or even impossible) to filter the ...
0
votes
0answers
7 views

Probleme with updating struct through payable call with web3js. But works through remix

I have a function in my contract to which I want to send wei to, the contract should update the value in a struct and transfer the value to another address. Solidity code: function voteMeme(uint ...
0
votes
0answers
8 views

Problem with web3.eth.getBlock in console

I'm having some troubles to understand why my console.log do not work. I was working on ethernaut on level Coin Flip and I tried to get the given block object. My metamask works well. Do you have any ...
1
vote
1answer
18 views

How do you implement a “Micropayment Channel” in a Dapp?

I've come acrossed an article, Signing and Verifying Messages in Ethereum, where it says that you can pay for other user's gas transactions but so far I haven't seen any implementation or tutorial on ...
0
votes
1answer
9 views

How to code a Raw Txn using web3js?

I have this code which gives JSON error in web3. I tested the connections and reading the contract and that all works. There is something wrong with the "data" key in the JSON. Somehow the addBonus ...
0
votes
0answers
15 views

Updating the tx hash

Following is a snippet of my code (which is working) .... let txhash = ''; class App extends Component { .... }; async componentDidMount() { ..... } onSubmit = async (event) => { event....
1
vote
2answers
23 views

Unable to install web3 js for windows10

I am trying to install web3 using command npm install --save web3@1.0.0-beta.26 However, it is failing with error : verbose node v8.9.1 verbose npm v4.6.1 error code 128 error Command failed: ...
1
vote
0answers
26 views

Unable to deploy smart contract to rinkeby using ledger wallet?

I am trying to deploy smart contract using ledger wallet. But i keep getting the error cant subscribe to new header. However i get the transaction hash but cant receive the contract instance and ...
1
vote
1answer
21 views

Deployed Smart contract methods are not updating the value when restart the geth instance.Why?

Started Geth using following command geth --identity "testpvtnode" --rpc --rpcport "8545" --rpccorsdomain "*" --datadir <pvtnetdatapath> --port "30303" --rpcapi db,eth,net,web3,personal --...
0
votes
1answer
23 views

Ethereum web3 filter not found

I have a bug listed in many places: Error: filter not found when using a filter with web3. from https://blockone.thomsonreuters.com/docs/ It's important to note that, if you're using web3's watch ...
0
votes
1answer
33 views

Error while executing solidity contract from web3 client

I have a contract as follows - contract getSchwifty { string internal constant seeWhatYouGot = "I want to see what you got!"; string internal contestResult; mapping(uint=>string) Record; ...
0
votes
1answer
19 views

How to use infura with web3 to talk to remote ropsten node?

I understand we need mnemonic as we did use it in deploying contract with truffle so as to be able to send ether from our ropsten account private keys. I could not find a way use the same in my server....
1
vote
1answer
45 views

web3.js new accounts without local node!

I am trying to develop an dapp, but since I am running a small server (Windows Sever 2012 R2) with limited space I don't want to host/install an ethereum node, nor geth in my server, because as many ...
0
votes
1answer
27 views

Couldn't decode uint256 from ABI: 0x

I'm trying to get all Transfer events from an account of an ERC721 token, I'm currently struggling with the following error. I googled around but couldn't find much helpful things. I'm definitely on ...
1
vote
1answer
24 views

Defining the transaction object for offline transaction signing using “web3.js from the broswer”

I am trying to call a contract method ( a write operation ) and sign the transaction manually using my privatekey. The transaction hash is being generated but when I go to etherscan, the transaction ...
0
votes
2answers
30 views

Intracting with dapp using frontend truffle petbox

App = { web3Provider: null, contracts: {}, account: '0x0', init: function() { // Load pets. return App.initWeb3(); }, initWeb3: function() { if (typeof web3 !== 'undefined') {...
0
votes
1answer
44 views

How to interface with a deployed Ethereum smart contract?

I want to create an interface to interact with my smart contract. I have got an example from the following link. Counter Before implementing my contract, I have tried to use the given example.But it ...
1
vote
1answer
39 views

Get time when the transaction was included in your node

Is there any way to obtain the time when you have received a transaction? I would like to know when is a Smart contract included in my node. (local testnet)
2
votes
2answers
246 views

Is web3 completely decentralized?

I think web3 is not completely decentralized or safe to use. Consider the following example: I have made a voting Dapp on Ethereum. Now my smart contract will be on the Ethereum blockchain and my ...
1
vote
0answers
16 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.
0
votes
1answer
15 views

Using web3.js in a react redux saga app - uncaught at check call error

I am trying to use Web3.js (Ethereum JavaScript API) in a ReactJS app with Redux / Saga. This is my GetWeb3 function: const GetWeb3 = () => new Promise((resolve, reject) => { window....
0
votes
1answer
20 views

Uncaught ReferenceError: TruffleContract is not defined

I am working on a smart contract. When I try to serve my smart contract via lite-server I see following error in the browser console Here my app.js source code: https://pastebin.com/UjFuYCyQ I have ...
-1
votes
0answers
10 views

subscribe ethereum current transaction [closed]

I am using below code but did not get any success. web3socket.eth.subscribe('logs',{fromBlock:'pending',toBlock:'latest', address:'0xAD08C190Ed643ec60afBbAEB2E284F616F3C3b43'}, function(error, result){...
0
votes
2answers
22 views

Cors Error with Infura?

anyone else who tries to read smart contract data through Infura and process it on front-end but gets 'CORS' error? My DAPP works fine in Google Chrome and has no issue in fetching the smart contract ...
0
votes
0answers
11 views

why it takes web3.eth.sendSignedTransaction takes too much time/stuck to execute?

This is my transaction code. But the last line is stuck idefinitely without any reason. the sendSignedTransaction takes around 10 minutes and then exits!!! I cannot send transaction. I am using ...
3
votes
1answer
22 views

Can I get the raw transaction using Nethereum?

How do I get a raw transaction using web3/Nethereum? An example of a raw transaction can be seen here: https://etherscan.io/getRawTx?tx=...
1
vote
1answer
22 views

How to view and access the smart contract deployed by some other node in the Private Network?

If First node in the private blockchain deploys the contract and second node in the network wants to request data from that contract, then how the second node will send request to the smart contract?
0
votes
1answer
12 views

Geth Contract Deployment Error : Contract transaction couldn't be found after 50 blocks

I have created a private blockchain and tried to deploy a simple contract on blockchain. But the deployment throws the following error - Error sending/minig the transaction: { "message": "...
0
votes
1answer
105 views

web3.js token approve function show null / 0 in Metamask

EDIT The allowance is set, the issue is just that metamask detect no token name nor amount that is allowed. In my HTML/JS amount = parseInt(web3.toWei(amount, "ether" )); tokeninstance.approve(...
0
votes
1answer
15 views

Command “geth --rpcapi eth,web3,personal --rpc” throws Fatal Error

After deploying an private Ethereum blockchain with Azure Template "Proof of Work" we are not able to run the following command successfully. "geth --rpcapi eth,web3,personal --rpc" following image ...
0
votes
0answers
8 views

Cannot get Vue.js SSR to work with web3

I am running a vue.js application with a smart contract, the application works without errors on the development server, i can see my contracts - call functions, deploy contracts without an issue. ...
2
votes
0answers
15 views

How can we make sure we are connected to the provider?

I'm looking to connect to a WebSocket Provider, and intermittently I'll get an error saying: Error: connection not open [0] at WebsocketProvider.send Does a WebSocket connection contain ...
0
votes
0answers
16 views

'invalid JSON rpc response' when using 2 instances of web3 simultaneously : metamask and infura

I am basically trying to run two instances of web3 within the same app // metamask if (typeof web3 !== 'undefined') { web3.version.getNetwork((err, netId) => { switch (netId) { case ...
1
vote
1answer
29 views

Web3 Empty Object Server Side in Meteor

Created new --bare Meteor project (release 1.8). Used meteor npm install --save web3 to add web3 to the project from npmjs.org. In code server.js use: Web3 = require('web3') console.log(Web3) // ...
0
votes
2answers
175 views

Smart Contract Error: Returned values aren't valid, did it run Out of Gas?

Deployed a contract using Remix IDE to Rinkeby testnet. Etherscan contract address and code is here. contract SimpleCounter { int counter; constructor() public { counter = 0; } ...
0
votes
1answer
28 views

Geth/Remix Error: gas required exceeds allowance or always failing transaction.How to solve this issue?

I have tried to deploy the example given in the following link(using remix and geth).While deploying, an error occurred in both geth and remix. And I found that the usage of "require" causes the ...
0
votes
2answers
39 views

How do I get the return value of a solidity function with web3?

The docs mention using MyContract.methods.myFunction().call() .then(console.log); but methids methods I get the error then I get the error that the function is undefined. The code below doesn't ...
1
vote
2answers
52 views

Can a Contract ABI change?

I am developing an app that is using the etherscan-api package. I use it to get the contract ABI. The problem is that I retrieve it via the API every time the function is called. My question is: ...
1
vote
1answer
16 views

How to use web3js to put it in json?

I have used web3js by using it in the form of node(npm). But I don't know how to extract some data generated from nodes. Does anyone know this web3js so the results can be changed to json form? ...
0
votes
0answers
22 views

How to connect Quorum nodes with Remix?

I'm trying to use the Quorum-examples/7nodes to test my contract. I followed the step on github and open a terminal to attach to node1. https://github.com/jpmorganchase/quorum-examples/tree/master/...
0
votes
0answers
10 views

web3.js How can I know is any transaction erc20 transfer or not

in web3.js or geth rpc, Is there anyway to understand a transaction is erc20 transfer or not?
0
votes
1answer
21 views

Freezing ERC20 token for certain amount of time?

Is there any functionality like randomly specifying freezing portion and freezing period .For example, we must transfer 100,000 ERC20 tokens to a users. We transfer 10,000 tokens with no restriction, ...
0
votes
1answer
18 views

Estimation of gas in web3js 0.20

Q:- While sending only Ether One wallet to another wallet(NO SMART CONTRACT), do we need to define the default gas limit and price? i.e. 21000 * 3 OR 21000 * 4 OR 21000 * 5 etc Or I've need to use ...
0
votes
1answer
30 views

Deploy contract - have total supply but no token holder and balance

I deploy my contract to etherscan (rinkedby and etherscan). I have my total supply set but i can't see any in in network after deploy. I even copy the contract ceration code exactly from this ...
1
vote
1answer
20 views

Ethereum gas limit issue while sending transaction from web3 client (private network)

I have setup a private Ethereum system using geth. And am running a client that uses a web3.js file to connect to the Ethereum system. While trying to send a transaction or call some contract function,...
1
vote
1answer
14 views

Web3 (python) - confirming transaction hash format

Due to the fact, that I am storing txId obtained from the user, before determining whether transaction has been ended or not, I want to make sure that the transaction hash, which will be stored in my ...