Questions tagged [nodejs]
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications.
801
questions
1
vote
0
answers
9
views
How can we employ libp2p to establish a secure private network that is impervious to unauthorized connections?
backgroung
Currently, I am looking to utilize Helia to construct a private IPFS network. The critical issue at hand is "Ensuring that this private network remains inaccessible to external nodes.&...
0
votes
1
answer
35
views
Ethers.js: getLogs returning empty results despite existing transactions
I'm working on a project where I need to track USDT transfers to specific wallet addresses and confirm them after a certain number of blocks. I'm using ethers.js to fetch logs for this purpose. ...
0
votes
0
answers
13
views
How can I get block range of Arbitrum blocks by batchSequenceNumber or lvl1BlockNumber?
Could someone explain please, if I know only "batchSequenceNumber", how can I receive the block range of lvl2 blocks that were included in the batch?
I really appreciate any help you can ...
1
vote
0
answers
24
views
How can I decode Arbitrum SequencerInbox data in blob using nodejs?
Could someone explain please, what kind of data is stored in blobs of the "addSequencerL2BatchFromBlobs" transaction:
https://etherscan.io/tx/...
0
votes
0
answers
161
views
Returned error: insufficient funds for gas * price + value (overshot)
I'm trying to automate the calculation of gas based on the balance, set the required gas and send the remaining balance. Am I misunderstanding something?
// send all
const amount = balance.weiBalance -...
0
votes
0
answers
145
views
my api key is being signaled as having a syntax error on a script i'm using to send to a private transaction on optimism network
file:///C:/Users/HP/private-sendtx/sendPrivateTx.mjs:7
const { rVCbipD-Y1F, "private_key is here" } = process.env;
SyntaxError: Unexpected token '-'
at ModuleLoader.moduleStrategy (node:...
0
votes
0
answers
86
views
Getting random public key/address from cloudHSM signature in Nodejs
Generating key pair -
var publicKeyTemplate = [
{ type: pkcs11js.CKA_CLASS, value: pkcs11js.CKO_PUBLIC_KEY },
{ type: pkcs11js.CKA_TOKEN, value: true },
{ type: pkcs11js.CKA_LABEL, value: &...
0
votes
0
answers
22
views
estimated balance changes web3js?
how to make it via web3js so that it shows as in metamask estimated balance changes?
0
votes
0
answers
99
views
TypeError: Cannot read properties of undefined (reading 'Web3Provider')
here is my code please help me
import React, { useEffect, useState } from "react";
import { ethers } from 'ethers';
import { contractABI, contractAddress } from '../utils/constants';
export ...
0
votes
1
answer
59
views
Getting an error While uploading image folder on pinata using pinFromFS function in nodejs
I am uploading approx 2.3 GBi of folder to pinata using pinFromFS() now i am getting error given below:
Error: write EPROTO
at afterWriteDispatched (node:internal/stream_base_commons:160:15)
...
0
votes
0
answers
63
views
How to fetch the current price of GM token from GMX?
I would like to fetch the current prices of GM tokens from GMX V2 via Node.js.
I have found the following info in here (https://gmx-docs.io/docs/api/contracts-v2/#getting-gm-token-price):
Getting GM ...
0
votes
0
answers
27
views
How to fetch the transaction amount from Arbiscan using Node.js
I am facing challenges when I try to fetch the transaction amount from Arbiscan (using Arbiscan API).
I want to fetch the transaction amount of my latest transaction using Node.js. The following ...
0
votes
1
answer
28
views
Hardhat, problem with uninstalled dependencies
I can compile my contracts successfully.
I had some problems with some of the hardhat functions so i installed Waffle and its dependencies.
However it doesn't work and throws an error stating missing ...
0
votes
2
answers
94
views
JsonRpcProvider not Found in ethers.js
I'm building a JavaScript application where I'm trying to interact with the Ethereum blockchain using ethers.js. However, I'm encountering an error stating that JsonRpcProvider is not found. This ...
0
votes
1
answer
38
views
Set RPS with ethers.js
I wrote a code to check the pending transactions of a contract, but I would like to limit the RPS (requests per second) to 25 (I'm using a node with user free) how could I do it?
Here is the code:
...
0
votes
0
answers
32
views
How to implement waiting for transaction validaton?
I'm running a bot that is making a series of smart contract calls on Avalanche c-chain from one account. I'm checking for transaction validation by waiting for a nonce increase with
export async ...
0
votes
1
answer
76
views
I get this error when i try calling the getBalance function in node.js
eth_chainId
eth_accounts
eth_call
WARNING: Calling an account which is not a contract
From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
To: 0x5fbdb2315678afecb367f032d93f642f64180aa3
this is ...
1
vote
1
answer
64
views
Getting method hardhat_impersonateAccount not supported when impersonating a WETH whale account on Arbitrum
Attempting to impersonate a WETH whale account on arbitrum and getting:
ProviderError: method hardhat_impersonateAccount not supported
The code is being run from a script using the following command ...
0
votes
0
answers
40
views
Ethers giving Error: missing revert data in call exception for some pairs
I'm trying to get quote prices for pairs. Most of them end up being successful, but some number of them raise an error in code Error: missing revert data in call exception;
What can be done about it? ...
0
votes
2
answers
37
views
storing login credentials, mySQL or IPFS
hi im very new to developing, total newbie here and im on my final year project on blockchain development. i want to ask if for creating a login session we must store the credentials (username & ...
0
votes
0
answers
12
views
How to save the values on smart contract by triggering the functions without using private key on Node js?
How do I save the values on a smart contract by triggering the functions without using a private key on Node.js?
Only i have the contract address With only contract address, how can i save the values ...
0
votes
1
answer
29
views
Fetch special position in JSON FORMAT
Hellp every body hope all are good today ?
I need some help please ...
This is my JSON with const = result :
[
{ asset: 'USDT', free: '35.00', locked: '0' },
{ asset: 'USDC', free: '80.99', locked: ...
0
votes
0
answers
12
views
Why does this error occur? Error when sending a transaction: cannot estimate gas; transaction may fail or may require manual gas limit?
There is enough balance, the network is also working correctly, the keys are also correct, the gas has been increased, but the error remains.
const ethers = require("ethers");
const ...
0
votes
0
answers
31
views
Can anyone figure out how this guy does arbitrage?
The owner of this tx record is constantly arbitraging for small amounts.
It does these directly via pair. So it's not using a router.
In my own testing I have always found that the amount of output is ...
1
vote
1
answer
49
views
I'm having trouble sending token1 to a pair address and receiving token0
I am trying to make a swap directly via the pair address without a router.
I'm trying to get token0 by sending token1.
The amount of token0 I will receive does not matter, but when I run the node.js ...
0
votes
0
answers
20
views
Can we send tokens to BSC pair address and receive tokens in return?
We're almost at war with ChatGPT :)
For example, when we send 1 busd to a pair address, such as BUSD/WBNB, won't the pair address directly give us WBNB in return?
Chatgpt says it gives one, it doesn't ...
2
votes
1
answer
571
views
How to buy with ethers js using Uniswap Universal router on Base? calling execute function
I want to buy new tokens launched on base using Uniswap Universal router on Base with node js and ether js libraries. Im calling execute function but I'm having many problems.
Here is the code:
//...
1
vote
1
answer
657
views
SyntaxError: Cannot convert 0.0 to a BigInt
What, is this?
SyntaxError: Cannot convert 0.0 to a BigInt
JS being JS. What else should we expect from the creators of NaN === NaN; // -> false ? This is one of the worst error reasons I've ...
0
votes
0
answers
61
views
I get an error when there is another tx record related to the target token in the same block
I create a smart contract and interact with node.js and buy and sell a token.
Here is part of my smart contract:
// TokenBuy Function ->
function buyToken(address token, uint amountOutMin, uint ...
0
votes
1
answer
119
views
Differentiate a swap and normal transfer on erc-20 token transaction
Hey i’ve been following this guild (https://stackoverflow.com/questions/67998154/how-to-calculate-the-total-volume-transacted-for-a-token-on-rsk) in the ✔️ answer section to calculate the volume for ...
0
votes
1
answer
68
views
Why is contract deploying, but giving an error on console
So I'm using ganache client and deploying the contract. I can see the contract on ganache and also the transaction. But on the console I'm getting following error:
...
code: 'UNKNOWN_ERROR',
...
0
votes
1
answer
219
views
How to ABI encode a contract function using ethers
The following function sends a transaction using ethers. Running this gives the error
TypeError: func.format is not a function. What am I doing wrong?
import { Contract, getDefaultProvider, AbiCoder, ...
1
vote
1
answer
81
views
Find ERC20/Polygon address with the beginning and end
I found this post: Find the address of the wallet know almost all the letters
I'm looking for a code to find an address on Polygon with a beginning and the end.
I have this information: 0x858b...4B7d. ...
1
vote
1
answer
36
views
unable to get trade data using @sushiswap/core-sdk
I am trying to get trade information based on user provided information, but code is failing at building Trade.
here is code
const sellAssetValue = {
decimal: 18,
symbol: 'ETH',
}
const ...
0
votes
0
answers
144
views
Timeout Error: eth_callBundle . Flashbot
Hi I am having an issue in flashbotsProvider.simulate() while pushing a transaction to the miners to be send to the block without sending it to the mempool.
Below is my source code
// 1. Import ...
0
votes
1
answer
111
views
Error "could not detect network" when using WebSocket provider with Alchemy
I have a file with over 1 million+ ethereum addresses and private keys grouped together in a single file separated only using a ','.
Example:
0x7256bCf73C2309893AA12d6b26A142AB3097560c,...
0
votes
0
answers
115
views
Getting error when connecting my ether js websocket provider to local node web socket server
So I am building my backend to listen for events. So I used the websocket provider of ether js to listen. Since it requires a websocket server url so I built my local websocket server.
But I am ...
0
votes
1
answer
29
views
Eth price dont update after another function iteration
Hi i have an issue i created a function that fetches prices from dex.This is looped every 5 sec and the prices should be up to date every 5 sec.The issues start because the price refreshes every few ...
0
votes
0
answers
38
views
Javascript FundMe Solidity Test code troubleshooting
Code 1 returns error while Code 2 doesn't, why?
CODE 1
const { assert, expect } = require("chai")
const { ethers } = require("hardhat")
describe("FundMe", function () {
...
0
votes
2
answers
250
views
How to Import OpenZeppelin Contracts with Node.js Environment
I'm having an issue. I'm attempting to compile my contract with Node.js inside of a VSCode terminal, but my openzeppelin imports aren't being seen, and I'm not sure how to handle them with Node.js. ...
0
votes
0
answers
184
views
How to swap tonkens in pancakeSwap using nodeJS
I need to write a script to swap tokens in PancakeSwap using NodeJS. I'm new to web3 development, so maybe I'm misunderstanding some of what I'm seeing in the various docs.
I know PancakeSwap doesn't ...
0
votes
0
answers
16
views
How to make many transactions in one transaction to pay less gas
Web3.js
Good afternoon, can you please tell me how I can make several transactions from different wallets to one wallet?
We have conditionally realized system of deposit and main wallet. When the ...
0
votes
0
answers
68
views
InvalidResponseError: Returned error: The method eth_sendTransaction does not exist/is not available
I'm trying to interact with a smart contract on BSCtest using web3. I think the error occurs in this line
rs = await TokenContract.methods.transfer(receiverAddress, 100000).send({
from: myAddress,
...
0
votes
2
answers
39
views
Js result into HTML
Hello hope everybody is good ?
I need some help please ..
I run my JS file and it return in my console with await function = 56
How can i parse the return (56) into my HTML in a <div ?
This is my ...
0
votes
1
answer
2k
views
Error with npm run start. code: 'MODULE_NOT_FOUND',
npm run start
> [email protected] start
> react-scripts --openssl-legacy-provider start
node:internal/modules/cjs/loader:1051
throw err;
^
Error: Cannot find module './nodes'
Require ...
0
votes
1
answer
177
views
How to get rid of the gas estimation error in ethers.js
const fs = require("fs-extra");
const { ethers, JsonRpcProvider } = require("ethers");
async function main() {
const provider = new ethers.providers.JsonRpcProvider(
"...
0
votes
2
answers
37
views
Trying to deploy simple smart contract in a local nodejs, mocha environment but receiving error from: 'npm run test'
I am trying to deploy a simple smart contract for testing.
Attached are the output of: 'npm run test'
as well as my test.js file and my package.json file
I hope its something obvious sorry if this is ...
0
votes
0
answers
16
views
web3 module takes nearly 500ms to load
I noticed my web3 scripts are very slow and after doing some testing I noticed that the web3 module takes 470ms alone to load.
Other modules only take 1 ms.
Is this normal? I have the latest version ...
0
votes
1
answer
55
views
Problems installing hardhat using npm and node
I really need to be able to use hardhat on vscode and I am having so many problems trying to use node and npm. Does anyone know how to solve these errors? I know node and npm are installed because I ...
0
votes
1
answer
172
views
ethers SERVER_ERROR that cannot be catched with try/catch
I am facing strange server error while trying to send eth transaction. It happens not every time and I cannot catch it with try/catch. Is there any known issue?
/root/app/node_modules/ethers-new/src....