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
1answer
161 views

metamask and web3: Invalid number of arguments to Solidity function

my function has only one input string description : function createProposal(string description) { Proposal memory p; p.description = description; proposals.push(p); } and ...
0
votes
2answers
71 views

validation of data integrity in block

I am learning ethreum dapps development and have developed some dapps. I was thinking about supply chain dapp which i think , is very good application of blockchain as it ensures all the history of a ...
0
votes
1answer
31 views

ipfs.add TypeError: AbortController constructor: 'new' is required

I am using latest version "ipfs-http-client": "^48.2.2" <form onSubmit={ async (event) => { event.preventDefault() try{ ...
0
votes
1answer
13 views

`.at()` function no longer available for web3.eth.Contract?

I'm following a guide that uses some web3 code written 3 years ago. I am trying to use the TimeLockedWallet.info() call to get information about a wallet. Below are my two smart contracts. ...
0
votes
2answers
2k views

how to install web3 (1.0.0)?

I have 0.20.0 installing but not the default 1.0.0. I have Ubuntu 18.04 installed. Is any special config needed for Ubuntu 18.04 when installing web3 (1.0.0)? trevor@bridge2:~$ sudo npm install ...
1
vote
2answers
3k views

Create an Ethereum wallet with React Native for single token

Many of you might think that this question has already been answered but I don't think that there is a clear answer on the internet for the current Ethereum, Web3.js and React Native versions (for ...
1
vote
1answer
290 views

Handling require/assert failure errors correctly from a Node.JS app?

I have a getter function in my smart contract that returns one of the string values in statically defined string array. Upon entry to the function, it does a bounds check on the incoming index using ...
1
vote
1answer
17 views

How to use Trust Wallet instead of Metamask on mobile browser?

Most DApps makes use of meta mask to sign transactions. I want my dApp to Make use of trust wallet when its opened on a mobile browser. How do I do this
0
votes
1answer
101 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
1
vote
1answer
180 views

Python state channel client

Stumbled upon this piece of Solidity code which is an Ethereum payment channel : https://github.com/mattdf/payment-channel How am I to write a Python client that interacts with it over Web3 ? What ...
0
votes
0answers
14 views

Eth internal txn sent but not credited my wallet [closed]

I sent some 1.43 eth to Wazirx exchange which is showing that an internal txn balance was accrued but my exchange wallet is not updated after 3 days. Anyone could help adding the txn amount to my ...
0
votes
1answer
180 views

adding the contract value but still not changed

I am using web3 1.0 and testrpc, The following is my contract. pragma solidity ^0.4.18; contract LocalEthereum { event Created(bytes32 _tradeHash); uint32 value = 0; function addValue() ...
1
vote
1answer
28 views

How to run a simple Whisper (SHH) example

I am struggling to get a simple whisper (shh) example running. I am using the following versions: geth 1.9.24-stable-cc05b050 web3 6.14.5 I am running geth with the following command: geth --shh --rpc ...
1
vote
1answer
496 views

ERC20 Token support for metamask website payment

I have the following code working in my site to accept ethereum payments in my website via metamask.... <!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/...
1
vote
2answers
763 views

Out of gas when calling smart contract function from web3/Meteor Dapp

The following smart contract function works when called in the Remix-Solidity IDE and connected to testrpc. function submitAsset(string ownerName, string assetName, string assetDesc, string barcode, ...
1
vote
0answers
16 views

Can't connect to geth JSON RPC from React Native Expo

I am using the ethers library on npm to connect. My code for testing the connection is as follows let result = await ethers.utils._fetchData( { url: "https://MY_URL", ...
0
votes
1answer
147 views

unable to write transactions on rinkeby from javascript file

I have written a contract which read and write data into blockchain using truffle. when i deployed that contract on rinkeby and called functions using web3.js the read functions works fine. but write ...
1
vote
1answer
211 views

How to simulate multiple consecutive transactions and get the resulting state?

I'm trying to simulate a transaction on the public blockchain that invokes a contract's method with certain parameters. Then I want to make a follow-up transaction with some other method call. I ...
0
votes
1answer
244 views

how to watch the eth address with infura

our project now uses scheduled task to query the eth address with infura API to get its balance every 10 seconds but as the number of addresses keep increasing, the efficiency is very bad. Is there ...
0
votes
1answer
1k views

Creating transactions with Transaction Data to Metamask

We can use transaction data to submit any Ethereum transaction using Metamask, right? Not only ERC20 transfers, right? Does anyone knows how can I generate hexadecimal transaction data to Metamask ...
0
votes
1answer
1k views

How to use infura with web3 to talk to remote ropsten node?

I understand we need mnemonic as we did use it in deploying contract with truffle so as to be able to send ether from our ropsten account private keys. I could not find a way use the same in my server....
1
vote
1answer
753 views

getting full pending transactions from Infura

I use Infura to get all pending transactions from Ropsten: web3.eth.subscribe('pendingTransactions', async (error, txHash) => { let tx = getTransaction(txHash) ... } With this ...
0
votes
1answer
23 views

Uncaught (in promise) TypeError: work.methods.workCount is not a function

Describe the bug I am trying to call the public variable "workCount" from a smart contract using web3 Steps to reproduce: const work = new web3.eth.Contract(ABI,Address) const workCount = ...
0
votes
1answer
257 views

How to estimate gasLimit of ERC20 contracts in web3.php project?

I am using web3.php project in my Ethereum based project. A part of this project is sending ERC20 tokens, and in this regard, I need to estimate gas limit of transaction. For this purpose, I found the ...
0
votes
1answer
168 views

Can I retrieve data from smart contract to my local webpage without using metamask?

I am creating a DApp where I want to show the public variable's information from the contract. I want my users who don't have metamask to see this information also. Is there a way I can do that? If ...
0
votes
1answer
686 views

invalid argument 0: hex string without 0x prefix

In order to get a list of transactions by account address I used the following code snippet - function getTransactionsByAccount(myaccount, startBlockNumber, endBlockNumber) { if (endBlockNumber == ...
0
votes
1answer
81 views

Meteor's EthBlocks.latest.number not updating

Created a very simple Meteor app to display the current block number using ethereum:block. Problem: Even though the current block number is displayed when the page loads, it does not update both on ...
2
votes
1answer
684 views

Can the Android Metamask Extension be used with DApps?

I've successfully downloaded the Metamask Firefox Add-on, and imported my wallet into it. However I'm failing to see how I can use this add-on from within my DApp like I do on Chrome, using the ...
0
votes
0answers
21 views

data in ethereumjs-tx

I am trying to create a tx to interact with one of smart contract function. function withdraw(uint withdraw_amount) public { } I tried declaring the params for ethTx as this : const params = {...
0
votes
1answer
167 views

The contract code couldn't be stored, please check your gas amount while deploying contract

I'm trying to deploy 3 contract in 2_deploy_contract (I deploy all 3) but after the first is deployed I get the following error : The contract code couldn't be stored, please check your gas amount.
1
vote
1answer
202 views

Merkle proof for Smart Contract mapping field data

I'm trying to get merkle proof for Ethereum Smart Contract mapping field data. I created test smart contract and deployed to test network. Smart Contract Code like following code: contract ...
1
vote
1answer
139 views

passing defaultBlock “pending” param to a truffle-contract call

I need the pending balance of my contract. As far as I understand I could do it with web3: web3.eth.call(callObject [, defaultBlock] [, callback]) Can I pass defaultBlock to truffle-contract ...
0
votes
1answer
173 views

Transaction happen but ethers were not send in private network

I wanted to transfer 5 etheres from my coinbase address to my another account. My coinbase balance is: > eth.getBalance(eth.coinbase) 9.999999999999999999999999999999999e+33 So I ...
0
votes
3answers
280 views

Solidity event function not appearing in web3

I have a contract with the following event (using 0.4.24): event UpdateProgress(bool _gameInProgress); I am registering the contract like this: import Web3 from 'web3'; import address from './...
0
votes
1answer
166 views

Unable to change contract data with nodejs (web3)

I created a contract, and deployed it into my private blockchain, as you can see I use mapping and dynamically allocated array. When I am trying to add a domain by 'addDomain' method with remix web ...
0
votes
2answers
40 views

how to interact with Back-end of a dapp?

I am trying to build a dapp but I am having problems. My idea is: I have a front-end written in html / css and a backend implemented with web3.js thanks to which it is possible to connect to a ...
0
votes
3answers
289 views

How to generate a new Ethereum address and private key from a command line?

How one can securely generate a new raw private key from a UNIX command line? This private key can be then imported to wallet apps or web3.js.
1
vote
0answers
20 views

MetaMask no longer working on my Chrome browser [closed]

I have learned that MetaMask no longer automatically links up to Web3 sites. Every time I now try to use my MetaMask to transfer fund from MyEtherWallet, I see that it is not connected to whatever ...
0
votes
1answer
232 views

Problem deploying a smart contract in web3 to the Ropsten testnet

I am having trouble deploying a smart contract to the Ropsten testnet. I have dug through a lot of tutorials and questions and I cannot seem to find an suitable answer. Thanks so much for you time! ...
0
votes
1answer
18 views

TypeError [ERR_INVALID_ARG_TYPE] web3.js error

Can anyone help me fix this problem? I keep getting 'throw new ERR_INVALID_ARG_TYPE( ^ TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or ...
0
votes
1answer
30 views

Web3 how to send ether from client Metamask to contract address native receive function?

I wonder how can I natively pop-up the MetaMask window to send specific amount of ether as a donation to already defined SC address and ABI? Short code intro: pragma solidity >=0.7.0 <0.8.6; [......
0
votes
0answers
19 views

web3.eth.sendSignedTransaction returns undefined [duplicate]

Please look into the below Web3 script, this is returning undefined, but it must have returned the transaction hash and its related meta data. Code: const Tx = require('ethereumjs-tx').Transaction ...
0
votes
0answers
24 views

Issue sending ETH to smart contract with web3js/metamask

So I have a simple smart contract (shown below). // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract Casino { function pay() external payable{ } ...
2
votes
2answers
106 views

Deploying contract using web3js fails

I am trying to deploy contract using web3js in nodejs on ganache cli test server, but it fails with error as follows : D:\Thrive\PoC\NodeWebAPI\node_modules\web3\lib\web3\contract.js:149 ...
0
votes
1answer
222 views

Accessing older blocks from Geth: Returned error: missing trie node 94d34

When my Nodejs script uses web3 to query a geth node running in a private Ethereum network for an older block, I encounter the error UnhandledPromiseRejectionWarning: Error: Returned error: missing ...
0
votes
1answer
85 views

Send total ether balance using geth/web3js

I installed a full node and synced to rinkeby testnet. I created 3 accounts using eth.personal.newAccount Assumed the balances of 3 accounts Account A: 1 eth (this is coinbase account) Account B: 1 ...
10
votes
3answers
4k views

Error: etherbase address must be explicitly specified

When I make a RPC to geth running remotely, I cannot get the account list / balance of the account. It also says that the coinbase is not set. But as far as I know, isnt the coinbase supposed to be ...
-1
votes
1answer
42 views

Add liquidity to Uniswap pool with Web3

I am trying to add liquidity to Uniswap on the Ropsten network using Web3. My JavaScript code is as follows: (async () => { console.log("account: ", this.state.account); const ...
0
votes
1answer
113 views

getBalance of shows the wrong balance

I have this code to show the erc20 token balance of an account var tokenAddress = '0xb97E9bBB6fd49865709d3F1576e8506ad640a13B'; var walletAddress = '0x62f28320f688A7A4e0021c55d7ffD1acd770A133'; ...
0
votes
1answer
453 views

Using vanilla javascript with web3 and metamask

I have searched severally on how to use web3 with metamask without nodejs without any success. I want to be able to get an instance of a user's metamask account through web3 and vanilla javascript ...

1
2 3 4 5
85