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

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
10 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
11 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
10 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
57 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
0 answers
37 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
12 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
8 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
21 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
97 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
43 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
14 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
0 answers
22 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
41 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
0 answers
15 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
44 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
0 votes
1 answer
150 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
85 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
25 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
53 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
44 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
53 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
18 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
54 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
15 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
56 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,445
0 votes
2 answers
40 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
219 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
203 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
158 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
44 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
130 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
30 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
100 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
16 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
196 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
0 votes
1 answer
58 views

BIP32 Extended Public Key Generate Ethereum Address

BIP32 Extended Public Key How can I generate an address with node js? Is something like this possible
user avatar
0 votes
1 answer
27 views

Sending big values to wallet

I want to send big value (10000000) for example to other wallet but i have error like this: UnhandledPromiseRejectionWarning: Error: Error: [number-to-bn] while converting number 3.0244e+22 to BN.js ...
user avatar
0 votes
0 answers
78 views

Invalid Arrayify Value when querying Uniswap v3 Quoter contract

Does anyone know why my code for passing an array of pool addresses into the QuoterV2 quoteExactInput function is returning an 'invalid arrayify value' error? async function main() { var amt = ...
user avatar
0 votes
1 answer
91 views

i have problem installing truffle ,when i try npm truffle -v i get this error message

truffle : File C:\Users\hp\AppData\Roaming\npm\truffle.ps1 cannot be loaded. The file C:\Users\hp\AppData\Roaming\npm\truffle.ps1 is not digitally signed. You cannot run this script on the current ...
user avatar
  • 1
0 votes
0 answers
40 views

Block capacity - Hyperledger Besu

Good afternoon, I am trying to perform a transaction capacity test on my network with Hyperledger Besu with 4 validator nodes and a time per block of 4seconds. I have created a script with NodeJS that ...
user avatar
0 votes
0 answers
12 views

Error while sending transaction via node.js

I have error while I'm sending a transaction from node.js (influra) like this. Error: Invalid JSON RPC response: "invalid JWT\n" Why?
user avatar
0 votes
0 answers
39 views

BSC bot stops buying tokens after some time

I made a mostly profitable bot using node.js buying and selling shitcoins on BSC. However, sometimes the bot just stops buying. I use web3 to find relevant mined transactions (this part always works) ...
user avatar
  • 1
0 votes
0 answers
33 views

Can we sign and approve a transaction or call a function from our NodeJS Backend without involving metamask?

I am creating an NFT marketplace where I need to accept fiat payments. I am using stripe and after confirmation of fiat payment, I want to call the transfer function of my smart contract from NodeJs ...
user avatar
2 votes
1 answer
98 views

How to send Uniswap V3: Positions NFT to another wallet using Node.js

I have the private key for the wallet. How can I send Uniswap V3: Positions NFT (UNI-V3-POS) from this wallet to another wallet using Node.js and ethers.js for example? Token contract address: ...
user avatar
  • 21
0 votes
0 answers
23 views

IPFS .cat() method doesn’t return the content

I work with JavaScript and Browserify tool in Windows 10. With Browserify, One can require NodeJS modules on browser side. I required ipfs module for my JavaScript code in a .js file then browserfied ...
user avatar
  • 375
1 vote
1 answer
444 views

How to get connected wallet address in node.js server side

I couldn't find a way to obtain accounts the user connected in my website in my node.js web server. This is what I've tried const express = require('express'); const Web3 = require('web3'); const web3 ...
user avatar
  • 23
0 votes
0 answers
12 views

How to send my content to a global IPFS node?

To use IPFS in NodeJS, I require ipfs module. To connect a IPFS node I try: const IPFS=require("ipfs"); const node= await IPFS.create(); After that, When I run NodeJS in PowerShell, The ...
user avatar
  • 375
1 vote
3 answers
422 views

How to use web3.js in node.js web server

I am wondering how to use web3.js in my node.js web server in the correct way. I have a button in the homepage where allows users to connect to their wallet, and it is done in my front end. After ...
user avatar
  • 23
0 votes
2 answers
45 views

Web3.js Script exits while listening to CreatedPairs

I am trying to create a simple script to test the event listening functionality of Web3.js CreatedPairs. However, my script runs through the code once and then exits instead of continuing to listen ...
user avatar

1
2 3 4 5
15