Questions tagged [web3js-v0.x]

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

Filter by
Sorted by
Tagged with
3
votes
2answers
2k views

How to wait until transaction is confirmed web3.js?

I am new to web3. I am trying to connect UI with web3. Metamask version is 6.0.1 and web3 version injected by (don't know who), but it is 0.20.3. Following is my code to send ethers to a function of ...
1
vote
1answer
20 views

What's the max number allowed as nonce? [duplicate]

I tried to generate nonce using this formula, so I can avoid 'underpriced' problem and nonce conflicts nonce: web3.utils.toHex( Math.round (Date.now() / 1000 - 1586000000) ), But simply these ...
1
vote
1answer
23 views

problem of connecting to ethereum

I am using web3@0.20.7 and infura to connect Ropsten testing network. I haven't opened my website(using ethereum) for a while. Today I restarted my website, and I can not connect to ethereum with ...
1
vote
2answers
269 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....
1
vote
1answer
93 views

How to register an account in web3.js v0.x

I want to create a new account using web3.js < v1.0 In web3.js 1.0.x we have this method: web3.eth.accounts.create(); or at least this method: web3.eth.accounts.privateKeyToAccount(myPrivateKey)...
1
vote
1answer
505 views

web3.js Contract return null instead of string

Here is contract: pragma solidity ^0.4.17; contract Demo{ string public data; function Demo()public{ data = "Jiu Wei"; } function getData() public view returns (string) { return ...
1
vote
1answer
122 views

Infura event listening [duplicate]

I am using Infura, Ropsten Test network, Web3@0.20 in the back-end of my Express website. I want to listen events in my ERC20 contract. I tried a lot of methods, but still failed. How do I revise it? ...
0
votes
2answers
606 views

Solc error invalid opcode, but works in truffle

I am trying to compile solidity code in solc(nodejs) but unsuccessful so far. I have created a sample app for demo. Here is sample's directory structure (node.js and truffle combined): │ app.js │ ...
0
votes
1answer
47 views

Web3 1.2.6 appears to ignore require in view function

Given the following function: function checkLock() external view returns (bool) { require( address(this) == IERC721(_nftRegistryAddress).ownerOf(_tokenId), "[...
0
votes
1answer
331 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 ...
0
votes
0answers
38 views

getAccounts undefined recently

I've been using web3 v 0.20 and I recently noticed that getting accounts from web3.eth.getAccounts(function(error, accounts) { returns undefined. Is Metamask 7.2.1 forcing it to be undefined for ...
0
votes
0answers
20 views

Use web3 0.2.x within Truffle V5

It's a pain to have to refactor tests written for TruffleV4 in web3 0.2.x to web3 1.0.x. Is there any way to avoid this situation by using web3 0.2.x instead within Truffle V5?
0
votes
1answer
121 views

get Transfer events from 0x0 address for ERC20 token

I am trying to get all the events that originate from zero (0x0) address in order to capture the mint activity for my ERC20 token. Here is my code snippet: var instance = web3.eth.contract(abi).at(...
0
votes
0answers
42 views

Contract's Mapping variable state change fails when called from web3 js javascript program

I am running into a strange issue with following contract- pragma solidity ^0.4.25; contract ApprovedPOCreateAndOwnershipTransferContract { struct PO{ bytes32 bill_to_location; ...
0
votes
1answer
732 views

Calling a “view” function using web3js

--- HEAVILY EDITED --- Solidity contract: pragma solidity ^0.4.24; contract PatientRecords { struct Patient { string ID; string weight; string height; string diseasehistory; ...