We’re rewarding the question askers & reputations are being recalculated! Read more.

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

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

hdwallet-provider set multiple account addresses when deploy contract

I'm using for deploying contracts hdwallet-provider, but I have issue on client side to get multiple accounts using web3.eth.getAccounts() call. I know this is like duplicate question and truffle ...
0
votes
1answer
17 views

Need help: Error: Transaction has been reverted by the EVM:

Could anyone point me at what is the problem here? I tried to send ERC20 tokens by using ERC20 trasferFrom function. I have executed a sendSignedTransaction and got an error as follows: Error: ...
1
vote
1answer
30 views

error in remix IDE

I am facing this type of Error in 'remix IDE' while connecting it to 'web3.js@0.20.2' Error: Failed to decode output: Error: insufficient data for uint256 type (arg="", coderType="uint256", value="...
0
votes
0answers
9 views

A Long list of WARNING Messages for Web3 install

I am trying to install web3 on my computer to build an app, and I get a very long list of WARNING messages... can someone tell what they mean? npm notice created a lockfile as package-lock.json. You ...
0
votes
3answers
20 views

web3.eth.contract not working

I have web3@0.20.2 installed using npm . when I call web3.eth.contract() it says that it is not a function and when I use new web3.eth.contract it says it is neither a constructor. This is my code &...
0
votes
1answer
12 views

Installing Web3 stuck on fetchMetadata: sill resolveWithNewModule http-https@1.0

I am trying to install web3 for ethereum but it keeps sticking on this fetchMetadata
0
votes
0answers
32 views

Infura API: getPastLogs times-out, even when there are less than 2500 records

I would like to receive all event logs for a particular topic of an event log. I know there is a limit of 10,000 records, but the getPastLogs function times-out when less than 2,500 records need to be ...
0
votes
1answer
15 views

Truffle Contract Abstraction Contract.at() not returning logs when methods are called

In my test file I have this set up: let acc = await Account.deployed() Then when I call a method, I can get the logs in the receipt: let deposit = await acc.deposit() console.log(deposit.receipt....
0
votes
1answer
14 views

How to know the execution time of transaction when miner execute it

When i send three consecutive transactions to my contract (deployed on ethereum testnet), how can i know the exact time (at milli/micro/nano level) which transaction executed (on miner side) first and ...
0
votes
1answer
29 views

Incorrect bytes32 to string conversion

My solidity function is returning a bytes32[] which I am looping in Javascript and converting to string using web3.toAscii(). Printing this in console shows extra � characters at the end as shown ...
1
vote
2answers
36 views

Emit of boolean returns “null” instead of “false” (Solidity, web3.js)

A Solidity event is supposed to emit a boolean. In case of won = true the transaction receipt in web3 logs true as expected, but if won = false the emit logs null instead false. I have no idea why. ...
0
votes
3answers
33 views

Web3.Utils - WeiToEth and EthToWei Conversion choking on decimals

I have the following two helper functions. It was based on a course I'm going through, so I didn't think I would have to debug them. I don't understand why it works with whole numbers, but not with ...
0
votes
2answers
23 views

Calling smart contract functions and submitting transacions in BACK-END in high level

I have read some references to create ethereum transactions by a BACK-END server, all in low level, for example, requiring that I control the nonce by myself. Are there safe ways to avoid this control ...
0
votes
0answers
17 views

web3.eth.subscribe('newBlockHeaders'): Cannot read property 'id' of undefined

I have this error when using web3.eth.subscribe('newBlockHeaders', (error, blockHeaders) => {...}) I put try/catch everywhere I could, but I still have this: UnhandledPromiseRejectionWarning: ...
0
votes
1answer
23 views

Get Contract Address by It's ByteCode

I have some bytecode and would like to find the contract address that it belongs to. Is there an easy way to do this?
0
votes
1answer
21 views

Transaction values exchanged even if transaction rejected, and double values exchanged if transaction confirmed

I'm trying to perform a function that exchanges one token for another, but I'm getting a very strange bug. If I call the function in web3, I get the standard metamask popup asking whether to confirm ...
0
votes
1answer
15 views

Can I call a contract function in the “data” element via web3, especially when I am using conversion to bytes?

In other words, say In Python I have something like that: signed_txn = w3.eth.account.signTransaction(dict( nonce=w3.eth.getTransactionCount('0x0000000000000000000000000000000'), gasPrice = ...
1
vote
2answers
43 views

How to know if transaction is failed due to insufficient balance?

I want to know if it is possible to know from "error" object returned by geth that the error it was due to insufficient balance (something to compare with) I have a js code like that: mycontract....
0
votes
0answers
17 views

ERR_INVALID_ARG_TYPE when exporting/setting Private Key using code Buffer.from(process.env.PRIVATE_KEY_1, 'hex')

I'm getting the following error: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined From the ...
0
votes
1answer
20 views

What's the difference between the typical ERC20 Transfer(from, to, value) and the same but with bytes, e.q.: Trasnfer(from, to, value, msg.data)?

Better question: Can I send the bytes to a function that lacks this definition? In other words, say I have: event Transfer(address,address,uint256, bytes); And then: function transfer(msg....
-1
votes
0answers
28 views

How can I decode the logs same as ropsten.etherscan.io, which can resolve the logs error?

The execution result is at https://ropsten.etherscan.io/tx/0x92377cb678fa3f5ef19fc8f3189b76a4e3587090a6d027eab10de83fc6a07986. The following code give me "(node:2378) UnhandledPromiseRejectionWarning:...
0
votes
1answer
36 views

Calling contract from contract not working

below are very simple setup of one contract calling another contract and I somehow can't get it to work. Contract C1 pragma solidity ^0.5.0; contract C1 { int public x = 1; function setX(...
0
votes
0answers
32 views

Incompatibility issue of solidity 0.5.12 (or perhaps ^0.5) with web3 js v1.2.2 or with Geth v1.9?

Is there any incompatibility issue of solidity 0.5.12 (or perhaps ^0.5) with web3 js v1.2.2 or with Geth v1.9? Because a contract in v0.4.24 works perfectly with given web3 version and Geth version, ...
0
votes
1answer
23 views

How to return the result of a Solidity view method from a javascript function?

I want to determine a view function of a smart contract result in web3js 1.x Suppose we have a view function getName(uint code) and want to get the name of a person having his code. So we write: ...
0
votes
2answers
15 views

How to get the result by parsing the log after executing the contract? How can I get the execution result?

How to get the result by parsing the log after executing the contract? How can I get the execution result ?
0
votes
0answers
21 views

SendSignedTransaction is not sending tokens

I tried to use sendSignedTransaction function, it signed and sent the transaction successfully(i think), but it's not transferring tokens as it ought to. It's basically not doing the intended task 😔 ...
1
vote
1answer
38 views

Generate new address, Send and Get transaction then Check transaction

I'm just starting in the ethereum and trying to build an app using Web3 and Nodejs. I'll need your lights so I can get any idea to know how to resolve those points: I have my own public address and ...
0
votes
0answers
19 views

Can't include web3 & truffle in chrome extension

I'm trying to include web3 & truffle in my chrome extension. In npm, I'm doing it this way: const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); ...
1
vote
3answers
42 views

Basic question I guess but is “web3” a client in the sense that I want to use a very simple client to interact with the network?

Long story short I need a way to send programmatically a raw transaction without any bounds checkings or any checks...now I am not trying to abuse or flood the network - my goal is to attempt to send ...
0
votes
1answer
44 views

smart contract is too smart: different bahaviors of smart contract on different version of geth or solidity

recently I am learning how to deploy and call smart contract on ethereum. I am working on a very simple contract as follows: pragma solidity >=0.4.24 <0.6.0; contract TestContract{ uint ...
0
votes
0answers
14 views

How do i set up a BatchRequest looking for the last 10 blocks?

const fetchBlocks = async () => { try { const { ethereum } = window; const web3 = new Web3(ethereum); await ethereum.enable(); ...
0
votes
1answer
28 views

How dangerous the 'short address' attack is as of 2019, October and what ways there are to mitigate it?

From what I read there's a well public knowledge of reantrancy and underflows/overflows due to the cases of documented hacks and stolen ether - yet the short address attack seems less known. I know in ...
0
votes
2answers
29 views

Is there a way to create double-spending transactions and submit them to different nodes?

I'm trying to create two transactions with the same nonce and send those transactions to two different nodes. Such as: const Web3 = require('web3'); const web3_1 = new Web3(rpcURL1); // node 1 const ...
0
votes
1answer
41 views

Getting “gas required exceeds allowance (93846700840810) or always failing transaction” on private network. How to access geth client via nodejs?

I have recently started using Ethereum. I am trying to test my contract using multiple machines. Only solution I found was to setup a private network using Geth and add peers. Following is the genesis ...
0
votes
1answer
25 views

Contract deploy error with Cannot create property 'from' on string

I am getting this error, when I deploy contract by using web3. TypeError: Cannot create property 'from' on string '...
0
votes
1answer
49 views

Web3js - Internal Transaction Data (Event Logs): Token Transfers, Contract Creations, & Internal ETH Transfers

I'm currently recording transaction data via Web3js, while directly connected to a local Geth full archive node via IPC, and I was wondering if there was a more elegant way to record internal ...
0
votes
1answer
31 views

Erc20 address generation

Can someone tell me how it is possible to implement the generation of unique erc20 addresses for registered users?
1
vote
1answer
39 views

Web3js & Web3.py ERC20 Name, Symbol, & Decimals call(): Results in Web3.exceptions & OverflowError for Some But Not All Existing Contracts

I'm building simple Javascript & Python 3 scripts using the Web3 module to output ERC20 token names, symbols, and decimals from any given contract address. The standard ERC20_ABI json file was ...
0
votes
1answer
30 views

How to execute contract methods without metamask confirmations?

I would like to know if there is a way to execute my contract methods without requiring the confirmation of metamask. I found something web3.eth.sendSignedTransaction but can't seem to figure out ...
0
votes
0answers
20 views

fallback function using Relay contract with delegate call in web3js not working

I have checked all over the stack but I am still unable to call the delegate function properly in Relay contract which supposed to call its fallback function. I am using solidity version ^0.5.0 I ...
0
votes
1answer
28 views

invalid solidity type

solidity 0.5.0 web3@ 0.20.7 In my contract.There's a function (view) returns a struct type. When I used web3.js to call this function, I got "Error: invalid solidity type!: tuple". I know that this ...
0
votes
1answer
31 views

How to build security into Dapps?

I am building a loan dapp. The functionality is not easy to build but relatively straightforward. My question is though does anyone have any suggestions of how to build in user logins and security? ...
0
votes
0answers
16 views

How do a set cookie for a Dapp's front end and pass the information to blockchain?

I am trying to look up documentation on setting up cookies for my dapp using web3 but I am unable to find resources. Can I just use js functions like setCookie and getCookie as one would do for a ...
1
vote
0answers
35 views

Ganache is not showing any events

I have a contract method which emits events but ganache seems not to catch any events. I say this because when I deploy my contract on ropsten the events are being caught fine but only in ganache I ...
0
votes
1answer
22 views

getPastEvents on localhost is not a function error

Now, I'm working on an Ethereum Blockchain project to transfer the ownership of stored devices by using local web3 provider at the truffle environment. Truffle v5.0.27 (core: 5.0.27) Solidity v0.5....
-1
votes
1answer
11 views

I want to create a account on blockchain using web3swift in IOS app, but I am new on blockchain don't know how to do. Please can anyone help me out?

I want to create an account on the blockchain using web3swift in the IOS app, but I am new on blockchain don't know how to do it. Please, can anyone help me out?
0
votes
1answer
26 views

How can I implement redactable chain for ETH?

I am trying to research about Redactable blockchain so my question is how can I implement a Redactable chain in Eth if someone has some idea about it I will be thankful
0
votes
1answer
32 views

How to choose wallet with web3

I have MEW and Metamask installed. When I am trying to send a transaction using: web3.eth.sendTransaction() It always uses Metamask. May I know how can I specify I want to use MEW instead?
0
votes
2answers
94 views

Truffle - Get ETH Balance with Web3JS - two different errors

Using "web3": "1.0.0-beta.46" because doing a tutorial, and they recommended using all his versions to make sure everything works together. Using Gnache and Truffle unit tests, I have tried two ...
0
votes
2answers
51 views

Sign message with web3 and verify with openzeppelin-solidity ECDSA.sol

I'm trying to get a little example working with ECDSA.sol here: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol This contract: Generate a random(...