Questions tagged [nodejs]

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

237 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
231 views

how to get revert at the previous timestamp of evm in testrpc

I am testing my contracts so at some point i need to increase the timestamp of evm that i achieve through evm_timeIncrease but now i want to execute some functions on the basis of current timestamp ...
4
votes
0answers
486 views

sendTransaction and events not working in NodeJS app

I have a contract deployed on the testnet, I can do the following within geth: reference.transfer.sendTransaction(bob, 467, {from:me}) However I can't do this within my node console (with web3 etc. ...
3
votes
0answers
211 views

Geth - Events not working/firing

I have an API (expressjs - nodejs) listening for different events from my contract. var web3 = new Web3(new Web3.providers.WebsocketProvider("ws://localhost:8546")); var tokenContract = new web3.eth....
3
votes
0answers
93 views

SQL syntax error near `logsBloom` when call web3.eth.sendTransaction

When I am trying to call web3.eth.sendTransaction I receive this error stack: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ...
3
votes
0answers
618 views

web3.eth.getBalance(address) throws an error: Invalid JSON RPC response: ""

var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); web3.eth.getBalance(address) throws an error: Invalid JSON RPC response: "" while address is some existing valid ...
3
votes
0answers
613 views

"Invalid DER format public key" error trying to use bitcore-ecies for encryption with Ethereum keys

I started this blog for generation of the keys. Which I'm able to follow successfully. My generated Private, public key and the address is mentioned in the testIdentity variable in the code below. ...
2
votes
0answers
28 views

Why does web3 say the transaction hasn't been mined in 750 seconds when the blockchain transaction says it was mined in 1:30 seconds

We keep getting an error from our node application with the following error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent. Be aware that it might ...
2
votes
1answer
73 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
0answers
156 views

How do i get the amount of tokens received for a swap on Uniswap/Pancakeswap so i can exchange them back later

I have successfully used the swapExactTokensForTokens() and approve() functions on Pancakeswap with ethers js. Uniswap docs say that swapExactTokensForTokens() returns The input token amount and all ...
2
votes
0answers
109 views

Arrayify error, when passing a string as an argument to a transaction

I have been having this problem with the web3 library for a while now and I am not sure how to solve. I am encoding a transaction within a react app. So far, all contract interactions inside the app ...
2
votes
0answers
202 views

Call() function returns "Error: Returned values aren't valid, did it run Out of Gas?"

I am connecting to Binance Smart Chain mainnet via rpc. The error message I get is following: (node:17667) UnhandledPromiseRejectionWarning: Error: Returned values aren't valid, did it run Out of Gas? ...
2
votes
0answers
162 views

Compatible versions of npm, truffle, node and web3 for Solidity 0.7.2

I'm using: Solidity 0.7.2, Node v12.18.4, Truffle v5.1.49 (core: 5.1.49), npm 6.14.8, web3 1.3.0 I want to know what versions are compatible with solidity 0.7.2. Many thanks and have a nice weekend.
2
votes
1answer
312 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 ...
2
votes
1answer
208 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?
2
votes
0answers
445 views

Transaction not mined error when deploying to quorum maker server

