Questions tagged [web3js-v1.x]

For questions specifically about version 1.x of the web3js Javascript API and library for Ethereum

Filter by
Sorted by
Tagged with
1
vote
2answers
25 views

Insufficient funds when transferring ERC-20 token using web3

I am trying to send an ERC-20 token on Mainnet using web3 v1.x and Infura. I get the error in the title while executing this code. I have a balance of about 0.14 ETH var provider = new ...
1
vote
2answers
21 views

How to provide data for sendTransaction using web3.js 1.0

I'm using web3.js 1.0. I want to use sendTransaction method to call a contract method, but I don't know how to provide data parameter for it. For example suppose we have a contract named myContract ...
0
votes
1answer
35 views

Transaction being reverted by EVM during contract creation (Web3 / ethereumjs-tx)

Hey guys I am running into an issue deploying a smart contract with Web3 to the Ropsten network. The code is running seemingly correctly, and there is a contract address being created, but if I check ...
0
votes
0answers
14 views

subscriptions in Geth or Parity

I am trying to get the way to register subscriptions to events, with the services of QuikNode I can do it without problem and it is working perfect, but I am trying to raise a node --light with geth ...
0
votes
1answer
24 views

Web3 balance is showing OmiseGo balance but not Bitball

You can see on Etherscan that I have 2 types of tokens in my wallet: https://etherscan.io/address/0xb8fd65fc6919c5b97453eaba6b895144597985b2#tokentxns 2.3 OmiseGo and 10,000 Bitball I have a short ...
1
vote
1answer
168 views

Web3 CDN error: regeneratorRuntime is not defined

When I include the web3 js CDN to my html file, I receive this error web3.min.js:1 Uncaught ReferenceError: regeneratorRuntime is not defined at Object.<anonymous> (web3.min.js:1) Here is ...
0
votes
0answers
24 views

invalid JSON RPC when using custom domain name

geth --testnet --networkid 3 --syncmode "fast" --datadir "." --cache=2048 --rpc --rpcport 8545 --rpcaddr example.ropsten.hk --rpcvhosts example.ropsten.hk --rpccorsdomain "*" --rpcapi="web3,miner,...
0
votes
1answer
158 views

problem connecting web3 v 1.2.1 with metamask : 'currentProvider' of undefined

I am using Web3 v1.2.1 with nodejs v10 and following this link. I am having issue connecting with metamask,below is my code snippet: const Web3 = require('web3') const window = require('window'); ...
2
votes
1answer
83 views

Which version of web3 shall i be using now?

I found the documentation of version 1.0.0 which was released on the 6th of August here. I was told that v1 is not stable and very different than earlier versions. But when i check the available ...
0
votes
1answer
40 views

Where Do I Find web3.min.js for Beta 55?

There is this issue on github (among several other duplicate complaints): https://github.com/ethereum/web3.js/issues/2623. There is also this stack question: How can the web3 library be imported in ...
0
votes
1answer
61 views

Why Web3 event callback fires multiple times same as the number of the solidity smart contract emitted that event in past?

I am just learning, solidity with react and web3 and I am facing the issue on page load the callback event of web3 called multiple time the number is same as I called a solidity function and that emit ...
0
votes
1answer
40 views

How does .on work in Web3 1.0, and why do I get duplicate results?

