Questions tagged [nodejs]

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications.

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

How to decrease computation time of generating addresses

I tried to create a mass wallet generator for a vanity address but it only checks 33 wallets a second. Is there any optimizations or bad practices you see? const cluster = require("node:cluster&...
user avatar
1 vote
2 answers
39 views

Can I know in real time when ether is coming into my account from Ethereum?

I would like to create a feature in my Dapp(nodejs) that notifies me when ether is coming into my account in real time. For example, is there a way to use websockets or APIs? Can anyone give me some ...
user avatar
0 votes
1 answer
11 views

Calling multiple contract methods in nodejs returns error

I'm developing a crypto bot with node and ethers. Had faced a lot of erros but was able to overcome till this one. I'm not a huge experienced dev and don't feel confortable with this architeture yet ...
user avatar
1 vote
1 answer
22 views

web3.eth - getBlock FetchError: request to https://eth-mainnet.g.alchemy.io/v2/api_key failed, reason: getaddrinfo ENOTFOUND eth-mainnet.g.alchemy.io

I'm trying to get Eth blocks by blockNum using Alchemy's apis. The docs mention two methods: getBlockByHash and getBlockByNum, but those methods don't exist on the web3.eth object. Here are the ...
user avatar
1 vote
1 answer
47 views

Why are all ethersjs & web3js calls to BSC network failing?

All calls using "wss://bsc-ws-node.nariox.org:443" and other RPC/WSS endpoints have been failing throughout this week. It just hangs and doesn’t return anything. This is happening in BSC ...
user avatar
  • 13
0 votes
0 answers
23 views

Get pending transaction in Golang?

I know how to get pending transaction, from Mempool that is, in JS/NodeJs. I want to do the same thing in Golang, though. How to do it? I haven't found any example.
user avatar
  • 1
0 votes
2 answers
39 views

tried running the contract but always getting the same error

//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; import "opezeppilines/openzeppelin-contracts-master/contracts/token/ERC20/ERC20.sol"; contract currency is ERC20 { ...
user avatar
0 votes
1 answer
18 views

Send token from owner account from backend (Custom ERC20 token)

I made a smart contract for token on the Polygon network. The server part is NodeJS. Now I'm trying to implement the functionality of sending tokens to the recipient's wallet from the token creator's ...
user avatar
0 votes
1 answer
16 views

How to extend functionality of geth (module, addon)?

Is there a way to extend functionality of geth using some sort of plugins, modules or addons? However, I haven't found any information about the topic. How to do it?
user avatar
0 votes
1 answer
28 views

I am getting this error everytime i test my contract using hardhat

This is the error i am getting while testing my contract with hardhat pls help me to get this PS E:\vs code files> npx hardhat test npm WARN config global `--global`, `--local` are deprecated. Use `...
user avatar
0 votes
0 answers
16 views

Attempting to deploy to ganache CLI says out of gas for test account

I am trying to deploy an Ethereum contract to a test network - the ganache CLI - but I am getting the following error: VM Exception while processing transaction: out of gas however when I call the ...
user avatar
0 votes
0 answers
11 views

Sign Message with Metamask In Pugjs Webpage

I have a NUXT app that involves signing a nonce with Metamask (NUXT is basically Vue with Server Side Rendering). This is the component where you sign a nonce to log in: handleSignMessage(...
user avatar
0 votes
0 answers
8 views

Using localhost from a different network

I'm currently making something using localhost, i want to access my localhost from a different network (nodejs). i made a discord bot on replit.com, and i want to use my localhost thing for my discord ...
user avatar
0 votes
0 answers
13 views

Writing special character inside the addParam when writing task function. ex: addParam("my:example")

Is there any way to write ":" or "_" or "-" in function "addParam()" inside "task". For example .addParam("my:example") or .addParam("...
user avatar
1 vote
1 answer
40 views

Executing on-chain functions using react moralis

I'm trying to convert my dapp from vanilla js + html (local hardhat node) to react-moralis + nextJS (local hardhat node). Here is an example of a contract function call from the front-end. This code ...
user avatar
0 votes
1 answer
13 views

Using node.js to get LimitOrders from 0x v4 API: once I've selected an order to fill, how do I proceed to call fillLimitOrder?

After getting all the orders from the v4 REST API and going through them, supposing that I have found an order I would like to fill, what do I need to do from this point to successfully call ...
user avatar
0 votes
0 answers
36 views

Error getting balanceOf of token with ethers.js

I'm using VoidSigner with zero address to request balanceOf token. I'm calling this from nodejs application which doesn't have a real wallet attached. This seems like a very straight forward code and ...
user avatar
0 votes
0 answers
11 views

How can i listen emitted event faster on ETH

i try to listen any movement from a contract, it's working but i receive the result above 40sec after the block is minted. But on BNB chain i receive the information instantly but on ETH it's take so ...
user avatar
  • 1
0 votes
1 answer
265 views

Error: chainId address mismatch

i'm trying to deploy a simple smart contract with node-js on a ganache-GUI but i keep getting this Error: chainId address mismatch; may chainId is the same as the networkId in the ganache app witch is ...
user avatar
0 votes
1 answer
103 views

Local hardhat node throws "Error: Transaction reverted" in the terminal for transactions that pass successfully

I'm developing a UI for my contract using a local hardhat node with an ethers library. I have several different contract function calls that pass successfully and do not throw any errors in browser ...
user avatar
0 votes
0 answers
16 views

how can do a Load Test for a web3 script?

In my scenario, I use truffle and ganache. I created a simple Contract like this contract SimpleContract { string public name ; uint counter = 0; event myEvent(uint id , string name); ...
user avatar
0 votes
0 answers
12 views

how to access ws connection in nodejs when truffle-config enables websockets

here is my truffle-config.js module.exports = { networks: { development: { host: "127.0.0.1", port: 9545, network_id: "*", websockets: true ...
user avatar
0 votes
0 answers
26 views

Access Ganache-CLI from several computers

I'm trying to create a project where Person A puts some data on a Ganache-CLI instance, and Person B is capable of retrieving it. This worked fine on one server, because Ganache-CLI was running on ...
user avatar
  • 3
0 votes
1 answer
487 views

Module not found: Error: Can't resolve 'crypto' in '/Users/user/Desktop/esample/react-minting-website/node_modules/eth-lib/lib'

I am building a development web 3 project and can't figure out why I get this error WARNING in src/App.js Line 2:10: 'useWeb3React' is defined but never used no-unused-vars Line 4:8: ...
user avatar
1 vote
2 answers
207 views

window is not defined when used with next.js

I am trying to write a React-next.js app. I have the following file that exports an instance of Web3 by passing in window.ethereum to the constructor. import Web3 from 'web3'; const web3 = new Web3(...
user avatar
0 votes
1 answer
29 views

Error: /api/v0/object has been removed, use /api/v0/dag instead

I am using ipfs for image upload in my form it was working fine but from few days back it's giving me the error. the following is my code. uploaddoc: function(){ const reader = new FileReader(); ...
user avatar
0 votes
1 answer
47 views

Problem with eth.sendRawTransaction in geth console

Im trying to use the following code with nodejs to create a raw transaction: const ethTx = require('ethereumjs-tx').Transaction; const txParams = { nonce: '0x0', gasPrice: '0x3B9ACA00', ...
user avatar
  • 1
0 votes
0 answers
87 views

Uncaught SyntaxError: Unexpected token x in JSON at position 1

While running this snippet below, getting error: Uncaught SyntaxError SyntaxError: Unexpected token x in JSON at position 1 const {ethers,Contract,utils}=require("ethers") const ERC20 = ...
user avatar
0 votes
1 answer
55 views

why vs code not recognizing the node version

when I install a "truffle for vs code" extension in vs code and try to create a new solidity project then nodejs version is not recognized but I have installed nodejs's correct version.
user avatar
  • 1
1 vote
2 answers
91 views

Slippage in ethers.js

Very new to this and can not really find anything on this, these two numbers 50 and 10000 do they = the same slippage? Is this auto slippage? I want 20% slippage for a launch today. async function ...
user avatar
  • 13
1 vote
1 answer
427 views

How to send BNB from my wallet to another wallet using web3?

I am sending BNB from one to another wallet but I a getting an error when I execute my code while I have 0.009 BNB in my wallet : Error: Returned error: insufficient funds for gas * price + value Here ...
user avatar
0 votes
1 answer
173 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
  • 113
0 votes
1 answer
87 views

Is there a multi-call equivalent for calls that aren't made to a smart contract?

I have an array with a bunch of events. I get the block number from these events but I also need the block.timestamp which isnt returned in the event object, its returned by getting the block. So I am ...
user avatar
0 votes
1 answer
100 views

about Swap tokens on Uniswap using a smart contract

I would like to build a bot (using VS code) that swaps ETH for other tokens and swap other tokens for ETH using a smart contract.I read the code in this article:https://cryptomarketpool.com/how-to-...
user avatar
0 votes
0 answers
51 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
84 views

openseaJs SDK error TypeError: Cannot read properties of undefined (reading 'target')

I am receiving this error from openseaJs while calling fullfillorder TypeError: Cannot read properties of undefined (reading 'target') at computeOrderParams (/…/node_modules/opensea-js/src/seaport.ts:...
user avatar
0 votes
0 answers
34 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
79 views

Error by npm run deploy_contract

am having an issue! I am getting a catch error ( catch ERROR: ERROR STATUS: 403) when I ran "npm run deploy_contract" 10k-collection-video@2.0.0 deploy_contract node utils/nftport/...
user avatar
  • 1
0 votes
0 answers
17 views

Linking OpenSea live-price from an auction to personal website

I want to auction on OpenSea. I am building a custom website to promote my NFT. On it, I have currently a listing price, but I would like to link a live-price via OS API. Is there a tutorial / simple ...
user avatar
  • 1
0 votes
1 answer
128 views

UniswapV3 price calculated using sqrtPriceX96 is wrong

I'm calculating a UniswapV3 pool's token0 price in Node.js. Using UniswapV3 SDK gives correct result, but manual calculation isn't. From the docs - sqrtPriceX96 = sqrt(price) * 2 ** 96 # divide both ...
user avatar
  • 2,533
0 votes
2 answers
63 views

Web3 make NodeJS wait until a promise gets resolved inside a subscription?

I have the following code: import Web3 from 'web3'; function waitForFunds() { let web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545')); return new Promise((resolve, ...
user avatar
  • 103
0 votes
0 answers
279 views

How to programmatically swap tokens using a smart contract with NodeJS and Solidity

I would like to build a bot (using VS code) that swaps ETH for other tokens and swap other tokens for ETH using a smart contract. I have used Remix IDE but I get errors that I can't fix. For example, &...
user avatar
0 votes
0 answers
377 views

Uncaught TypeError: Cannot read properties of undefined

I keep getting this error message in my browser inspect element console. 2shortenAddress.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'slice') at shortenAddress (...
user avatar
0 votes
1 answer
261 views

How to confirm a transaction in backend in behavior of the user?

I am developing an application where the front-end does not talk directly to the blockchain. Back-end does that instead, due to some proccesses that can only be done in the back-end (file manipulation,...
user avatar
0 votes
1 answer
52 views

I am following the Wormhole SDK to bridge from Fantom to Terra. and while I try to get signedVAA I got < ReferenceError: self is not defined>

const WORMHOLE_RPC_HOSTS = 'https://wormhole-v2-testnet-api.certus.one' const { signedVAA } = await getSignedVAA( WORMHOLE_RPC_HOSTS, CHAIN_ID_TERRA, emitterAddress, ...
user avatar
0 votes
1 answer
250 views

ReferenceError: Process is not defined

Here is the script in my deploy.js: const main = async () => { // We get the contract to deploy const Transactions = await hre.ethers.getContractFactory("Transactions"); const ...
user avatar
0 votes
1 answer
43 views

ReferenceError: greeter is not defined

Here is the script in my deploy.js: const main = async () => { // We get the contract to deploy const Transactions = await hre.ethers.getContractFactory("Transactions"); const ...
user avatar
0 votes
1 answer
171 views

I keep getting this error while trying to compile my contract trough the HardHat feature

Here is the script in my deploy.js: const main = async () => { // We get the contract to deploy const Transactions = await hre.ethers.getContractFactory("Transactions"); const ...
user avatar
0 votes
1 answer
24 views

What Database (or maybe the whole stack) should I use for a webapp?

I am thinking of making a webapp where I have to save some private data and other data that could be public. For simplicity let's say it's a quizzes page but it logs in with Metamask. We are going to ...
user avatar
0 votes
1 answer
379 views

error: Invalid JSON RPC response: "" when trying to transfer testnet token

I am trying to transfer testnet tokens using Node.js, Web3.js, Ethers, and Alchemy but I am receiving Invalid JSON RPC response: "" whenever I deploy my code to Railway. Is this an issue of ...
user avatar
  • 101

1
2 3 4 5
15