I get the following error when attempting to deploy my zeppelin erc20 token to a quorum server(used quorum maker). (master) $ node migrations/2_proj.js ``````` transactionHash ...
2
votes
0answers
182 views

Initialize Metamask from front-end use of Nodejs

Building a simple ERC-20 Token payment screen for a simple shopping cart. I am having an issue figuring out how to use Metamask to allow others to make secure payments. As we dont have access to other ...
2
votes
0answers
631 views

How to sign transactions using metamask while developing in nodejs?

I am developing an application in nodejs. I need to interact with my smart contract and also want to sign the transaction using metamask as I don't want to manage they keys. I copied the following ...
2
votes
2answers
109 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 ...
2
votes
0answers
86 views

Input data into remix through javascript

I am trying to update and call data to remix using node js. I have the temperature captured in my js code and I am trying to call it using the updateWeather function. Node.js code let request = ...
2
votes
0answers
360 views

Customizable key generator for Node JS

I've been looking for a javescript/nodejs package that would take a passphrase as input and generate a public key. But I need it to produce the exact same public key with the exact same passphrase - ...
2
votes
0answers
104 views

Can a view function from a funded smart contract execute a send() transaction on an external contract?

I'm creating an open source voting app with a Node.JS front end. I'm hoping I can create a smart contract that can use funds allocated to it at creation time, so that participating voters don't have ...
2
votes
1answer
322 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 ...
2
votes
0answers
345 views

Using Truffle with Node JS (MongoDB)

I am trying to use truffle along with a MongoDB database which means that I need multiple ports. For local testing, I have been starting up my RPC, switching the port that the app is listening, and ...
2
votes
0answers
164 views

web3.eth.subscribe give response blank

I am using web3 1.0.0 on nodejs all working fine but web3.eth.subscribe not working for pendingTransactions, I don't understand what is the issue. I'm using web3 version : 1.0.0 OS : windows ...
2
votes
1answer
565 views

How to call the functions of Ethereum Smart Contract from Android/iOS application?

I've been learning solidity & viper for some time now but i am wondering if it's possible to call the functions/methods of a smart contract (already deployed on Ethereum Network) from an Android/...
2
votes
0answers
764 views

Swarm web3 upload file from browser

Im following this documentation to implement an application that I pick a file with an input tag <input id="upload" type="file" /> and im tyring to upload using web3 js : document....
2
votes
0answers
1k views

Ledger Wallet Node JS api signTransaction_async - implementation issue

I tried to implement the Ledger node js api (https://www.npmjs.com/package/ledgerco) in my application. The first part with getAddress_async works, but I’m stuck with the signTransaction_async. I ...
2
votes
0answers
642 views

Unable to send eth with the web3 API

I'm new to this web3 API and I'm trying to use it with NodeJS. I've not been able to make a single transaction from one address to another. I've been able to successfully retrieve the balance of my ...
2
votes
0answers
420 views

Parity with Nodejs - Sending bulk transactions

I'm running a private testnet with Parity, and interacting with it using a nodejs cli. I have a script with which I trigger multiple transactions in quick succession for a smart contract that I have ...
2
votes
0answers
668 views

reference a deployed contract in truffle or node.js

I have a previously deployed contract on my PRIVATE-NET which I know its address. Now I am using truffle. How do I reference this contract in truffle console using its address? I looked through web3....
2
votes
0answers
269 views

Unit testing compiled Contracts with Pudding and Mocha + NodeJS constructor not being invoked

I just starting out looking at Ethereum and am trying to test a Contract (using the simple cryptocurrency contract as an example) using Mocha, so I can take advantage of things like chai and sinon, ...
2
votes
1answer
452 views

How do I close web3 such that mocha tests exit properly?

I'm writing a simple NodeJS (Node 9.4.0) server that's using web3 (1 beta) to interact with Ethereum. I've created a simple utility web3 as follows: const Web3 = require('web3') const url = process....
1
vote
2answers
33 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 ...
1
vote
0answers
58 views

How to transfer an ERC1155 Matic token using Node.js?

I'm trying to write a Node script that will transfer an ERC1155 token on the Matic network from my address to someone else's address. Here's an example token: https://opensea.io/assets/matic/...
1
vote
0answers
17 views

How to decode estimateGas Error

i'm having a problem with estimateGas function. var method = contract.methods.doSomething(); var estimateGas = await method.estimateGas({ from: address, to: toAddress, }).then(...
1
vote
0answers
242 views

[ Web3.js on BSC ]: Returned error: unknown account

Here's the error: index.js:1 Error: Returned error: unknown account I'm getting this error while running this method: nftMintingContract.methods.mint(account, cid).send({from: account}) The ...
1
vote
0answers
20 views

How to know the number of transactions sent to an address?

Ethereum assign random nonces to contract transacctions? I am trying to send my transacctions with web3js assigning a correlative nonce. I read the last nonce and increment it in one to send the tranx....
1
vote
0answers
43 views

How to query DyDx liquidations from ethereum blockchain?

As far as I understand, all the exchanges like DyDx, Uniswap, Sushiswap etc. are actually contracts deployed on blockchain. So their data should be accessible to anyone having the chain downloaded. (...
1
vote
0answers
305 views

How to get method name from transaction history (since the beginning and news in realtime)

My job is to get all the method name from the token contract transactions from the beginning and to display the new transactions in realtime. 1) Get all events For the moment I can display the "...
1
vote
0answers
744 views

calculate automatic slippage for pancakeswap exchange like Poocoin.app does

I am trying to automate swap on pancakeswap but for some tokens manual slippage percent doesn't help and it fails. I need to set slippage automatically every time based on token requirement. In ...
1
vote
0answers
97 views

bsc get transaction list by address Web3 (realtime,socket)

How can I track transactions of a wallet in the bsc network instantly? (I am thinking of using web3 js.) I don't want to do it with the api on BSCscan. As far as I know, it does not show it instantly.
1
vote
0answers
139 views

Object { code: -32000, message: "unknown account" } while sending transaction to smart contract

I know there are many questions revolving around same. But none of the answers are concrete. I have deployed my contract using remix on BSC test net and now making frontend to interact with my ...
1
vote
0answers
24 views

must be a lvalue, what's this error mean, precisely?

I am writing a few contracts and I'm all good to go until I migrate and hit this bump in the road, it has tormented me for 3 days I can't seem to figure out the issue I am thinking it is a camel case ...
1
vote
0answers
89 views

subscribe to address (wallet) and get transaction info including receiving token name (if token)

I just started playing arround with blockchain development and the use of web3 so I have more questions than my fingers are able to type, hope some of you are able to answer the first one I have. What ...
1
vote
1answer
934 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
0answers
97 views

Calculating price of a token

I am trying to calculate the price of an ERC20 token. My approach is to determine the total value of the token pool and divide that by the total number of tokens. However, the values I am getting for ...
1
vote
3answers
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
59 views

Verifying ETH Deposit Contract signatures using Chainsafe BLS library

I am attempting to verify BLS signatures using the Chainsafe BLS library. I am attempting to independently verify signatures associated with deposits to the ETH Deposit Contract. In order to test that ...
1
vote
0answers
26 views

How to filter 2 indexed event fields, both fields array?

I have this event: event onSubmissionBoth(bytes32[] indexed docHash, string[] indexed doc4DHash); Now I log into the event like this: function submitHash(bytes32[] calldata docHash,string[] calldata ...
1
vote
1answer
95 views

Node version upgrade for contract deployment throws error

I wrote a solidity contract using version 0.4.24 using OpenZeppline-solidity version 1.12.0. This used to deploy using the Nodejs version 8.12. The Nodejs version 8 is no longer being maintained from ...

1
2 3 4 5