I don't understand what .on event handler does in Web3. Take this example for signing a transaction: web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')) .on('...
1
vote
1answer
38 views

How do I asynchronously wait for Contract.events.MyEvent data to be returned in Web3 1.0?

The documentation is sparse, and the examples all mix async, arrow callbacks, and promises. One problem I've run into is while subscribing to an event, I can't seem use asynchronous syntax within or ...
3
votes
2answers
75 views

What happened to the official documentation of web3.js v1.0?

It should be at https://web3js.readthedocs.io/en/1.0/, but now I'm getting this: Does anybody happen to know why this wonderful tool has been taken off line?
0
votes
1answer
56 views

How Do You Parse Web3 Retuned JSON Objects of Events?

I am using Web3 1.0 to listen to events from a contract like this: tokenContract.events.AddressList({ fromBlock: 6020474, toBlock: 'latest' }, (error, events) => { ...
0
votes
1answer
19 views

Does web3.eth.wallet.create set the newly created wallet file as the 'global' source of addresses for the web3 instance?

I'm playing about with web3js@1.0.0-beta.55 and I'm setting an HttpProvider on Ganache for my web3 instance: this.web3Instance = new Web3(new Web3.providers.HttpProvider(environment.ethereum.provider)...
0
votes
0answers
38 views

How to get web3.eth.getPendingTransactions on JavaScript?

I read in the official document for web3js v1 https://web3js.readthedocs.io/en/1.0/web3-eth.html#getpendingtransactions getPendingTransactions web3.eth.getPendingTransactions([, callback]) ...
0
votes
1answer
89 views

miner.start() is not a function?

"web3": "^1.0.0-beta.37" "web3": "^1.0.0-beta.55" import {Miner} from 'web3-eth-miner'; then const options = { defaultAccount: "0x78dB3e2129D58685444989dD9682DDDC70dd3C82", ...
0
votes
0answers
39 views

How to get the value from the frontend form and save value to the blockchain using +web3 1.0.0-beta.37 + reactjs

I am writing my first Dapp and want to save the value of the form to the blockchain. I am Using React and web3 js 1.0.0-beta.37 on the frontend. Also I am new to react. Following is my App.js ...
1
vote
2answers
120 views

Why web3.version.api shows undefined for web3 1.0 and not undefined for web3 0.20.3?

I'm trying to use MetaMask and web3js to talk to my smart contract. Below are my test codes. This is without defining a web3 js file and I get the result "0.20.3" at console. <script> window....
0
votes
1answer
64 views

What's the difference between web3.eth.personal and web3.eth.accounts?

I noticed that web3.eth.personal has unlockAccount method but not web3.eth.accounts. Why not? Is web3.eth.personal for personal or single account use while web3.eth.accounts for multiple accounts?
0
votes
2answers
114 views

web3 1.0 events never fire

First off, my setup. System: ArchLinux Ganache: v2.0.0 (correction, v1.3.1) Solidity: 0.5.8 web3: 1.0.0-beta.37 (anything higher than 37, contract wont deploy) Node: 'latest' Some background and ...
0
votes
2answers
972 views

SyntaxError: await is only valid in async functions and async generators in web3js

Below is my code snippet. I wish to wait for the transaction hash value so that I can return my Javascript function with the hash value. But I get the error "SyntaxError: await is only valid in ...
0
votes
0answers
60 views

Problem with send method in Infura

Newly Infura site has been changed its interface. Before that all methods of our client program was successfully working, but now when I logon to Infura, all whitelists has been removed. I added our ...
1
vote
1answer
33 views

using web3 1.0 for approving signed transaction before appending to the blockchain

I am making a dapp using web3 1.0. I have a contract that stores medical data for every patient (represented by account). Their medical data can be set by doctor (account address) using the set ...
1
vote
1answer
101 views

Cannot deploy contract

I'm having difficulty deploying a solc-compiled contract to ganache test network using web3. package.json { "name": "smartinvoice", "version": "1.0.0", "description": "", "main": "index.js", ...
0
votes
1answer
97 views

Unlocking account web3.js 1.0 on AWS Lambda

I'm getting following error message when trying to unlock account on AWS Lambda: Error: Node error: {"code":-32601,"message":"The method personal_unlockAccount does not exist/is not available"} ...
0
votes
2answers
31 views

timed transactions using web3-1.0

I am creating a dapp using web3-1.0. I have a contract that stores personal data for a particular user(account). I want to implement a functionality so that a user can share his data (stored in the ...
0
votes
0answers
176 views

Error: Invalid bytes string given: 0x

Contract code: function getAddressDnaIds(address owner) external view returns(uint256[]) { return addressDnaIds[owner]; } Code causing the error: var dna = await this.airdrop.methods....
1
vote
3answers
323 views

How to check if the address is an ERC20 contract?

edit) VM execution error was a bug on Web3, confirmed my code works fine. I am trying to fetch random addresses from blockchain and trying to categorize them if it is an ERC20 contract address or not....
2
votes
1answer
84 views

Clarification on “password” argument for web3.eth.personal.sign

Context: I'm fairly new to web3, and as we all know it's developing quite regularly. I'm working towards a "sign in with Metamask"-type functionality using web3@1.0.0-beta.46. Most of the docs/...
0
votes
1answer
66 views

Web3 .call not returning “valid value”

Low level function calls work in Truffle, Solidity is not the problem. Other method invocations are working with the JS and HTML. This is my first attempt at using .call instead of .send; I am not ...
0
votes
1answer
535 views

How to deploy a smart contract using Infura and web3js@1.x.x on NodeJS?

I have an application written in NodeJS that each time it starts has to deploy a smart contract. Once the contract is deployed this application will interact with it making some transactions and ...
0
votes
0answers
76 views

Unable to transfer token from one personal account to another

I have created two personal account on private blockchain with geth. This is the balance of one account web3.fromWei(eth.getBalance(eth.accounts[0]), "ether"); 100000000000 And this is of the ...
0
votes
1answer
91 views

how to find if a Tx hash is in pending state in ethereum mainnet after web3j fastTxMgr timeout

I am using QueuingTransactionReceiptProcessor() with callback accept(). DEFAULT_POLLING_ATTEMPTS_PER_TX_HASH is 10 and POLLING_FREQUENCY is 15000. That gives nearly 3 min wait for network to ...
1
vote
0answers
161 views

using events in private blockchain raises leveldb not found error

i'm getting { [Error: Node error: {"code":-32000,"message":"leveldb: not found"}] when trying to use events on a private eth blockhain. What might be the problem? (I've installed Leveldb with brew) ...
0
votes
1answer
193 views

UnhandledPromiseRejectionWarning: Error: “gas” is missing

How can I catch exception thrown by method call? (async () => { try { const contract = await MyContract.deployed(); const gasPrice = await web3.eth.getGasPrice(); contract....
0
votes
1answer
474 views

Contract.methods.transfer is a not a function error using web3

Running something simple as this: Contract = new web3.eth.Contract(this.contractABI, this.contractAddress) Contract.methods.transfer(toAccount.address, transfferAmount).encodeABI() Gives me ...
1
vote
1answer
39 views

Scope in events in web3 1.0 [closed]

Inside the callback of an event, how do I get the scope outside the function? Specifically, in the following scenario, I want the web3 object: (using truffle-contracts and web3 1.0 here) ... const ...
0
votes
1answer
221 views

How to get private key with web3 v0.2.x?

web3 version 1.x has the decrypt method, which decrypts a keystore v3 JSON. By using it the following way, I can get the private key easily: web3.eth.accounts.decrypt(keystoreJsonV3, password); But ...
1
vote
0answers
148 views

web3js 1.0 fromWei throwing although passing correct type

I have encountered a problem with the web3js 1.0 library. I have a simple function that is getting a balance from a smart contract: async balance() { return await this.Marketplace.balances(this....
1
vote
1answer
27 views

How can I create a copy of an existent contract in Javascript ?

I'm trying to create a copy of an contract existent contract using web3.js 1.0. I'm trying to use the functions clone and deploy but without success. contract2 = contract1.clone(); ...
0
votes
1answer
1k views

How to connect web3.js 1.0.x to Metamsk

I am using web3.js 1.0.0-beta.36 to connect to the blockchain. But unfortunately this code cannot connect to Metamask, if it has been enabled. var metamask = false; if (typeof web3 !== 'undefined') {...
1
vote
1answer
21 views

Issues connecting Web3js to local testnet

I am trying to connect web3 to a testnet running locally. I am using the following code var web3 = new Web3(Web3.givenProvider || "ws://localhost:8546"); var account = '...
0
votes
1answer
199 views

web3.js-1.0.0-beta.36 - I can not connect to INFURA

Help with the solution Installed the web3.js-1.0.0-beta.36 package on the hosting server. Register and receive from Infura https://mainnet.infura.io/v3/myadress 3.Where and what should I register to ...
0
votes
2answers
405 views

Getting error while deploying with web3 version 1 using async wait

I am trying to deploy my code to Infura network i compiled and i got no errors but now when i am trying to deploy i am getting error const HDWalletProvider = require('truffle-hdwallet-provider'); ...
0
votes
1answer
117 views

web3js (v1.0.0-beta36) unable to use - Cannot find module 'buffer'

I included dist/web3.js (1.0.0-beta36) in my html file as below <script type="text/javascript" src="./web3.js"></script> <script type="text/javascript"> var Web3 = require('web3'...
0
votes
1answer
294 views

How to sign a transaction using web3 1.0?

When trying the following code I will get an an wrong JSON RPC response. const fnc = myContract.methods.transferToken(...).encodeABI(); const tx = Object.assign({ nonce: nonce, ...
1
vote
0answers
26 views

Unable to install web3-eth-ens while installing web3-version 35

I had web3 ver 36. Due to an issue, I rolled back to ver 35 as follows - npm install -g web3@1.0.0-beta.35 --save Before this, I did npm cache clear --force. However, it looks like web3-eth-ens is ...
0
votes
1answer
54 views

Web3js 1.0 events: closing the contract.events “socket”

My code is the following: contract.events.Deposit({}, function (err, event) { if (err) { console.error; } else { console.log(event.blockNumber); } }) .on('data', ...