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

1,825 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
507 views

web3.eth.abi.encodeParameter for array of structs

Here I have a smart contract with one method batch that accepts array of users to push into users state variable. contract UserFactory { struct User { string name; uint age; } User[] ...
0
votes
0answers
34 views

I am trying to connect my Website with Remix Ethereum IDE and getting one issue { setInstructor} function is not responding.help me with set function

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1....
0
votes
0answers
135 views

Calling function from web3 fails, calling it from truffle console works

I have the following JS code to call a contract: const txHash = await timelockContract.methods.executeTransaction( "0x71c1179e3C351De2641845cDAe537aCFC1808Fd2", 0, "&...
0
votes
0answers
50 views

VM Exception while processing transaction: revert - buying transaction

Hey bit of a newbie to ethereum dev over here. I'm building a marketplace for ERC 721, currently, i've been getting this error when I called in buying method. Contract code: function buyJam(...
0
votes
0answers
43 views

What happens when you 'create' an item on the OpenSea app?

Very noobie here. I'm sorry, Does anybody know what happens on OpenSea when you actually CREATE an item? I know it doesn't mint one but what it does? (As it signs a transaction tho). I've been trying ...
0
votes
0answers
85 views

Transfer ERC20 token from smart contract to wallet using sendSignedTransaction

I have s smart contract that holds ERC20 DAI token that needs to be transfer to my wallet. Using javascript web3 side on kovan testnet: const EthereumTx = require('ethereumjs-tx').Transaction const ...
0
votes
0answers
17 views

Use Web3js library

I am new to the use of blockchain we are building an application where I have the following problem to solve: Users when registering in our system will create a wallet of an ethereum token Be able to ...
0
votes
0answers
64 views

Why is a proxy object created when you try to access the same web3 object outside of the scope where it was created?

I have two functions, called one after another. The first one called creates a new Web3 object and sets it to window.web3: async loadWeb3() { window.addEventListener('load', async () => { ...
0
votes
0answers
59 views

Web3.js call() on view function on Smart Contract is failing

I am trying to access a simple variable on my smart contract, locally inside my nodejs application. The relevant parts of my contract look like this import "@openzeppelin/contracts/utils/Counters....
0
votes
0answers
30 views

Transaction has been reverted by EVM (Matic Mumbai Testnet)

I am getting the following error when trying to mint through my ERC721 contract. How can I determine the cause of the failure? https://explorer-mumbai.maticvigil.com/tx/...
0
votes
0answers
13 views

The Graph Compound API

I want to build a small project to simulate app.compound.finance (with just eth token let's say) with The Graph , how can I get supply/borrows balance per users? (my defi app initial setup is done, ...
0
votes
0answers
69 views

Simple Web3 installation and calling contracts

I have been trying to inject metamask into my site using web3. I have called web3 in my site as below and started the site using local server(VS Code extension which gives me port:5500) window....
0
votes
0answers
6 views

tracking state changes via function calls that does not include event usage

Is it possible to track changes made to a smart contracts via its functions if the functions are not emitting events. I suppose if I know the function signature representation, then I should be able ...
0
votes
0answers
121 views

How to increase the maximum blocks for `getPastEvent` method for web3?

I'm trying to get the past events from a contract's Deposit method: const events = await tornado.getPastEvents('Deposit', { fromBlock: 0, toBlock: 'latest' }) However, web3 throws an error saying it'...
0
votes
1answer
139 views

Transactions are mined before monitored transaction with same params (BSC)

On BSC chain, i am facing this situation. I am scaning mempool for a transactions ( nodejs and web3.eth.subscribe('pendingTransactions', ...) ) and when i find the one i am concerned, i fire a ...
0
votes
0answers
55 views

Deploy a contract (factory) with web3 based on the connected wallet?

A big newbie into solidity here. I’ve managed to compile and deploy (with truffle) a ContractFactory from OpenSea repository. Long story short the part with the deployment is this if (...
0
votes
0answers
13 views

Access old transaction from a web react dapp

I have create a dapp react app with this command: $ truffle unbox react I have a sample web application in src/client/ folder. This web application is able to communicate with Ethereum smart-contract ...
0
votes
0answers
9 views

Should my application be decentralized? (Basic Question)

I know this is a seemingly basic question, but one that I have not found many solid answers to. I have been programming for a few years now and with the recent NFT boom, DApps have caught my interest. ...
0
votes
0answers
45 views

Send web3js event to webhook when it happens

I have a transfer method that transfers a token using the deployed smart contract in Web3JS. I have to return the values to the customer, so I subscribe to the transfer event and wait for it to ...
0
votes
1answer
49 views

I AM Trying to connect my Website with Remix Ethereum IDE and getting Error { (index):85 Uncaught TypeError: CoursetroContract.at is not a function}

''' Document <link rel="stylesheet" type="text/css" href="main.css"> <script src="https://unpkg.com/web3@latest/dist/web3.min.js"&...
0
votes
0answers
77 views

Are binance ERC20 token transactions not on the ethereum blockchain?

I'm using web3js get transaction info on a specific ETH address. When I make the getTransactions call, no info is presented. I then check etherscan and also see that my binance ETH wallet (for ...
0
votes
1answer
75 views

My Ethereum smart contract is always returning an empty array when using web3 with metamask

import Web3 from 'web3'; window.ethereum.enable(); const web3 = new Web3(window.ethereum); const address = "0x977b5A39B6E95A7688570BF1b77e8FAb150791af"; const abi = [ { inputs: [], ...
0
votes
0answers
18 views

Is it safe to perform calculations on past events?

I would like to store all balances of my ERC20 contract on my website's database: addresses and their balances and be able to call the script anytime to sync it with new balances using Transfer event. ...
0
votes
0answers
115 views

Uncaught Exception: Unknown error when sending transaction

I am trying to deploy a Smart contract using truffle / web3js. The script has been deploying smart contracts for months and I am suddenly facing this error: error: uncaughtException: Unknown error ...
0
votes
0answers
89 views

calculate 24h trading fees of an Uniswap LP Token

greetings I would like to calculate how much fees an uniswap trading pair generated over 24h like in this table: https://info.uniswap.org/pairs I guess I would have to iterate over all blocks from the ...
0
votes
0answers
67 views

Creating buttons for executing smart contract functions,How to work with smart contract instance in App.js

This is my App.js file which is related to a smart contract. I would like to know how is it possible to get access to the contract and create a button for executing a contract function which needs an ...
0
votes
0answers
57 views

How to get owned tokens contract addresses for particular wallet address

I want to get all contract address of all assets present in my metamask wallet so that I can fetch balance of all tokens using web3
0
votes
0answers
12 views

How can I access the methods of an object in a contract using web3?

I am creating a front end, and right now I am trying to appove the token for transfer. I have an object, say token, instantiated in my contract as follows: ERC20 private token = ERC20(...
0
votes
1answer
43 views

Assigning addresses while publishing contract in Solidity

I was recently viewing a DApp on GitHub. The following is a part of .sol address contractOwner; address withdrawWallet; function contractName(address _contractOwner, address ...
0
votes
1answer
344 views

Ethereum ECR721 Create JSON to upload to IPFS

I am learing about Ethereum Smart Contract, NFT and ECR721 tokens with external Metadata. I know that you can updload a JSON file using IPFS and _setTokerURI to keep this URI. My question is how to ...
0
votes
0answers
27 views

web3.eth.Contract send() throws error invalid sender code -32000

I'm trying to invoke ERC20's contracts transfer function but I keep getting "invalid sender" error. I checked that the from address matches the local private key I imported into ...
0
votes
1answer
203 views

Is there a way to retrieve data for a solidity smart contract?

TL;DR: I'm starting with blockchain, ethereum, web3 environment and i'm very excited about it, so I want to know few things that are not clear. I already built my first solidity contract (some shop ...
0
votes
0answers
124 views

Installing solidity on windows 10

Greetings everyone, i'm trying to install solidity developpement environment on my pc OS: Windows 10 AMD64, i'm following the official solidity documentation 0.5.8, first i installed cmake, downloaded ...
0
votes
1answer
128 views

Get to and from address using Transaction hash

How can I get only to and from addresses from a transaction Hash using Web3. I am unable to get details of to and from using web3.eth.getTransaction() method. Please help!!
0
votes
0answers
22 views

Development of ethereum payments system

I'm in need of some help! I'm developing a project where I'm supposed to implement an ethereum payment system that will then be installed in a point of sale (POS) in a retail store. The idea is not to ...
0
votes
0answers
35 views

Should an account be associated with a node

When i use await web3.eth.accounts.create(); to create a account and write something to smart contract in ganache, i get sender account not recognized. But I get executed properly when i create an ...
0
votes
1answer
70 views

What is the purpose of setting web3.eth.Contract.defaultBlock?

In web3 object, the default value of web3.eth.Contract.defaultBlock is always "latest". But what could be the case to modify defaultBlock value? Thanks
0
votes
1answer
150 views

Source file compile error

... Source file requires different compiler version (current compiler is 0.8.2+commit.661d1103.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version ...
0
votes
0answers
14 views

How to handle error when smart contract method never returns?

Here is a snippet of code calling a method in contractForsale and responding to event emitted with etherjs 5.x export default MyFunc = ({route, navigation}) => { <<==react navigation 5.x ...
0
votes
0answers
52 views

Uncaught TypeError: CoursetroContract.at is not a function

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <script> if (typeof web3 !== 'undefined') { // If a web3 instance is already provided by Meta ...
0
votes
1answer
198 views

What is the safest way to generate an ethereum wallet for cold storage?

I am currently making a DIY cold storage using a desktop computer. I cannot find any good desktop wallet for ethereum cold storage. Something like electrum for BTC. So, I can only found these 3 ways ...
0
votes
1answer
1k views

How to creating multiple NFT tokens using ERC1115

I am new to solidity and ethereum network. I have knowledge of developing erc20 and erc721 tokens using openzepplin. But I am curious about erc1155. Also I have check the erc1155 documentation at ...
0
votes
0answers
18 views

During eth transfer in nethreum

Getting error: erc20 transfer amount exceeds allowance. My source code is:: public async Task<string> TransferAsync(string from, string to, decimal amount) { DefaultAccount = new Account(...
0
votes
0answers
135 views

clone pancakeswap but it's show error Unhandled Rejection (Error)

I clone pancakeswap-frontend. when run I got above error. But I can't solve this problem. Unhandled Rejection (Error): invalid address (argument="address", value=undefined, code=...
0
votes
0answers
544 views

IPC Connection not work on Node.js (web3)

I have a geth node launch on linux, I want to access it through the IPC connection in a Node.js application. I am getting this error : /home/**/node_modules/web3-core-helpers/lib/errors.js:66 ...
0
votes
0answers
18 views

Is there any way to browse DeFi apps with "watch-only address" wallet?

I like to sign my transactions with a offline computer, then broadcast on the network with an online computer. This way I never get hacked. With MEW, it is possible to send ETH to another address like ...
0
votes
0answers
29 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
55 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
324 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
1answer
209 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 ...

1
23 24
25
26 27
37