Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [nodejs]

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

0
votes
0answers
10 views

To transfer tokens using google cloud function

I am transferring token to the User's wallet when they create account. For that I am using google cloud functions. Here, on the account creation event, tokens will get transferred to the address. My ...
0
votes
1answer
21 views

How to configure APIs to run with Ropsten addresses

I have my contracts deployed on Ropsten network. I deployed those contracts from my local machine using Truffle migrate. Then I set up an AWS EC2 Ubuntu server to host my RESTful APIs. I installed ...
1
vote
1answer
36 views

How to call contract functions using web3?

I have deployed my contract in private blockchain, now I am calling functions using Nodejs and web3. Here, I want to transfer tokens for which I need to unlock my account from which I am transferring ...
0
votes
1answer
16 views

Doubt with ethereum-input-data-decoder when decoding a variable uint256

the input data of the variable uint256 is "22092018" but when using ethereum-input-data-decoder I return "BN: 15118f2". Instead of getting "BN: 15118f2" with the decoder, have the original value of ...
0
votes
0answers
31 views

FATAL ERROR: Rebalance Allocation failed - process out of memory

So while running truffle compile for my contracts on AWS Ubuntu server I got the following error: <--- Last few GCs ---> [17055:0x3985730] 11958 ms: Scavenge 511.7 (553.4) -> 506.9 (553.4) ...
1
vote
1answer
41 views

how to upload file into ipfs from node js without uploading files into node js server [closed]

I need to upload multiple files into ipfs from node js. Flow: file(html,angularJS) --> node.js --> IPFS --> ipfs hash save into DB. I have sent a file from HTML(angularJS) and I got the ...
0
votes
2answers
18 views

Web3 js APIs Installation Requirements

If I am using Infura Node interact with smart contracts. And I want to build/setup web3 apis on a ubuntu machine on AWS. Do i need to install truffle on that machine or just node.js and web3 is enough?...
0
votes
0answers
10 views

How to decode transfer log data Node

