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

Login and Signup system on mobile dapp

I'm generally new to web3 development, I have experience on building mobile apps with JavaScript and React Native. I am looking on building a mobile dapp, and I would like to start by building the ...
0
votes
0answers
11 views

this.state.manager returning an empty array

I've made a solidity contract which was deployed perfectly. Now, when I'm connecting with it my react Dapp after getting the ABI and address and trying to render it, it renders nothing. my web3.js ...
0
votes
1answer
19 views

is there a way I can make transaction without asking for wallet confirmation (auto accept transaction)?

I am trying to make a function where when the user clicks the transaction button the transaction will happen without wallet confirmation.Is it possible with web3 if yes then how? Do I need to pass ...
0
votes
0answers
7 views

Simple way to sign data with Metamask?

I need a very simple way to sign data with Metamask and Web3. I am very familiar with using eth sign and eth personal sign with Web3, but I want to incorporate Metamask into it. I have read the ...
0
votes
1answer
10 views

Can't create Web3 websocket connection successfully

I use latest Web3 version (1.6.1) code in Node.js as provided in docs. But when I run: var Web3 = require('web3'); var web3 = new Web3( new Web3.providers.WebsocketProvider('wss://dex.binance.org/api/...
0
votes
0answers
8 views

Getting Uniswap token pair price feed with C++ [duplicate]

I am trying to find out if I can interact with Uniswap via web3 using C++ rather than JS but I don't know if it's possible to use web3 with C++. Any opinion or solution will be appreciated.
0
votes
0answers
11 views

Failed: [ethjs-query] while formatting outputs from RPC

I am working on a bet app which is someone else project. I am currently learning and researching it. I am using it locally with ganache truffle and it works fine on one browser a bet is created but ...
0
votes
0answers
10 views

Typescript creating web3 contract abi

Trying to do a simple test call to my contract, im getting this error on the contract instantiation part, Type '{ contractName: string; abi: ({ inputs: any[]; stateMutability: string; type: string; ...
0
votes
0answers
20 views

How can signing and sending transactions take place within Meta Mask if the user is not running a local node?

I have been trying to wrap my head around this for a while to no avail, so please help me understand. I've created several dapps and smart contracts in the past using web3.js, ethers.js, web3.py, etc. ...
0
votes
1answer
10 views

Can I send ERC20 and ETH in the same transaction trough web3js?

Can I send ERC20 and ETH in the same transaction trough web3js ? I want enable the user to send my token with ETH in a same transaction to my wallet. I know that there are 2 transactions (ETH transfer ...
0
votes
1answer
12 views

Verify ethers.js signature in backend with web3.py

I'm trying to implement a 'Login with Metamask' button on my dapp. On the frontend I'm using ethers.js code: const provider = new ethers.providers.Web3Provider(window.ethereum); var [account] = ...
0
votes
1answer
11 views

Can't send ETH to smart contract with Ganache: Invalid or unexpected token

I'm having issues sending ETH to an extremely basic smart contract. Here's the smart contract code: // SPDX-License-Identifier: MIT pragma solidity 0.8.9; contract hodl { uint num; uint value; ...
0
votes
1answer
18 views

how can others interact with my smart contract

How can I make my contract in a way that others can interact with it using metamask. This is my code: dapp let input = document.getElementById("myInput").value contract.methods.create(input) ...
0
votes
0answers
12 views

How to get what token is swapped for decoded swap event?

So I made program that listens for swap events and decode it and how would I get what is swapped eg usdt to ethereum or etherum to usdt, Here is output: { name: 'Swap', events: [ { name: ...
0
votes
0answers
8 views

Issue when passing argument with double quote javacript web3js

I would like to pass an address list as argument in order to send some crytos by batch. What I need to send as argument -> ["0x...0","0x...0","0x...0"]. My address ...
0
votes
0answers
16 views

why is signTransaction so slow? Is it faster overall to use an unlocked account on a node?

I am using the following to sign a transaction with my private key (I am using Alchemy's web3): web3.eth.accounts.signTransaction(transactionConfig, privateKey) For the transactionConfig I am setting ...
0
votes
1answer
10 views

Unknown Account when attempting to .send() with web3

mintNFT(ether, percentage) { this.contract.methods .createCollectible(parseInt(percentage)) .send({from: this.props.props.account, value: parseInt(ether) }) .then((balance) => { console....
1
vote
1answer
45 views

How to simulate buy?

im new in web3js and i got a problem. Would be nice, if you could help me. Ive been trying to solve it myself for days... Im trying to simulate a buy transaction (after its working i will do the sell ...
0
votes
0answers
31 views

Returned error: unknown account when sending with web3-react and Web3

i'm getting this unknow account error while trying to send some tokens to a staking contract. Does someone experienced this or have any solution? My function the the frontend: const { account } = ...
0
votes
0answers
12 views

How do I get the smart contract source code with web3, having the token's address?

Title says it all, I would like to get it to a file (also - what would be the preferred format to scan over it efficiently later on?) I am unable to find this function in the web3 documentation, if it'...
0
votes
1answer
19 views

How to web3 "encodeFunctionCall" a payable function?

I want to encode a call for mint() payable with a msg.value of 8 ETH. My code: web3.eth.abi.encodeFunctionCall({ type: 'function', name: 'mint', payable: true, value: web3.utils.toWei(&...
0
votes
0answers
13 views

Smart contract that recognizes Tweets made by each Twitter user [duplicate]

Is there a way for a Solidity smart contract to interface with Twitter accounts or Twitter API to recognize the number of "relevantly tagged" tweets that account made? For example, an ERC-20 ...
0
votes
0answers
20 views

useEffect-Hook : React Hook "useWeb3React()" cannot be called inside a callback

After inserting const web3React = useWeb3React(); into my App.js component, I get the following error message. React Hook "useWeb3React" cannot be called inside a callback. React Hooks must ...
0
votes
1answer
18 views

How to make secure transactions in contracts - Solidity

If I have a contract deployed to an exchange. From there I (hacker) can download the abi for that contract. So, now I have the abi and let's say I have the address of the owner (victim) as well. So, ...
0
votes
0answers
77 views

How to use useWeb3React for Smart Contract interactions?

I'm recently investigated how to use import { InjectedConnector } from "@web3-react/injected-connector" to connect my Frontend to my MetaMask Account, but now I got stuck allowing my ...
0
votes
1answer
17 views

How is transactionIndex decided in a block?

I'm using web3py and web3js to send transactions on the Harmony EVM chain using sendRawTransaction, and i noticed that once my transaction is sent, the transactionIndex value will always be between 0 ...
0
votes
0answers
40 views

Transaction error. Exception thrown in contract code. mint function

We have been trying to connect the UI with the smart contract in order to carry out a mint functionality of a nft. But have been facing this error (Transaction error. Exception thrown in contract code)...
0
votes
1answer
22 views

Return values aren't valid, did it run out of gas? while calling a function from the abi file

Uncaught (in promise) Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, ...
0
votes
0answers
4 views

Which wallets will usedapp activateBrowserWallet connect to?

https://usedapp.readthedocs.io/en/latest/core.html#useethers says activateBrowserWallet(onError?: (error: Error) => void, throwErrors?: boolean) - function that will initiate connection to browser ...
0
votes
1answer
19 views

How to obtain transaction creation time for Ethereum transactions using web3?

I am interested in analysing transaction latency in Ethereum (time it takes from creating the transaction until it has been added to a block). I have been looking at Web3 (link https://web3js....
1
vote
0answers
19 views

how to call my transferFrom function in web3js?

how to call the transferFrom function in web3.js without node.js, Provide code as explanation.
0
votes
0answers
7 views

How do I call a ERC721 safeTransferFrom function and approve the caller in web3?

how do I call safeTransferFrom function and approve the caller in web3 also without using node.js, Provide code as explanation.
0
votes
1answer
17 views

@ethereumjs/tx Error: Returned error: Insufficient funds. The account you tried to send transaction from does not have enough funds

Moving to @ethereumjs/tx npm package after ethereumjs-tx has been marked as deprecated. My from address has sufficient Kovan network balance, but the following code throwing Insufficient funds error. ...
0
votes
0answers
9 views

Uncaught Error: Module name "web3" has not been loaded yet for context: _. Use require([]) How do I fix this? (require.js exploit the exception)

I am trying to build a simple Dapp using truffle, ganache, and metamask but when I try to connect web3.js and metamask, an error occurs. Uncaught Error: Module name "web3" has not been ...
0
votes
0answers
13 views

Using array of addresses in web3.eth.subscribe()

Referencing Thread I want to clarify the usage of the subscribe(). I'm wondering if I'm able to use an array of addresses that shall be subscribed. As mentioned in the documentation a list of strings ...
0
votes
1answer
13 views

Why can't I loop over a mapping in Solidity?

Okay, we all know looping over mapping is not possible in Solidity, and we all know how to solve it: add an array or counter to keep track of indices in the mapping. But this question is about why ...
0
votes
1answer
16 views

Is storage replicated through instances of deployment?

Say a contract has money stored in it and has already been uploaded to the blockchain. If I somehow get the source code to that contract and want to deploy that myself will the money that is stored in ...
0
votes
0answers
13 views

Send signed instructions to smart contract without Metamask but with Infura

I need to send instructions to mint an NFT but wish to do it without calling Metamask. So, I figured that I need to use Infura like so.. web3 = new Web3(new Web3.providers.HttpProvider(...
0
votes
1answer
25 views

Sign with web3, verify with Solidity

I have been trying, debugging, and crying, for a few days now. I simply for the life of me cannot figure out how to verify a signature that I've created with web3, in Solidity. I am sure I am just ...
0
votes
0answers
42 views

How to create a lazy minting nft place using ipfs

I want to create a site to perform lazy minting of NFTS using ERC-721. The site will allow users to mint NFTS which can be image, video, music, virtual game items, domains. The first part of questions ...
0
votes
0answers
13 views

Web3 socket with options doesn't work

I'm trying to set some options in my wss connection but that seems don't have any effect using the moralis endpoint to connect in BSC I tried to keep the connection but that's dropped yet const Web3 = ...
1
vote
0answers
19 views

Infura EIP-1559 not enabled on Common

When trying to contruct FeeMarketEIP1559Transaction ie. ERP-1559 transaction using @ethereumjs/tx and @ethereumjs/common npm library then Infura ( Kovan network, network id:42 ) return this error EIP-...
0
votes
1answer
23 views

Rinkeby Network: Get USDT balance issue using web3 js

I am using web3.js and getting balance for rinkeby network in MetaMask. But I am getting always object promise in console. But, I want to get USDT amount from the account. Please check following code. ...
1
vote
0answers
9 views

Ensure processing order of new block events

How can I ensure the correct processing order of new block events when I do some await stuff in the handling code? I am afraid that the next block processing is getting started before the previous one ...
0
votes
1answer
45 views

Web3py - how to get pending transaction data?

I'm using web3py to receive new pending transactions. The problem is that i'm only receiving the hash of the transaction, while i would like to get that transaction's data too, such as input, sender ...
0
votes
1answer
34 views

Determine if transaction receipt is for ERC20 or ERC721

I am trying to distinguish between NFT transactions and any other transaction. I found this post where it says to compare the topics length, but that seems to be incorrect. ERC721 topic lengths are 4 ...
0
votes
0answers
23 views

Error: Returned error: transaction could not be decoded: unsigned transactions not supported

Guys I am trying to sign and send a transaction to Rinkeby test network using Infura and web3. However, i have been stuck in the following error Error: Returned error: transaction could not be decoded:...
0
votes
0answers
12 views

Listen for when an NFT has been bought on Opensea io

I have a script that places bids on certain collections on opensea.io but I dont find a way to react to the event when I actually bought it or someone accepted the bid I made. Listening to events from ...
0
votes
0answers
11 views

How Can send tokens to another wallets ? (web3js) [duplicate]

I have learning to blockchain and I want to send some popular crypto tokens (such as Dogecoin, Shiba Inu, ...) from BEP20 wallet to other (using by by Web3js) How i can do it? I understood must using ...
0
votes
0answers
23 views

Recovering address from signed message in Elixir

I'm signing a message via Web3js: const string = this.web3.utils.sha3("test"); const signature = await this.web3.eth.sign(string, this.wallet.address); In Elixir, i'm parsing the hash and ...

1
2 3 4 5
102