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-v1.x]

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

0
votes
0answers
6 views

How to get the return value of call methods in web3 v1?

As explained here, when we use web3 v1, we need to use a different way of calling functions (either to read the staet by call() or execute a function by sending transaction). It is not clear how we ...
0
votes
1answer
29 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
15 views

Scope in events in web3 1.0 [on hold]

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
28 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
26 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....
0
votes
0answers
19 views

HTML file created in truffle setup is not getting launched in chrome

I have used truffle to compile the contract and create the ABI files. Now I need to point the ABI files in the HTML file. I have used the HTML code as mentioned below Question When I executed in ...
-1
votes
0answers
30 views

how to convert params to bytes in javascript and parse uint256 from bytes in solidity

for example: user call this function from javascript. function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) How can I put these three uint value to bytes and ...
1
vote
1answer
22 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
102 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
votes
0answers
35 views

Setting a contract's address in web3/truffle instantly stops execution of React App

Not sure what I'm doing wrong.... Just updated to Web3 v1.x.x from 0.20.7 and now I cannot instantiate this ONE contract. Every time I call the contractInstance to set its address (after setting ...
-1
votes
0answers
40 views

Error while using websocket provider in web3 version 1.0.0-.beta.35 “not websocket protocol”

new web3(new web3.providers.WebsocketProvider('ws://localhost:8546')) I am getting the error like not websocket protocol
1
vote
1answer
11 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
81 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
50 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
38 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
50 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
18 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
22 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', ...
0
votes
1answer
33 views

how to get previous transaction history for a particular address web3js1.0.0 [duplicate]

web3.eth.getPastLogs({ fromBlock : 3150168, toBlock : 3153168, address: "0xAD08C190Ed643ec60afBbAEB2E284F616F3C3b43", topics: [topics] }) .then(result=>{}) .catch(error=>{}) how ...
4
votes
1answer
1k views

SendSignedTransaction web3 v1.0 smart contract method call

Running parity node, connected to Kovan testnet. Contract Address: 0x354Db5AE17b11fbc01A8a146B63506b1d90872E0 Using a nodejs app + web3 to send/sign transactions with the private key corresponding to ...