2022 Developer Survey is open! Take survey.

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
0 answers
4 views

How to Export public key from Metamask

【Front】 const keyB64 = await window.ethereum.request({ method: 'eth_getEncryptionPublicKey', params: [accounts], }); const publicKey = Buffer.from(keyB64, 'base64') ...
user avatar
0 votes
1 answer
15 views

Unable to install WalletConnect through npm

I'm trying to add Wallet Connect to our project(Vue.js), form here: https://docs.walletconnect.com/quick-start/dapps/web3-provider, I used this command to install it. npm install --save web3 @...
user avatar
  • 147
0 votes
0 answers
15 views

view functions error : Returned values aren't valid, did it run Out of Gas?

I'm calling the methods in the deployed smart contracts in Ganache. Other methods are working fine, but the view functions returns an error. Here's the view function in Solidity: mapping (address =>...
user avatar
0 votes
0 answers
5 views

My transaction was dropped and now when I search the transaction on etherscan it says we are unable to locate this transaction hash. Please help

I sent money to a friend with a low fee. After awhile it showed dropped and I was going to replace it with a higher fee but when I tried to open the transaction id to get the nonce it now says its ...
user avatar
0 votes
0 answers
4 views

Unable to deposit into AAVEv3 via web3

I'm attempting to deposit WMATIC on the Polygon chain into AAVEv3, but I'm getting a revert. I'm running a forked version of Polygon mainnet locally with ganache. I'm using the first account provided ...
user avatar
0 votes
0 answers
6 views

1inch aggregation protocol v4 - basic example of swap

I'm trying to figure out how I can use 1inch AggregationRouterV4 as a smart contract and not as an API. I have experience with ethers , but I can't find any example and tests on how to work with a ...
user avatar
  • 101
0 votes
1 answer
15 views

swapTokensForExactETH, execution reverted: null

I m trying to estimate gas for a swapTokensForExactETH transaction with pancakeswap contract (similar to uniswap one) When i do, i get the following error: Error: Returned error: execution reverted ...
user avatar
  • 103
0 votes
0 answers
5 views

is there any way to get other smart contract ABI(not my smart contract) automatically without using API or manual(etherscan copy-past)?

my question is so simple but with difficult answer :-) is there any way to get ABI for some smart contract address automatically without using API ? there are some API that i can get ABI for smart ...
user avatar
0 votes
0 answers
5 views

Problems sending tokens. The value you send should be less than your current balance

Im having this issue. I understand that: I have Contract A and Contract B If Alice has 100 tokens, and calls transfer on contract A, Alice's tokens are going to be transferred. If Alice has 100 tokens,...
user avatar
  • 13
0 votes
0 answers
10 views

Get details of pending transaction using tx hash

I'm trying to get the details of pending transaction using it's txhash. I tried using web3.eth.getTransaction(transactionHash) but it seems like it returns null for pending transactions but works fine ...
user avatar
0 votes
0 answers
9 views

Contract Calls returning null using truffle Gnache and node

