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
1answer
592 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
66 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
156 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
1answer
121 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
249 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
1answer
87 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
3answers
4k 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
71 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
265 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
132 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
276 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
876 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
687 views

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

Sir, If my uint is 10,how to convert 10 to '0x000000000000000000000000000000000000000000000000000000000000000a' by using Node.js? and reverse it from '...
3
votes
3answers
175 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
845 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
63 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
372 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
322 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
358 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
245 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
23 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
389 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
204 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
137 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
104 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
160 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
56 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
347 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
1k 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
291 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
74 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
227 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
373 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
330 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
171 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
122 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
888 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
470 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
40 views

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

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
38 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
1answer
333 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
0answers
54 views

Callback for transaction mined

Coursetro.setFile(fileName,"test hash",function(error, result){ if(!error) { console.log("Transaction submitted"); } else{ console.log("Error " + error); } }); I am calling the ...
1
vote
1answer
608 views

Listen to solidity events server-side

I have a following contract: pragma solidity ^0.4.17; contract FileDetail { struct File{ string fileName; string fileHash; } File[] private files; event Uploaded( string ...
1
vote
1answer
662 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
0answers
227 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 ...
1
vote
2answers
2k views

Web3.js browser version only

I want to create a simple page to interact with my deployed contract. I don't want to use Node.js. I want to use html + web3.js browser version. I got a link: https://github.com/ethereum/web3.js/tree/...
0
votes
1answer
180 views

Is it possible to console(In nodejs) the transaction hash from metamask?

I am running rinkeby testnet ethereum node in my local. I created one address in my local node using "personal.newAccount()" in geth console.Now I deposited some ethers to my local address through ...
1
vote
1answer
2k views

Web3 server-side trouble connect with ganache

I need to create server in nodejs that will create transaction to blockchain and i have trouble to connect my nodejs app with ganache. Look at my code: const Web3 = require('web3'); var web3 = new ...
2
votes
1answer
2k views

Deploying contract with parameters using web3.js and Node.js

I try to deploy a ERC721 contract. Which is from OpenZeppelin. My contract constructor wants two input string fields. constructor(string _name, string _symbol) public { name_ = _name; ...
0
votes
1answer
114 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 ...

1 2 3 4 5 9