Questions tagged [web3js]

Use this tag with questions about programming for the Ethereum JavaScript API.

Web3.js is open source and continuously updated since 2015. It has everything you need to start interacting with the Ethereum blockchain, giving easy access to accounts, events, smart contracts.

Useful links

2372 questions
5
votes
1 answer

Uncaught TypeError: https.Agent is not a constructor

I am developing a dapp with react, the error when I try to instantiate web3 with an RPC of HTTPS or HTTP. The error is as follows: Uncaught TypeError: https.Agent is not a constructor After doing some research, I have been able to verify that the…
Goutham J.M
  • 1,726
  • 12
  • 25
5
votes
1 answer

Encountered an error while attempting to update latest block

I'm new to blockchain and i was just trying to deploy a simple smart contract to ropsten test net. I've used the smart contract code from https://github.com/t4sk/solidity-multi-sig-wallet. Also i'm using the account provided by truffle develop My…
Abhishek Jha
  • 163
  • 1
  • 11
5
votes
3 answers

How to send already minted NFT using alchemy

I have minted some NFTs on opensea. These are on Polygon Mumbai network. Now I want to transfer these to token to other addresses using alchemy web3. Here is the code I am using. Note: This is supposed to run in nodejs restful API, so there is no…
Shafqat Jamil Khan
  • 1,039
  • 1
  • 9
  • 17
5
votes
3 answers

Couldn't import web3 library in react application

ERROR in ./node_modules/cipher-base/index.js 3:16-43 Module not found: Error: Can't resolve 'stream' in 'C:\Users\Sumana\Desktop\Web3\web3app\node_modules\cipher-base' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules…
Sumana
  • 51
  • 1
  • 3
5
votes
1 answer

How to decode transaction input data using `ethers.utils.defaultAbiCoder`

I'm fetching transaction data using Etherscan API. This is the example result I'm getting: { blockNumber: '7409930', timeStamp: '1639151980', hash: '...', nonce: '4124', ... input:…
Jan Potočnik
  • 51
  • 1
  • 2
5
votes
3 answers

How do I get the address of the connected wallet with web3modal?

I'm building an application with next.js and web3. To connect the user wallet to the front-end I'm using web3modal as following: const Home: NextPage = () => { const [signer, setSigner] = useState(null) async function…
ste
  • 3,087
  • 5
  • 38
  • 73
5
votes
2 answers

What is the difference between msg.sender and address(this)?

What is the difference between msg.sender and address(this) in the below code? **pragma solidity ^0.8.0; contract Escrow{ address public payer; address payable public payee; address public lawyer; uint public amount; constructor( …
Yadav Akash
  • 81
  • 1
  • 6
5
votes
1 answer

I got error on Metamask 'Unchecked runtime.lastError: Could not establish connection'

I use svelte to create Web3 app and got some error 1.I already added web3.js cdn on my index.html 2.this is my script on .svelte file to connect the Metamask…
feizzilla
  • 51
  • 1
5
votes
1 answer

Get total amount of tokens received from a specific address using Web3.js

in a scenario, WalletA is receiving TokenB in a regular basis from AddressC. AddressC only sends TokenB, nothing else. in etherscan or bscscan it is simple to see how much of TokenB is received in WalletA and "from" field is there so you can do some…
mhmd
  • 995
  • 2
  • 15
  • 30
5
votes
1 answer

How can I get info such as symbol of an ERC20 token on RSK?

I would like to query several ERC20 tokens on the RSK network to obtain the following fields: symbol, name, and decimals. How can I do this using web3.js?
Milton
  • 161
  • 1
  • 4
5
votes
1 answer

Gatsby / Webpack Polyfill Issue

I am running a Gatsby3 site and like many, when I try to use certain web3 plugins I encounter Webpack 5 errors about missing Polyfills. I understand they no longer do them automatically and I must handle them myself. After trying every solution I…
Keith
  • 51
  • 1
5
votes
1 answer

How to subscribe to `newBlockHeaders` on local RSK node over websockets?

I'm connecting to RSKj using the following endpoint: ws://localhost:4444/ ... However, I am unable to connect. Note that the equivalent HTTP endpoint http://localhost:4444/ work for me, so I know that my RSKj node is running properly. I need to…
Jesse Clark
  • 584
  • 2
  • 9
5
votes
3 answers

Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.1.0)

I'm Getting this error when trying to deploy a smart contract with a function: Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.1.0) (argument="tokenAddress", value=undefined,…
Nathan
  • 61
  • 1
  • 1
  • 4
5
votes
1 answer

Listing NFT on OpenSea via JS API: Failed to extract transfer calldata Error 400

I am trying to use the OpenSea JavaScript API in order to list NFTs for sale automatically. I can't seem to figure out why I keep getting the error Error: API Error 400: ['Failed to extract transfer calldata']. Perhaps I have not entered some data…
Anters Bear
  • 1,816
  • 1
  • 15
  • 41
5
votes
2 answers

How to change account in truffle(ganache)?

I use ganache-cli to build local blockchain and truffle to deploy contract. To interact with deployed contracts i use truffle console. For example i transfer tokens from my current account(that is web3.eth.personal.getAccounts()[0]) to…
raury
  • 85
  • 1
  • 7