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
0 votes
0 answers
22 views

Quick ways to learn web3.js please?

could you please suggest some way's to learn about web3.js quickly? I have gone through https://web3js.readthedocs.io/en/v1.5.2/ it is really good, but it is so long and difficult to memorize. It's ...
user avatar
1 vote
0 answers
240 views

How to pass array in web3js(0.20) as function parameter to solidity?

I have a function in solidity which take array as argument and processed that array. function add_level_income(address[] memory _referredBy, uint256 taxedTokenAmount) public returns(bool) { ...
user avatar
  • 11
1 vote
1 answer
65 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 ...
user avatar
  • 263
0 votes
1 answer
151 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), "[...
user avatar
  • 1,563
1 vote
1 answer
32 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 ...
user avatar
0 votes
0 answers
42 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 ...
user avatar
1 vote
1 answer
662 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? ...
user avatar
0 votes
1 answer
800 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(...
user avatar
  • 93
1 vote
2 answers
732 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....
user avatar
0 votes
2 answers
866 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 │ ...
user avatar
  • 133
5 votes
4 answers
15k 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 ...
user avatar
0 votes
0 answers
54 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; ...
user avatar
0 votes
1 answer
739 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 ...
user avatar
1 vote
1 answer
254 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)...
user avatar
1 vote
1 answer
1k 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 ...
user avatar
0 votes
1 answer
1k 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; ...
user avatar