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
1
vote
4answers
1k views

Cannot install truffle. Node.js and npm are installed

I currently have node 12.21.0 + npm 6.14.41 + macos big sur 11.2.1 + ganache 2.5.4 + command line for xtools 12.4 I read online that truffle does not support node v13, so i uninstalled the one i had (...
1
vote
1answer
883 views

Cannot connect to ganache-cli with web3 and nodejs

from package.json: "ganache-cli": "^6.3.0", "web3": "^1.0.0-beta.41", in my createContract.js const Web3 = require("web3"); const ganache = require("ganache-cli"); console.log('ganache.provider :', ...
1
vote
1answer
446 views

How do I send multiple transactions from one wallet in Nodejs?

Hi I've been reading around and I came across Web3.js It's not apparent to me how I can send Ether from one wallet to multiple recipients other than in a batch-style request (which inevitably takes a ...
1
vote
1answer
445 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
0
votes
1answer
125 views

Setting the value of AmountOutIn

I have been running this small script to buy through the PCS router contract and as it works, the slippage is set to 0. I need to know how to find the value and what it expects so that i can set ...
2
votes
1answer
127 views

Get all ERC-20 token balances of address

What is the best way to get all the token balances of an address? I Monitor the while blockchain and got Like 6k token contracts Stored. IS there any way to get all token balances of an address ...
2
votes
1answer
353 views

Events stop triggering after a while

I created a script that subscribes to PairCreated event on Uniswap using Web3 and Infura API. The event works for a few minutes but stops working after a while (timeouts?). How can I make it watch the ...
0
votes
0answers
8 views

console.log fails transaction

Let's say I have a system made up of four different sections with contracts, proxies, node files, etc: 1--------- | | | 2--------- | | | 3---...
0
votes
1answer
377 views

Error while I am compiling the contract using node

saitejas-MacBook-Air:Inbox saitejakuruva$ sudo node compile.js assert.js:340 throw err; ^ AssertionError [ERR_ASSERTION]: Invalid callback specified. at wrapCallback (/Users/saitejakuruva/...
0
votes
2answers
290 views

Ethereum transactions inside full node

I am creating basic peer-to-peer ETH exchange on running geth full node, and can't find out how to make transactions inside node, from one account to another. Is it even possible to transfer funds ...
1
vote
1answer
210 views

Problems subscribing to infura via websockets

So I have a dapp that includes a node server, which I have got to work successfully using ganache, using this line: web3 = new Web3(new Web3.providers.WebsocketProvider('http://127.0.0.1:8545')) I ...
1
vote
2answers
234 views

Hardhat: How to "spin up" a local JSON-RPC fork node at a specific block number with my new contract deployed in it?

I can "spin up" a local fake blockchain in Terminal using $ hardhat node I can also make it fork the real mainnet using Alchemy, even pin it to a specific block N. Other local applications ...
0
votes
1answer
20 views

How to detect if user burned tokens

Looking through the code of ERC20 tokens they have the ability to burn and mint new tokens. I want to write a nodejs program that monitors if a user burns a token and then sends them a new one if ...
1
vote
1answer
265 views

Why does triggering a send on a contract method work, while call doesn't?

I'm still somewhat new to web development and solidity, so do correct any of my misunderstandings. I've been working with web3 on the front end, but now I'm trying to set up a server side web3 ...
0
votes
0answers
27 views

how to debug this "Error: Transaction has been reverted by the EVM"

const Web3=require('web3'); var Tx = require('ethereumjs-tx').Transaction; const web3=new Web3('https://ropsten.infura.io/v3/1e9dedc0e54e44559345e5636c004114'); var account1='...
0
votes
0answers
36 views

Pancakeswap: TRANSFER_FAILED. Why?

I am trying to buy a token at the listing time, but my transactions get rejected with the error "TRANSFER_FAILED" while other transactions at the same time are successful. I have tried high ...
2
votes
2answers
113 views

Deploying contract using web3js fails

I am trying to deploy contract using web3js in nodejs on ganache cli test server, but it fails with error as follows : D:\Thrive\PoC\NodeWebAPI\node_modules\web3\lib\web3\contract.js:149 ...
0
votes
2answers
930 views

How to state private keys when using node.js and ethereum to run a contract?

I have to run node.js to execute smart contracts. My quetsion is about the keys. I have seen this from the docs - 1. Code to sign 2. Code to execute But I am unsure how the two are combined. Could ...
1
vote
0answers
25 views

web3.eth.sendSignedTransaction doesnt return a receipt

I am trying to transfer some funds using a NodeJS application. The code I am using is: async function transfer(to, amountToSend) { return new Promise(async (resolve, reject) => { var ...
0
votes
2answers
166 views

format transfered value with contracts decimals

I have the amount of transfered tokens converted from a transactionreceipts log data. for example USDT the value I got is 500000000 , USDT has 6 decimals. The actual transfered value is only 500 USDT, ...
0
votes
1answer
40 views

Difference between smart contract and wallet address

I have list of addresses & I am trying to find out if the address is wallet address or smart contract address. I am using web3js. Is there any way to distinguish between smart contract and wallet ...
0
votes
1answer
37 views

Is there any way to listen smart contract events from nodejs-expressjs server?

I am developing a smart contract project and I need to listen events on my expressjs-server. Is it possible to listen events from there?
0
votes
0answers
11 views

how to remove stacktrace in console log

how to remove this stack trace in console log?
0
votes
1answer
270 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
1
vote
1answer
1k views

Subscribing to events using ethers / hardhat network

I have a basic node express application. It connects to my locally running hardhat network via ethers & websocket. The connection seems to work, since I can query the blockchain succesfully (for ...
1
vote
1answer
182 views

How can I configure node when I run truffle test?

How can I get truffle test to execute node with the --abort-on-uncaught-exception option? I'm guessing that I should probably add something in the Truffle's configuration file (truffle.js), but the ...
2
votes
1answer
235 views

How to deploy blockchain app in heroku

I want to deploy my blockchain app in heroku and i just want to use ganache as my blockchain network. is that possible?
0
votes
1answer
261 views

Make offer to opensea asset through opensea-js

I'm using opensea-js alongside with nodejs to make offer on opensea testnet assets. The code is following: process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const Web3 = require('web3') const opensea = ...
0
votes
1answer
22 views

UnhandledPromiseRejectionWarning: Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent

I am trying to run the below code: // Import modules var Web3 = require("web3"); const HDWalletProvider = require("truffle-hdwallet-provider"); const { interface, bytecode } = ...
0
votes
1answer
130 views

BEP20: transfer amount exceeds allowance

I want to swap bep20 tokens like BUSD - BNB and BNB - BUSD, i already approved tokens for the swapping but while i try to swap BNB - BUSD it's throw error like BEP20: transfer amount exceeds allowance ...
0
votes
0answers
88 views

Best approach for historical token balances for each specified wallet

I am trying to archieve the following: -have a set of wallets -have the erc20 token balances for each of these wallets (every token on the chain or at least top 500) -data updated as close to ...
1
vote
1answer
1k views

Sending string as address to smartcontract

I have trouble sending an address to a deployed contract, my function looks like this: function addNote(uint _value, address _owner) public { ... } and when I'm sending the parameters: contract....
0
votes
1answer
308 views

About send Ethereum Classic (ETC) coin

Need guideline for send ETC coin using web3js,As per documented flow I understand we can access all methods same as ETH but I have query regarding set provider for ETC after that I can connect to ETC ...
0
votes
1answer
106 views

Best practice for Single or Multiple instances of Provider for different types of block chain requests #

What the best practice is in terms of using the ethers provider as either a singleton (or persistent instance) in a module or to create a new instance every time a request is made. For example, for a ...
0
votes
1answer
38 views

EtherscanProvider.getHistory(), got an error;

nodejs.SERVER_ERRORError: missing response (requestBody=null, requestMethod="GET", serverError={"code":"ECONNRESET","path":null,"host":"api....
0
votes
2answers
829 views

Error: Cannot find module 'ethereumjs-wallet'

A truffle test needs ethereumjs-wallet const wallet = require('ethereumjs-wallet'); I tried npm install ethereumjs-wallet and even npm uninstall ethereumjs-wallet npm install --save ethereumjs-...
0
votes
1answer
38 views

AnyswapV5ERC20 deployment - set totalSupply

I have some questions about the anyswapV5ERC20.sol contract. First of all, are there some more detailed docs than the guide of andre cronje? My main question is: How can I set the totalSupply or mint ...
16
votes
4answers
23k views

unable to connect Ethereum node even RPC port: 8545 is open

I have created my private Ethereum blockchain network. From different servers I am able to connected and added into the network as peer without any problem. The way I run my server: geth --...
0
votes
1answer
160 views

Deploy contract didnt resolve the promise

im facing a problem deploying a simple smart contract. When i use ganacha-cli, the program enter in a loop of confimation event, counting from 1. Thats the first problem. Output: Account: ...
0
votes
1answer
3k views

Get an error: insufficient funds for gas * price + value

I need to send erc20 tokens from one address to another, provided that the token balance is not empty. I check the balance as follows: const balance = contractInstance.methods.balanceOf (...
0
votes
0answers
19 views

Check if smart contract function exists from code and then call it

I'm getting the code of a smart contract by using web3.eth.getCode(contract_address) I want to call certain functions that I'm fairly certain exist on that contract, however I don't know the ...
0
votes
3answers
2k views

calling smart contract functions from app.js

I deployed a smart contract to ganache network using truffle from account1. The code of smart contract is as follows. pragma solidity ^0.4.0; import "./strings.sol"; import "./safemath.sol"; ...
1
vote
2answers
3k views

How to get always the right price for all BSC tokens? Ethers.js

I'm coding my small app and I'm having trouble getting BSC token prices. The problem is: I'm getting weird values for some specific pairs (eg. SHARD/WBNB, SAFEMARS/WBNB) How can I get a basic and ...
0
votes
1answer
297 views

testrpc --account private key length is invalid even though its my account

I tried to initiate a testrpc account and passing my account with value to test the transactions but when I keyed in my key 0x94fd019eeb92780477b01ce5555513d3755b5193 it says that the key is invalid. ...
2
votes
1answer
337 views

Does it make sense to have a Node.js backend serving json to frontend for dapp?

Currently, the architecture I am looking at is that the smart contract (SC) sits on the ethereum network, but it is a complex and multilevel contract system. Just navigating through the tiers of the ...
0
votes
0answers
45 views

web3.eth.getBlock(i) is not working in my code. i am getting error for the 2nd block which is web3.eth.Block(1). Please anyone help

async function AllDocuments() { try { const latest = await web3.eth.getBlockNumber() let txStr = '' console.log("latest") for(let i = 0; i <= latest; i++ ) { ...
0
votes
0answers
9 views

Listen events synchronously using web3js

I am listening two events like this. contractConnection.events.allEvents(options).on('data', async (data) => { if (data.event == 'AddData') { await this.storeSecondarySale(data....
0
votes
4answers
455 views

Response stuck when creating contract

I am creating a contract on my local blockchain network using web3. On my node , contact is created and address is generated. But on node application, response is struck. Here is my node code: ...
0
votes
0answers
100 views

OpenSea.js No output using web3 and node 8

Working with OpenSea.js and have the following code but the output is absolutely nothing. Can someone help? const Web3 = require("web3"); const OpenSea = require("opensea-js"); // ...
0
votes
0answers
89 views

How to load web3 in front-end correctly?

I am trying to develop a new Dapp. I have written the smart contracts and they are working well. I now need to use web3 to interact with the smart contracts, for now using ropsten or rinkeby. I get ...

1
2 3 4 5
13