We’re rewarding the question askers & reputations are being recalculated! Read more.

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
0answers
10 views

Extract function names alongwith their parameter name and types from abi JSON file

My task is to get function names, its parameters and type of parameters from provided .json file. Then call each extracted function with extracted parameters. The code from this Get all function names ...
0
votes
1answer
17 views

Could not call contract function

I want to access the balance of contract(i.e. 0x552F3AfaA0394632f4aEfa9E923fA3e2bbDAF5FE) and its totalSupply(state variable). I could access the balancec of this contract , but why I could not call ...
0
votes
3answers
20 views

web3.eth.contract not working

I have web3@0.20.2 installed using npm . when I call web3.eth.contract() it says that it is not a function and when I use new web3.eth.contract it says it is neither a constructor. This is my code &...
0
votes
1answer
35 views

How to deploy and get address of smart contract in same javascript program

I want to deploy a smart contract (provided in .json file) and need its address (on testnet blockchain) and then try to send some transactions to it. All these should be done through javascript. Here ...
0
votes
1answer
14 views

How to know the execution time of transaction when miner execute it

When i send three consecutive transactions to my contract (deployed on ethereum testnet), how can i know the exact time (at milli/micro/nano level) which transaction executed (on miner side) first and ...
0
votes
3answers
29 views

Could not assign contract state variable value to javascript variable

I want to retrieve and assign the value of my contract state variable to my javascript variable.I am doing as per guidlines provided on this community, but failed to assigned. my javascript code is ...
1
vote
1answer
38 views

Generate new address, Send and Get transaction then Check transaction

I'm just starting in the ethereum and trying to build an app using Web3 and Nodejs. I'll need your lights so I can get any idea to know how to resolve those points: I have my own public address and ...
0
votes
1answer
22 views

getPastEvents on localhost is not a function error

Now, I'm working on an Ethereum Blockchain project to transfer the ownership of stored devices by using local web3 provider at the truffle environment. Truffle v5.0.27 (core: 5.0.27) Solidity v0.5....
0
votes
1answer
54 views

Invalid sender address, failed to deploy a transaction to the blockchain network

Description I'm trying to deploy a contract to rinkeby network, but everytime I like to deploy the contract it throwing error as invalid sender. Compile code const path = require('path'); const fs =...
0
votes
0answers
23 views

Ethereum payment processor Nodejs

I'm working on a web project where I need to have the ability to accept crypto payments. Implementing bitcoin was fairly easy as there were api's whom allowed me to directly subscribe to a specific ...
0
votes
1answer
16 views

Tokens are not being transferred with web3js

