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

2
votes
0answers
23 views

Can I send transaction to a view|pure function?

This is the contract: uint public result; address public owner; constructor() public { owner = msg.sender; } function add(uint a, uint b) public returns(uint) { result = a + b; return ...
0
votes
1answer
53 views

web3.eth.getBalance(…).then is not a function

var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/5db0a2fb8a8948fdbe57bb19eecb5674')); web3.eth.getBalance('...
1
vote
0answers
13 views

Web3JS throws InvalidResponse without Ganache core ever receiving a request?

Versions: Ubuntu 18.04 LTS Node.JS: 8.3.0 WebJS: web3: ^1.0.0-beta.37 web3-utils: ^1.0.0-beta.36 npm: 5.6.0 Truffle version 5.x (latest) I have traced through the HttpProvider code in the Web3 ...
0
votes
1answer
32 views

what is the equivalent of encodeFunctionSignature for web3.js version ^0.20.6

I want to check if a specific contract deployed at an address is an erc721 contract. I found out that most of the erc721 contracts should have safeTransferFrom function implemented. (except ...
1
vote
1answer
20 views

truffle web3 synchronous request problem

Error: Web3ProviderEngine does not support synchronous requests. That's what I get when I use the following command from Truffle Console: truffle(ropsten)> web3.eth.getBlock('latest').then(...
1
vote
1answer
86 views

Recently upgraded Solc and Web3. Transactions with zero addresses now reverting with “invalid address” message?

I recently upgraded Web3JS and Solc. Now every time I pass a zero address to a Solidity contact method the transaction reverts with an "invalid address" message. This message appears to be coming ...
1
vote
0answers
27 views

Metamask and web3 wrong behaviour when extension is disabled

Basically I have a dapp that gets the web3 object from window.web3 (the injected from metamask). When i disable de extention from chrome (not removing, just disabling) the web3 invocations are ...
1
vote
2answers
47 views

Payable function with additional value attached (web3, React)

I'm making a React frontend for an open-source blockchain protocol for tokenized hedge funds. So the question is how to provide the payable function that requires some other value attached (n this ...
1
vote
1answer
19 views

is there any method convert mutiple params to one bytes in web3js ,and then get these original data from bytes in solidity?

eg: the params in js code below,how to convert to one bytes var min=100; var max=100000000000; var price=1000000000000000000000000000; var name="john"; in solidity code below,how to get original ...
0
votes
2answers
32 views

How to backup POA based ethereum private blockchain and restore it in a fresh new environment

Is there a way to backup the POA based ethereum private block-chain [created from microsoft azure POA template] and also restore it in a all new environment with out loosing any transactions & ...
1
vote
0answers
34 views

Finding total transaction count (confirmed + pending) using web3.js [duplicate]

I am using web3.js version 0.20.6. I want to find the total transaction count so that I can set my nonce correctly. Currently, I am calculating the number of transactions in the following manner: ...
2
votes
1answer
44 views

contract sendTransaction does not return transaction hash

I just started with truffle react box.. and i changed a little bit to : const tx = await instance.set.sendTransaction(999,{from : accounts[0]}); console.log("tx is on the way : ",tx); const txReceipt ...
1
vote
1answer
37 views

Installing web3

I was struggling with this problem for couple days, who know how to fix that ? Win7 C:\Users\Administrator>npm install web3 npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with ...
0
votes
1answer
22 views

Issues while sending raw transaction for calling smart contract methods?

let provider_url = "https://ropsten.infura.io/v3/d5bca90ec3084aee8abd468fdf876a11"; this.web3Provider = new Web3.providers.HttpProvider(provider_url); window.web3_ = new Web3(this.web3Provider); ...
0
votes
1answer
16 views

Whether scatter can be used to replace web3?

Whether I can use scatter instead of web3 metamask? In this way I do not need to add the metamask add on on my browser? And I can run the dapp on mobile for scatter because metamask does not support ...
1
vote
0answers
42 views

Metamask mapping calls receive inconsistent return

Below is my js function that takes an array of orderId and call them one by one - to get the creator address and go on. It is chained in a series of promises with similar Ethereum smart contract ...
1
vote
2answers
27 views

web3 - function returning new contract's address

I have a factory contract which has a function which returns a new contract: contract AddOrRemoveAdminVotingBuilder { function build( address pPlatform, address pAdminManager )...
0
votes
1answer
16 views

Metamask does not react on delivering gasPrice

I am using following code to generate a new transaction using web3.js & metamask: var web3dictdata = { gasPrice: web3.toHex(10), gasLimit: web3.toHex(210000), to: "...
1
vote
2answers
33 views

Making transactions and don't waiting for response [closed]

Is there a way to submit a transaction and don't wait for it to be confirmed or rejected? Because now when I run my nodejs script it does not stop to run until the transaction is confirmed or rejected....
1
vote
1answer
16 views

Metamask Web3js Synchronous Method Error

Okay guys, I'm a complete newbie to Ethereum and Web3.js and going through the Crypto Zombies tutorial and have done okay so far. But, when I use this function in my index.html file as they show it I ...
1
vote
0answers
38 views

window.Web3 is missing in Mist

When I open the below HTML code in Mist 0.11.1 the popup shows empty that is window.Web3 is undefined! How to make window.Web3 to work in Mist? My code similar to this works in MetaMask but not in ...
2
votes
0answers
42 views

Transaction not mined error when deploying to quorum maker server

I get the following error when attempting to deploy my zeppelin erc20 token to a quorum server(used quorum maker). (master) $ node migrations/2_proj.js ``````` transactionHash ...
2
votes
1answer
32 views

How to get amount of ERC20 tokens sent in tx from tx hash? (Web3.js)

I have tx hash and I would like to see how much ERC20 tokens was sent in this transaction. How can I do this with web3.js? Thank you.
1
vote
1answer
20 views

Get TxId after send with metamask

I'm using web3 1.0 beta, and I'd like to get TxId before it's mine I find a lot answer with sendTransaction, but If I use it I get sendTransaction is not a function My code is like this: c.istanza....
1
vote
1answer
33 views

Truffle Assert with Truffle Beta

I just updated to Solidity 5 and Truffle Beta and am testing my contracts in JavaScript. I am trying to test my constructor events and want to use as per truffle-assertions documentation : truffle-...
1
vote
1answer
186 views

address.transfer not working

pragma solidity ^0.4.23; contract ApprovalContract { address public sender; address public receiver; address public constant approver = 0x5AEDA56215b167893e80B4fE645BA6d5Bab767DE; constructor() ...
1
vote
0answers
20 views

error in WebSocket connection

error : browser-sync-client.js?v=2.26.3:15 WebSocket connection to 'ws://localhost:3000/browser-sync/socket.io/?EIO=3&transport=websocket&sid=mW3 please i need help on this. i was getting ...
2
votes
1answer
52 views

web3.eth methods in remix console don't work

I was working with one of my contracts in remix, running in javascript vm environment. And i just had to check the balance of my contract. when i tried this in the console web3.eth.getBalance("...
1
vote
3answers
84 views

contract methods undefined

I am quite new with javascript web3 so don't be judge too hard. I am using web3 version 1.0.0 beta. I am taking the web3 reference this way: if (typeof web3 !== 'undefined') { // If a web3 ...
1
vote
1answer
54 views

Getting an error while trying to store large payloads (13-20kB)

I've created a simple smart contract to store large amounts of data (13-20kB) on the Ethereum blockchain. But when I'm trying to make a transaction they fail sometimes (with little correlation to the ...
1
vote
1answer
16 views

Error while generating Mnemonic

I want to generate Mnemonic for creating an account, I was using the following code and I got the error as TypeError: Cannot read property 'entropyToMnemonic' of undefined I am sure I am missing ...
0
votes
1answer
30 views

Get lastest input transaction of the account

I am trying to get the recent IN transaction of the account while i try web3.eth.getTransactionCount("0xF092966e7bcc2b5646e0F0c20A715584DB37cd4B").then(function(trans){ console.log(trans); }); ...
0
votes
2answers
58 views

Gas issue on sendRawTransaction on the rinkeby network

I'm facing a gas issue on rinkeby network on sendRawTransaction. Tested with various gas value to experiment and getting either insufficient funds for gas * price + value or exceeds block gas limit. ...
0
votes
1answer
31 views

How do you get the UTXOs a transaction is spending using web3.js?

I'm unsure how to get the UTXOs that a transaction is spending. Here's what I have so far. I get transaction details from txhash web3.eth.getTransaction("...
0
votes
1answer
17 views

Refill Ether to account after token transfer

During token creation and token transfer some ethers are used as gas. What is the most efficient way to refill an account with the same amount of ether? So that it doesn't run out of funds(ether). I'm ...
1
vote
3answers
42 views

Sending signed transactions

I want to call an action on a contract that is deployed on rinkeby test net. But transaction confirmation seems to take forever and I can't find it on rinkeby etherscan. Is there something wrong with ...
1
vote
2answers
53 views

Why is browser taking so long to read blockchain data?

I have a dAPP and I use reactjs for the frontend. The application returns data from a smart contract (the balance) on the homepage. The main problem that I notice is that everytime I or any other ...
1
vote
2answers
60 views

What is the difference between the transfer and transferFrom function in an ERC721 contract

Using web.js, I am trying to transfer erc721 tokens across different addresses. In case of cryptokitties, I can do the transfer using transfer function only while in case of cryptoheroes, I can use ...
-1
votes
1answer
30 views

Creating ethereum accounts and getting private keys on the same time in web3js

I want to create an account using web3js and I need to the accounts private key in the same script. Are there any npm packages or web3 commands that would let me do that? An example of what I would ...
1
vote
3answers
82 views

infura vs Eth Node [duplicate]

I want to connect web3 services with public Ethereum (main net/test net) to execute my smart contract method. Which is better Infura or to create my on Node? Please suggest.
0
votes
1answer
32 views

TypeError: ajtokenSaleInstance.tokensSold is not a function

I am following this tutorial on youtube "Code Your Own Cryptocurrency on Ethereum (Full)" i stuck at one of the part where i am trying to return the value of TokensSold but i keep on getting error as ...
1
vote
0answers
46 views

What is the best secured way to let users interact with a tokens minting function?

I have an ERC20 tokens contract with a function to mint tokens. This function allows users to mint tokens after performing specific actions or activities on a website. If a user performs the action ...
1
vote
0answers
23 views

How to connect REACT-NATIVE with whisper ethereum protocol using GETH or any light Client or API

is there any thing connect to whisper(web3.shh) protocol in react-native. How to connect REACT-NATIVE with whisper ethereum protocol using GETH or any light Client or API
0
votes
2answers
142 views

how to install web3 (1.0.0)?

I have 0.20.0 installing but not the default 1.0.0. I have Ubuntu 18.04 installed. Is any special config needed for Ubuntu 18.04 when installing web3 (1.0.0)? trevor@bridge2:~$ sudo npm install ...
1
vote
1answer
88 views

using ERC token to login website [closed]

recently I want to write some website login program using ERC tokens ,can anyone show me the way to do that ? an idea or a route are both good for me
1
vote
1answer
33 views

Web3 method call returning unexpected value with certain smart contract setup

I have tried to implement a persistent data storage with smart contracts as seen with the following code (this is an example that mimics what my actual code does). I have a data storage contract with ...
3
votes
0answers
23 views

How to access txpool pending transactions using Netherum?

I want to get list of transactions which are in pending state & queued state in txpool. I can see these transactions in pool using txpool.inspect command. I tried code given in nethereum sample ...
1
vote
1answer
103 views

error sending signedTransaction, Error: Transaction has been reverted by the EVM:

i have an error after i send signedTransaction always return error node: (node:16924) UnhandledPromiseRejectionWarning: Error: Transaction has been reverted by the EVM: { "blockHash": ........ ...
1
vote
0answers
35 views

solidity state variables lost after web3 connection reset

I setup an Ethereum 2 node system using geth and implemented a web3 client that talks to the 2 nodes. what it looks like: Node A, Node B I have a EthereumClient JS file where I start 2 web3 clients ...
2
votes
2answers
30 views

Make Smart Contract Only Accessible from a Web App

I have got a Solidity smart contract which only interacts with a React front-end using web3. I want to restrict access to the smart contract so that only the React front-end can access the smart ...