I am trying to decode transfer log to get the addresses to and from, and potentially the value but most important address from and to. const subscribe = () => { subscription = web3.eth....
0
votes
0answers
45 views

Error in compiling the contract [duplicate]

I am getting this error while compiling the contract using solc: assert.js:350 throw err; ^enter code here AssertionError [ERR_ASSERTION]: Invalid callback specified This is my deploy.js file.......
0
votes
0answers
30 views

Getting an error cannot read property “encodeParameters” of undefined

I am running a node.js server but while running it, i am getting following error. what could be the possible reason?
0
votes
0answers
30 views

i can't get rid of this error

const HDWalletProvider = require("truffle-hdwallet-provider"); const Web3 = require('web3'); const {interface,bytecode} = require('./compile.js'); const provider = new HDWalletProvider( 'slim ...
-1
votes
0answers
36 views

How to send API request in HTTPS to smart contract using nodeJS?

Please help me with nodeJS API request. I setup HTTPS server in app.js but still api sends the request in HTTP. How can I send a request to smart contract in HTTPS? Code: userCreationApiRoutes.post('...
0
votes
1answer
22 views

web3.eth.getBlockNumber returns { [Function: get] request: [Function: bound ] }

0 down vote favorite I am using express and web3 while i get the blockNumber it returns { [Function: get] request: [Function: bound ] } my code is var express = require('express'); var app = ...
2
votes
0answers
42 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 ...
1
vote
0answers
63 views

Deploying a smart contract

i was following this nice tutorial to make simple Daap,and at one place i got stuck. I'm really newish to that, so hope someone could explain that. This is the link and the place where i get stuck,if ...
0
votes
2answers
476 views

Error: Cannot find module 'truffle-hdwallet-provider'

I got the following errors while trying to deploy my smart contract: sers-Air:lottery user$ node deploy.js internal/modules/cjs/loader.js:582 throw err; ^ Error: Cannot find module '...
1
vote
1answer
38 views

Information lost when getting string from byte32 Solidiy smart contract

I have a number as a string which I pass to smart contract function as a parameter. The function takes byte32 as a parameter. Here is the node.js code for executing the contract function: const app =...
0
votes
1answer
40 views

“truffle test” says “assert.rejects” is not a function even it is Node 10

As per the official documentation, assert.rejects was added since Node v10.0.0. Also, the node console confirms that: even though, truffle test throws this error: TypeError: assert.rejects is ...
1
vote
1answer
32 views

Detecting nodes by an identity in Ethereum network?

According to this answer: (https://bitcoin.stackexchange.com/a/63657/41513) the following can be definition of a node: "A node is a computer that has a copy of the blockchain (or at least a part ...
0
votes
1answer
39 views

How can i get my var in Web3, i always get Promise { <pending> }

var gogo =web3.eth.getBalance("0xXXXXXXXXXXXXXX") .then(console.log); console.log(gogo); if (gogo > 123) { console.log('enough.'); } how to run if in this case? Thanks for helping me.
1
vote
1answer
151 views

Send signed transaction from nodejs to private SmartContract using webjs in Quorum network not working

Context I have a quorum network mounted following the example of 7nodes. In node 1 I have deployed a smart contract privately, putting the public key of this ("BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+...
1
vote
2answers
120 views

How to convert a uint to 64 byte hex string using Node.js?

Sir, If my uint is 10,how to convert 10 to '0x000000000000000000000000000000000000000000000000000000000000000a' by using Node.js? and reverse it from '...
1
vote
2answers
35 views

How to setup 'topics' for function getPastLogs ()?

Sir, I want to read the past event log by using getPastLogs(),but I got the whole log.I hope I can filter some log. I find I can setup the 'topics' in getPastLogs(),but it always fails. How ...
0
votes
1answer
94 views

ethers.js (node.js) call solidity function that is payable

I understand that you can send ethereum to a smart contract, although when you do this with sendTransaction it doesn't seem that you specify a function on the smart contract when you do this. I don't ...
0
votes
2answers
44 views

Blockchain app technical architecture

Let’s say I want to build an app that is not completely decentralized, in fact it serves Restful APIs to the frontend and uses a private ethereum blockchain in the backend to process sensitive data ...
0
votes
2answers
74 views

How to print web3.eth.<function> output on html page?

I am trying to print web3.eth.<function> output on a html page, but I cannot print it. I have followed this answer. My geth-node is running on --rpcport 8545. Let's see simple example to print ...
0
votes
2answers
31 views

Javascirpt 18 decimal number for parameter?

I have created an 18 decimal crypto token in ethereum. When executing smart contract method from javascript for uint256 input parameter, how can I specify the number with 18 zeros? Because javascript ...
0
votes
1answer
95 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-...
1
vote
1answer
49 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 ...
0
votes
1answer
16 views

How to code a Raw Txn using web3js?

I have this code which gives JSON error in web3. I tested the connections and reading the contract and that all works. There is something wrong with the "data" key in the JSON. Somehow the addBonus ...
2
votes
2answers
166 views

Unable to install web3 js for windows10

I am trying to install web3 using command npm install --save web3@1.0.0-beta.26 However, it is failing with error : verbose node v8.9.1 verbose npm v4.6.1 error code 128 error Command failed: ...
0
votes
1answer
53 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
1answer
66 views

Syncing events on Database - Dealing with blockchain reorganization

My Dapp relies on live events synchronization on a centralized database. There is always a server side script polling the blockchain for new events, parsing then and do the corresponding operations on ...
0
votes
1answer
29 views

Should I use Node.js server along with ethereum smart contracts to make Dapps?

I want to make a Dapp using ethereum. So, should I use a Node.js server and a database to store some user's data and store rest of the data on the smart contract that needs to be decentralized or ...
0
votes
1answer
45 views

Create accounts on ethereum network using programmatically generated key pairs and addresses

Say I have a node application that has user registration feature. Now when a user registers, using node libraries like crypto I generate a cryptographic key pair(private and public). Then also ...
1
vote
1answer
26 views

Solidity contract state is not updated by signed transaction in nodejs

By signed transaction using web3 in nodejs Transaction hash 0x3c7688326afc83e6524e8c491f203852e34aa0f572d952569b6253e98dbd83a1 Data ...
2
votes
0answers
182 views

ping / pong pattern for infura websocket [closed]

Infura websockets disconnect after an hour of in-activity so they suggest you ping / pong the connection at an interval less then an hour. My problem is I'm new to server-side programming and don't ...
1
vote
0answers
924 views

How do I send html form data as JSON content type with node js? [closed]

I have a smartcontract GovtContract that works fine when I use curl commands, $curl -X POST -H "Content-Type: application/json" localhost:3000/govtcontract/set -d '{"value":"5"}' | jq $curl -X GET -...
2
votes
1answer
72 views

how to fix “txHash: undefined” error using web3.js

anyone can fix this?? i always got output "txHash: undefined" var Tx = require('ethereumjs-tx') const Web3 = require('web3') const web3 = newWeb3('https://mainet.infura.io/') const account1 = '...
2
votes
1answer
26 views

multi addresses

how can i send to account2,account3 and account4 in one time transaction var Tx = require('ethereumjs-tx') const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io') const ...
0
votes
2answers
46 views

How to access ethereum smart contract functions from server side api calls using ExpressJS?

I have the abi and bytecode of contract functions. Is there a way to access them using api calls only(using web3 module or any other) since i want to integrate them in an android native app and thus ...
1
vote
1answer
101 views

How to calculate optimal gasPrice and gasLimit? [duplicate]

I am using rawTransactions and web3Instance.eth.sendSignedTransaction to deploy and interact with smart-contracts. The problem is that I can't figure out hot to calculate optimal gasPrice & ...
-1
votes
1answer
171 views

ethereum send transaction is not working?

I wrote a sample api to send ethers from one account to another account using rinkeby testnet.It's throwing the following error(I attached screenshot). Please tell me how to resolve that error and why ...
1
vote
1answer
87 views

Solidity mapping multiple items to one user

i'm trying to assign array of items to one user and i want to put address to mapping function and get all items like that: mapping(address => Item[]) public ownerToItems; but there is problem ...
2
votes
0answers
44 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 ...
3
votes
1answer
313 views

Does geth --syncmode light download the State Trie?

I'd like to download some recent version of the Ethereum State Trie. I read here that geth --syncmode light downloads the current state. But does that only encompass the most recent blocks or also a ...
1
vote
1answer
165 views

Ipfs.files.add promise throws error [closed]

I'm trying to upload a simple image file to IPFS using ipfs.files.add(). However, I can't seem to figure out why the promise throws an error. Here's the code: $(function() { $(window).load(...
0
votes
1answer
29 views

Is it safe to have a locally running Ethereum node exposing personal RPC API?

I am developing a REST API currently running off a node.js server. The API allows ethereum account creation, making a transaction etc. The API interacts with a locally running ethereum node to ...
1
vote
0answers
27 views

GETH node works on Apache but not on ExpressJs

I had a running GETH node linked to my localhost (hosted with Apache) , I had to migrate the project on a ExpressJs running on port 3000 and now I have Error: CONNECTION ERROR: Couldn't connect to ...
0
votes
0answers
29 views

Get estimated gas and provide gas limit in web3.js [duplicate]

I have written a web3.js implementation in Node.js(server-side). The code below invokes a method of solidity contract that writes some value to blockchain: var Coursetro = CoursetroContract.at('...