i have been using following code for transferring tokens from wallet to another with the use of web3js. async Transfer(eth_address, amount){ let tokenAddress = "...
0
votes
1answer
31 views

end process after web3 sendTransaction return transactionHash

I want to end the process after sendTransaction return transactionHash. Here is my code currently : const Web3 = require('web3'); const web3 = new Web3("http://127.0.0.1:8545"); async function task(...
0
votes
1answer
43 views

Unable to install web3 on windows 10

This is the error I get when I try to install web3 on my machine. After installing git I have another issue: C:\Windows\system32> npm install web3 npm ERR! code ENOENT npm ERR! syscall spawn git ...
1
vote
1answer
14 views

Geth and JavaScript

I want to deploy a private blockchain using Geth. I am considering using JavaScript to build the backend as I did before (NodeJS) but what about the smart contract? Since it is private is there a way ...
1
vote
1answer
37 views

How Can I Sign A Transaction Server-Side?

I have a server-side Node.js app that sends a transaction to an Ethereum smart contract like so: const transaction = await contract.methods .method_name([params]).send({ from: [...
0
votes
0answers
24 views

geth issues while running command

I am running the following command with added parameter miner.gastarget on a linux server since we had issues while developing, and have to increase gas limit sudo geth --ipcpath "/home/...
0
votes
1answer
94 views

Web3 js installation error

I want to install webjs so I run the below command but it is showing an error. $ sudo npm install -g web3 npm ERR! path git npm ERR! code ENOENT npm ERR! errno ENOENT npm ERR! syscall spawn ...
0
votes
1answer
29 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
1answer
34 views

Duplication of events in permissioned geth Chain with clique PoA consensus algorithm

I have an Ethereum chain running on my local host via geth and i am using the clique PoA Algorithm. I have 4 authority nodes so the number of Nodes allowed to sign a block should always be 1 because ...
0
votes
1answer
28 views

Not getting getPastEvents or once function using contract instance

I have followed Web3 documentation to subscribe an evnet, I have created Instance of web3 using infura url as argument. Created contract object using, const contract = web3.eth.contract(abi, ...
0
votes
1answer
33 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
0answers
60 views

TypeError: Cannot read property 'Crypto' of undefined

I have a code block for sending transaction let address_from = '0x0b2af884cc5a98816ba186ca6f7e839a7dd36053'; let address_to = req.params.address; let nonce = web3.eth.getTransactionCount(...
0
votes
1answer
45 views

How to connect a NodeJS App to locally running Ganache

Most of the tutorials I have found so far connect a FrontEnd App (say, React) through the web3.js that gets injected by Metamask. I have been asked to produce an NodeJS App that connects to a ...
0
votes
1answer
67 views

Ethereum gas limit using Geth

I am running a private blockchain using Geth, after upgrading the servers- I had stopped the miner and restarted it after upgrading the specs. Now I am getting all sorts of errors, the main one being ...
2
votes
1answer
64 views

Different outputs for Keccak256(), which one is right?

To get a value from contract storage I used this geth code succesfully: var contractAddress = '0x88e726de6cbadc47159c6ccd4f7868ae7a037730' var index = '...
0
votes
1answer
44 views

Load Smartcontract in Nodejs

I created the server based on golang. This server can load smart contract that is deployed using its address. It works on my local machine, but it does not work on EC2 instance. So I decided to ...
2
votes
2answers
94 views

Ganache GUI installation error

node version v12.8.0,npm version 6.10.2 I followed the below steps to install the ganache GUI but I got the error $mkdir ~/ganache $git clone https://github.com/trufflesuite/ganache.git $npm install ...
0
votes
3answers
77 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
20 views

truffle - toUtf8 on Migrations not working

I'm deploying my contracts via migrations and would like to show some info on the console about them just by getting data from these contracts and displaying it. I'm sending a deployed contract to the ...
0
votes
0answers
33 views

Cannot access myContract.events in web3.js version 0.20.7 [duplicate]

It seems that I do not have access to certain tools in web3js that allow me to subscribe to events. When I tried to use contractInstance.once('allEvents', callback) after instantiating a contract, I ...
0
votes
0answers
18 views

Can I Create Node.js API for each function in Smart Contract but sign a Transaction from frontend via Metamask.?

I am trying to develop a Dapp with nodejs backend but I cannot get accounts from Metamask which resides on my frontend. I tried to create an endpoint for each function in Smart Contract. And it seems ...
0
votes
1answer
65 views

Sending value to a solidity contract method from web3 results in `Invalid Tuple Value` error

I'm sending values to a solidity 0.5.1 method using web3 and keep getting an invalid Tuple value error. Here's the relevant contract code: struct mystruct { bytes32 id; string str; } ...
0
votes
1answer
96 views

Using vanilla javascript with web3 and metamask

I have searched severally on how to use web3 with metamask without nodejs without any success. I want to be able to get an instance of a user's metamask account through web3 and vanilla javascript ...
0
votes
1answer
38 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
0answers
17 views

How to save contract address to database with web3js and mongoose when I deploying a contract?

I wanted to get my contract address after it deployed, and then save it into my mongoDB. But instead of that, my contract address is deployed after it. So my mongoDB won't save my contract address. ...
0
votes
0answers
38 views

Handling a promise in a return function

I am trying to console.log the blockNumber that my transaction was confirmed in with the following code: web3.eth.sendTransaction( {from:account3, to: account2, value: web3.utils.toWei('1','ether'...
1
vote
0answers
56 views

Error while installing web3@1.0.0-beta.26 on Windows 10

I am getting the following error while installing web3@1.0.0-beta.26 on Windows 10. npm ERR! code ETARGET npm ERR! notarget No matching version found for web3-core@1.0.0 npm ERR! notarget In most ...
0
votes
1answer
46 views

How do I load the `web3` module using the html `script` element?

How do I load the web3 module into the frontend of my application using the html script element? I have already installed the web3 module using npm. This is the path to the web3 module in my app ...
0
votes
1answer
90 views

How to use window function in controller (node.js)?

So this is my users controller to upload a file : exports.postUploadFile = (req, res, next) => { var ethereumURI = req.body.ethereumURI; var abi = JSON.parse(req.body.abi); var ...
0
votes
1answer
187 views

Failed to install Truffle on MacOS Mojave

I am currently really struggling in getting Truffle up and running. I am running MacOS Mojave and have Node (v.10.16.0) and NPM (6.9.0) and have tried npm install -g truffle and have gotten: ...
1
vote
0answers
36 views

“truffle init” not working after installing

After I install truffle with: $ npm install -g truffle And get: /usr/local/Cellar/node/12.5.0/bin/truffle -> /usr/local/Cellar/node/12.5.0/lib/node_modules/truffle/build/cli.bundled.js ...
1
vote
0answers
139 views

raw_tx_demo.js of “Mastering Ethereum” : TypeError: ethTx is not a constructor

I ran raw_tx_demo.js, an example code on page 119 of "Mastering Ethereum" by Antonopoulos and Wood, but got an error message below: $ node raw_tx_demo.js /Users/gemcutter/raw_tx_demo.js:22 tx = new ...
0
votes
0answers
59 views

intermediate value is not iterable

I try to construct a transaction with Node (11.4.0), ethereumjs-tx (1.3.7) and web3 (1.0.0-beta.55) and Infura. Infura gives me '0x35b' for the nonce, then I create the tx: amount = 0.001; nonce = '...
0
votes
1answer
220 views

TypeError: this.provider.sendAsync is not a function

First I connected web3 with Infura. Then reading an ethereum account. I receive the following error while fetching account balance through node.js console. > web3.eth.getBalance(address, (err, ...
1
vote
1answer
47 views

Error installing zos-lib@2.4.0

I am working through the tutorial for zeppelin-os found here: https://docs.zeppelinos.org/docs/linking.html and have an error when running zos create Could not find file zos-lib/contracts/...
0
votes
0answers
25 views

I keep getting this Error when i tried to use contracts instance to call a contract's function?

I tried creating instance by: const certificate = Certificate.deployed(); OR const certificate = Certificate.at(config.contract_id); ANd i get this Error below: TypeError: Cannot read property '...
1
vote
1answer
101 views

Store data on Blockchain via Backend App

First of all, sorry about my bad english. I looked in the forum but I did not find a similar situation, but I apologize if I'm repeating something here. I need to develop an application that runs on ...
2
votes
0answers
66 views

Error while importing Libp2p package in blockchain

I have installed some js-libp2p's packages on my Ethereum Blockchain-ipfs project and I wrote some codes like below. const TCP = require('libp2p-tcp'); const MulticastDNS = require('libp2p-mdns'); ...
1
vote
0answers
36 views

Trying and failing to switch my dapp from local node to infura, please help? [closed]

I have a nodejs 'server' running that listens for events on the blockchain. Currently I have this line in my code: var provider = new Web3.providers.HttpProvider("http://localhost:8545"); But I'm ...
1
vote
1answer
200 views

Smart Contract is being deployed but call does not return contract address after deployment

So I have been trying to deploy a smart contract using nodejs, but when I call the function to deploy, I get no contract address on my console. It's like the send() function never completed its ...