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
3answers
17 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
28 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 ...
1
vote
1answer
334 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 :', ...
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
13 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
1answer
99 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
3answers
28 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 ...
0
votes
1answer
177 views

Calling contracts on server side with metamask

My application is in nodejs platform. I'm calling the contracts on server side by setting up provider as web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545")); Is it ...
0
votes
1answer
143 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 ...
0
votes
1answer
102 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
1answer
117 views

web3 js send ether not broadcasting on main net

I am using folowing code sample to send ether between 2 of my own accounts, both have enough funds: "use strict"; var Web3 = require('web3'); var Tx = require('ethereumjs-tx'); // Show Web3 where it ...
1
vote
1answer
34 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 ...
5
votes
1answer
464 views

Connecting to remote Geth client from AWS hosted server via web3 needs fix

There is a general problem that is affecting most everyone who tries to initialize AWS hosted servers with a remote Geth instance. It would be great to have documentation to address a fix or at least ...
1
vote
1answer
208 views

Retrieve event args from getPastLogs

When we use web3.eth.getPastLogs it returns topic and data properties together with rest data. Does it possible to retrieve event args parsing just data and topic as filter? Without to make additional ...
1
vote
1answer
63 views

liaison entre web3 et nodejs [using web3js and nodjs]

Bonjour, j'ai développé une app avec nodejs et je voulais la transférer vers une dapp en intégrant le web3 librairie. En effet j'ai crée les smart contract il le me reste juste la façon de faire la ...
0
votes
2answers
117 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 ...
3
votes
3answers
485 views

web3.eth.Contract(abi, address) doesn't return contract instance

i'am trying to make a instance of my contract in js using web3, but when I use the function web3.eth.Contract(abi, address) the result is not the expected(I take the ABI from remix). this is the code:...
2
votes
2answers
85 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
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
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 ...
13
votes
5answers
9k views

web3.js with promisified API

I'd like to take away the pain from web3 development callback hell and use Promise pattern and async/await keywords on both client side and on Node.js. Do there exist any web3.js builds or forks that ...
1
vote
1answer
141 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 ...
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
2answers
63 views

Solidity event isn't fired

I'm trying to listen for an event I've created on remix IDE , from NodeJS. I call a smart contract method from where the event is triggered and I'm waiting for it in my console...but I don't receive ...
0
votes
1answer
289 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....
1
vote
1answer
226 views

Error: Node error: {“code”:-32015,“data”:“Reverted 0x”,“message”:“VM execution error.”}

I deployed my smart contract on Kovan Etherium testnet. After that, I am trying to interact with smart contract methods using web3 1.0.0. Below is my node js code: var Web3 = require('web3'); var api ...
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
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 ...
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
15 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 = "...
16
votes
5answers
26k views

How to send ERC20 token using Web3 API?

I created some custom token in Ropsten testnet using this guide: https://steemit.com/ethereum/@maxnachamkin/how-to-create-your-own-ethereum-token-in-an-hour-erc20-verified I can send it to other ...
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"; ...
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
1answer
286 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
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 ...
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 ...
0
votes
1answer
156 views

Solidity solc compiler error on code Remix can compile

I am attempting to compile the following solidity code using solc in NodeJS. pragma solidity ^0.4.11; contract helloWorld { string public message; function constructor() public{ message = "...
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
1answer
91 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
0answers
23 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/...
2
votes
1answer
226 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
1answer
233 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. ...
3
votes
1answer
437 views

Cannot make subscribe newBlockHeaders work

I'm doing this to get all blocks from the network: var web3 = new Web3(); web3.setProvider(new Web3.providers.IpcProvider("...", net)); web3.eth.subscribe('newBlockHeaders', function (err, result) { ...
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: ...
1
vote
1answer
571 views

Parity, Web3, Nodejs - Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent

I'm using Parity ( "ropsten" test net), Nodejs and web3js to deploy smart contract from my system. Parity is synchronised in test mode, but when I run below code using Nodejs, it gave me a transaction ...
2
votes
1answer
1k views

How web3.eth subscription works?

I tried code from web3js docs , but it didnt woork for me. I dont get any logs. Any idea why? code i used: var subscription = web3.eth.subscribe('syncing', function(error, sync){ if (!error) ...
19
votes
6answers
28k views

Deploy contract from NodeJS using web3

I'm trying to create and deploy a smart contract through NodeJS using web3, but it is not working as I get a "web3.eth.contract.new is not a function". Here is my code: var web3 = require('ethereum....
1
vote
1answer
783 views

call to smart contract function from express project using web3

I'm trying to create a API fo my smart contract functions like following: router.get('/',function (req,res) { var web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/key'));...
0
votes
1answer
375 views

Error: `Invalid JSON RPC response` when running estimateGas on Infura

Why am I getting an error when doing a gas estimation on infura. I am using web3 v1.0 and here is my code: let Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('http://...