i have a simple contract pragma solidity ^0.4.18; contract HelloWorld { string private name = "Ire"; function getName() public view returns (string) { return name; } function setName(...
user avatar
0 votes
0 answers
9 views

to convert one token to another, is there something as simple and independent methods, or do we necessarily have to use a dex as a swap interface?

I use web3 with nodejs. To transfer the main network token, which we put in the transaction value. To transfer another token to another wallet, we use the smart contract transfer function of the same ...
user avatar
0 votes
0 answers
14 views

Geth - Full Archive Node

Im currently using an Infura RPC node and web3 for querying transactions. Im running into an issue when trying to query multiple blocks that contain more than 10K results. If I was to run a full ...
user avatar
  • 1
1 vote
0 answers
11 views

Is it possible to extract data such as `gasPrice`, `gasLimit`, `nonce`, etc. from the transaction that has been signed and serialized?

Is it possible to extract data such as gasPrice, gasLimit, nonce, etc. from the transaction that has been signed and serialized? For example I use this code for sign tx: //Signing transaction const ...
user avatar
1 vote
1 answer
8 views

How to understand if a contract has been renounced programmatically?

Is there a way to query the blockchain to find out the current owner of the smart contract programmatically? I mean not the address that deployed the contract, but the one that is currently the owner. ...
user avatar
0 votes
0 answers
32 views

Uncaught (in promise) TypeError: myFunction.watch is not a function

I'm trying to develop my first DAPP based on this tutorial (https://livebook.manning.com/book/building-ethereum-dapps/chapter-12/) and I'm encountering some errors in the javascript part. In ...
user avatar
0 votes
0 answers
35 views

Getting "Expected private key to be an Uint8Array with length 32" when running a transfer function on ropsten testnet through my terminal

i am trying to send a transaction but it throws an error. MY CODE: var Tx = require('ethereumjs-tx').Transaction const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io/v3/...
user avatar
0 votes
0 answers
9 views

API for find smart-contract deployed which chain?

Is there any API which gives me details that project smart-contract deployed on which chain via its smart-contract address? e.g. How to know whether it deployed in polygon, avalanche, ethereum? If is ...
user avatar
0 votes
1 answer
16 views

Error : contract.methods.myfunction().call() is not a function

I'm new to web 3 and I'm trying to interact with a contract deployed with ganache and I get an error here is a screenshot: `
user avatar
  • 5
0 votes
1 answer
22 views

Set BUSD transaction value in web3 ETH send transaction

I followed the instructions on Binance docs, using Web3js to create a transaction. I want to create a BUSD transaction on web3 using metamask try { const transactionHash = ethereum.request({ ...
user avatar
  • 101
0 votes
0 answers
7 views

Returned error: replacement transaction underpriced and Returned error: exceeds block gas limit

I'm trying to send a Web3JS transaction for a SmartContract (BSC) but it always returns Returned error: replacement transaction underpriced and if I increase the Gas it generates Returned error: ...
user avatar
0 votes
0 answers
13 views

Uncaught Error: invalid BigNumber string (argument="value", value="2022-05-18", code=INVALID_ARGUMENT, version=bignumber/5.6.0)

I created a function that registers births and use a form to submit the data. The problem is every time I try to use web3/Javascript, it gives me this error. The error is because of the dateOfBirth ...
user avatar
0 votes
0 answers
13 views

Filter Ethereum events by number range

Is it possible, using web3 or ethers to filter events by a number range, e.g. indexing the amount in an event and then filter events with amount > a number.
user avatar
  • 189
0 votes
2 answers
29 views

How to get the returned values in Solidity functions? [duplicate]

Imagine I'm developing a simple function as the following: uint256 state; event Addition(uint256 result); function addition(uint256 a, uint256 b) public ...
user avatar
  • 584
0 votes
1 answer
17 views

Can i build an NFT marketplace on 0x api

I just saw 0x.org today it looks interesting, i am working on an NFT marketplace on Polygon, your docs looks familiar as to what i am working on. so i want to know, if i can build an NFT marketplace ...
user avatar
  • 1
0 votes
0 answers
15 views

geth - allow external node to connect to private, locally running network

I'm running a local, private blockchain using geth. This is currently my setup: bootnode running on port 30300 peer node 1 running on port 30301 with HTTP-RPC server on port 8101 peer node 2 running ...
user avatar
  • 21
0 votes
0 answers
16 views

How to Approve spend of one Token with Web3.js? [duplicate]

I am currently using an html (with javascript) page that is available to my users. I need to set up a button that allows the spending of BUSD or other stablecoin tokens on the same page. Once the ...
user avatar
0 votes
0 answers
14 views

Is using block.timestamp + appropriate for adding months even years into the future?

I have a smart contract that is date dependent. Intended to schedule events far into the future, like days, weeks, months even years into the future. As long as the events happen on the specified date,...
user avatar
  • 107
0 votes
1 answer
22 views

How to Use 2 NFTS metadata to create a new NFT (Breed) with Metadata JSON that they choose from the 2 NFTs

How to Use 2 NFTS metadata to create a new NFT (Breed) with Metadata JSON that they choose from the 2 NFTs.
user avatar
0 votes
0 answers
6 views

How to text search / filter in web3?

I have created a list of ERC721 NFTs in different contracts using thirdwebsdk, I need a way to text search, for example, nfts with the name as "cat" and get the list of all nfts which has &...
user avatar
0 votes
0 answers
38 views

How to Approve spend of one or many Token with Web3.js?

I am currently using an html page (with javascript) that is available to my users. I need to set up a button that allows the spending of BUSD or other stablecoin tokens on the same page. Once the ...
user avatar
0 votes
0 answers
20 views

How to get balance on metamask all network [bsc , eth, cro, etc] using web3modal

how to display the balance for metamask using web3modal with various networks, for example I am on the mainet bsc network I display the bnb balance, and if I use the ether network what appears is the ...
user avatar
0 votes
1 answer
17 views

Why am I failing to interact with a smart contract I found on Etherscan.io?

I am getting the below error trying to call an existing smart contract I found on Etherscan.io function using call(). Error: Error: Returned values aren't valid, did it run Out of Gas? You might also ...
user avatar
  • 107
0 votes
2 answers
38 views

swapExactTokensForTokens estimateGas fails with execution reverted

I'm trying to swap a pair not having wbnb on pancakeswap. For ex. BUSD -> LUNA. As far as the pair doesn't have wbnb I use swapExactTokensForTokens (meanwhile WBNB -> BUSD with ...
user avatar
0 votes
0 answers
18 views

How to create using Mnemonic in Web3.js? [duplicate]

I want to create an account with mnemonic in WEB3.JS I tried using web3.eth.accounts.create() but the only argument is entropy and it returns only { address: "", privateKey: "&...
user avatar
0 votes
1 answer
16 views

Can I store ether and ERC-20 tokens in one contract?

I am trying to create a contract to store ether and two ERC-20 tokens. People will transfer ether and the other two ERC-20 tokens to this contract and when the time comes, the owner of this contract ...
user avatar
  • 121
0 votes
0 answers
3 views

Error Web3 Connection only on iPhone when sending BNB

Basically, I get an error while sending funds on from iPhone. On web, it works perfectly fine, but on the phone, I get the following error: undefined is not an object (evaluating 'web3.eth') I don't ...
user avatar
0 votes
0 answers
16 views

Not getting any values in contract.eth.methods field

Here is my Web3.js code const Web3 = require('web3') const rpcURL = 'https://bsc-dataseed.binance.org/' const web3 = new Web3(rpcURL) const fs = require('fs/promises'); var contract; //execution ...
user avatar
0 votes
0 answers
13 views

Getting an: did it run Out of Gas? error when calling a smart contract method with web3js

I am getting an error trying to call an existing smart contract function using call(). Error: Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not ...
user avatar
  • 107
0 votes
0 answers
17 views

Making offer on opensea

Trying to write a script to make offers on opensea but get error: Error: Expected amount to be of type BigNumber, encountered: 1 import Web3 from 'web3' import { OpenSeaPort, Network } from 'opensea-...
user avatar
  • 1
0 votes
1 answer
20 views

How to get state of transaction from ethereum blockchain via an API

How to get state of transaction from ethereum blockchain via an API is there any API to fetch the State of the transaction
user avatar
0 votes
0 answers
31 views

web3.currentProvider.sendAsync() or web3.currentProvider.send() not working on React native

I am currently working on a React native project that requires me to implement EIP712 typed hashing and signing. I have implemented the code on React with Metamask, where the both web3.currentProvider....
user avatar
1 vote
0 answers
28 views

How to use Web3 with C++?

So this is less of a question about how to use web3 for C++ but rather where to start learning how to use and install Libraries for C++! Related: How to interact with contracts in C++ application? In ...
user avatar
0 votes
1 answer
18 views

How to call a contract's method via web3 1.x without a node (sign with a privateKey and send)?

There's a number of questions and answers about calling contract methods via web3, but they are either outdated (i.e. for web3 0.x while 1.x has many breaking changes) and/or don't include signing (1, ...
user avatar
  • 111
0 votes
1 answer
22 views

Get the 'from' address of a transaction from the smart contract event log?

I want the address of the wallet interacting with the smart contract (the 'from' address in the tx receipt). I can get the smart contract event and parse the event log in the below code but ideally I ...
user avatar
  • 11
0 votes
0 answers
10 views

how is raw transactions created and signed? using ecdsa packages

what are the steps involved in creating a signature to be sent to ethereum network via a rpc node? assuming the below is the rlp transaction format to be sent. { to, value, gasLimit, ...
user avatar
0 votes
1 answer
21 views

Force two transactions in the same block to pay fees from another account [duplicate]

I got two wallets on the BSC. The first one (walletA) is empty of BNB but has access to another token, say TOKENX, and the second one (walletB) has BNB. What I want to do, is tranfer some TOKENX from ...
user avatar
0 votes
1 answer
15 views

Can I store random data with eth_sendTransaction?

According to the docs for web3.eth.sendTransaction and the docs for eth_sendTransaction: The transaction object can contain an optional data parameter which should be a String that consists of: either ...
user avatar
0 votes
1 answer
42 views

How to pass bytes parameter to contract method call using Web3.js?

I'm trying to call a method in a contract and the method is like this: function myMethod(uint8 tid, bytes calldata _bytes) public view returns (string memory) { ... } I'm using Web3.js to ...
user avatar
0 votes
1 answer
15 views

Can we have communications in a web-based dapp?

I want to create a ui with web3js for some etherium smart contracts. However, I like to enquire the wallet owners whether or not they will accept the transaction Is it possible to send them some sort ...
user avatar
  • 1

1
2 3 4 5
114