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

0
votes
0answers
5 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
20 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
21 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
25 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
votes
0answers
24 views

Calling smart contract function that have parameters using web3 in javascript [duplicate]

Here is the problem I am having: //this is just a smart contract i just picked up from etherscan var c = web3.eth.contract([{"constant":true,"inputs": [{"name":"user","type":"address"},{"name":"token"...
1
vote
1answer
22 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
0answers
26 views

Can I turn any ethreum address to an account on the node?

I am planning to create an account in my client app using web3,I want to have the privateKey on the app too. is there anyway to propagate this address as an account on an Ethereum node?
0
votes
1answer
15 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
8 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
40 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
14 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
13 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
25 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....
0
votes
1answer
11 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 ...
0
votes
0answers
23 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 ...
1
vote
0answers
13 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
13 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.
0
votes
0answers
5 views

How to see the balance and users of a smart contract in front-end with web3.js

I have a contract deployed on the mainnet where you can get a daily percent by investing eth. After achieving 200% the contract deletes your address wallet with the option of starting a fresh ...
0
votes
1answer
17 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....
0
votes
1answer
24 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-...
0
votes
1answer
35 views

address.transfer not working

pragma solidity ^0.4.23; contract ApprovalContract { address public sender; address public receiver; address public constant approver = 0x5AEDA56215b167893e80B4fE645BA6d5Bab767DE; constructor() ...
0
votes
0answers
11 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 ...
0
votes
0answers
24 views

UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: “”

I have created an account using web3 in my private Network which is running at 8545 port, the code is shown below: > var Web3 = require('web3') undefined > var web3 = new Web3('https://...
2
votes
1answer
31 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("...
0
votes
0answers
31 views

Error while performing a sendSignedTransaction in Web3 js 1.0

This is my javascript code: I do get a response from the signtransaction but the sendsignedtransaction fails. I do not use meta mask for this project . My ganache version is 1.2.2 and web3js version ...
1
vote
3answers
46 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
48 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
11 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
26 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
48 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
26 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
14 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
39 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
46 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
38 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
27 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
47 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
27 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
42 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 ...
0
votes
0answers
16 views

Return Values in Remix vs. Web3JS

How does Remix return values from function calls compared to a call with Web3? Usually they return the same (as they should), but when I want to return a string[] (it's still an experimental feature, ...
1
vote
0answers
11 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
1answer
65 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
35 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
29 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
13 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
58 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
31 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
27 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 ...
1
vote
2answers
34 views

web3 - call a variable, wait, get variable, wait, loop, get vars in loop, wait and do action [closed]

In my contract there are 2 functions, the first one returns an array size and other one returns data from the array with index passed as a parameter. In my web3 script I'm trying to read array size ...
2
votes
1answer
59 views

Web3JS incorrect return value

When I return a string array with web3 I don't get the original array as expected, but rather I get an array of the same size, with the index off by one. So instead of ["One","Two","Three"] I get ["",...