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
1answer
98 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
0answers
287 views

Calling contract with web3 keeps running out of gas

I am trying to test executing a method on an existing contract, but the transaction keeps running out of gas, and I can't figure out why. I am trying to call an Etheroll contract on the Rinkeby test ...
6
votes
3answers
1k views

I get error couldn't find module 'ethereumjs-wallet/hdkey'

I was running this code deploy.js const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const { interface, bytecode } = require('./compile'); const provider = ...
1
vote
1answer
955 views

Error can't create a new Web3 object on angular

I've tried on ubuntu, windows with different versions and browsers. web3 1 latest beta: WARNING in ./node_modules/asn1.js/lib/asn1/api.js Module not found: Error: Can't resolve 'vm' in 'C:\...
1
vote
0answers
59 views

import packages in petdapp

I unboxed petdapp and done some editing where I need to import bcrypt-nodejs in app.js and used following steps. npm install bcrypt-nodejs --save npm install require --save app.js var bcrypt = ...
0
votes
2answers
691 views

web3.js library not loading properly

I am trying to load web3 library after installing it via command prompt. However, looks like it is not loading properly as it is not showing all the details for Ethereum ecosystem (ex. unitmap of ...
0
votes
1answer
123 views

Get a large amount of blocks with web3 (nodejs)

I'm writing a nodejs program that gets a large amount of blocks (>100,000) and looks at each transaction inside to filter / analyse the data. I'm currently using web3 (v1) getBlock function: eth....
0
votes
1answer
550 views

Invalid number of arguments to Solidity function (trying to retrieve mapping)

The solidity contract has defined the following mapping struct recordStruct { uint256 price; uint64 time; } mapping(address => recordStruct[]) public records; Question: How can we use ...
2
votes
2answers
83 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
77 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 = ...
1
vote
2answers
485 views

web3.setProvider is not a function

I am trying to learn about web3.js I install npm install ethereumjs-testrpc and npm install web3 // version 0.20.6 npm install ganache-cli // version 6.0.3 then i using the following code var ...
2
votes
2answers
192 views

web3.isConnected() returns nothing when connecting to geth with web3.js(Version 0.19.0)

web3.isConnected() has issue. When connecting to an IPC node I think it is waiting for something because when i starting my nodejs program nothing happens, I am running ethereum node and try to ...
1
vote
1answer
144 views

Execution of ERC721 Token

I have a Node-js application where cards are generated with unique number (ID11234). So I am planning to map a token for each card. In order to get uniqueness, I went through some of the documents, at-...
0
votes
0answers
770 views

Trying to get the transaction details using web3 js

Getting below rahul@rahul-Inspiron-5559:~/Desktop/web3js$ node index.js /home/rahul/Desktop/web3js/node_modules/web3/lib/web3/requestmanager.js:61 throw errors.InvalidResponse(result); ...
1
vote
1answer
603 views

Listening for Deposits and Transaction Confirmations Web3js

I'm building a webapp using nodejs and web3js. I have a simple use-case: I provide the user with an address to which he should deposit funds. I want to then listen on my nodejs server for: when the ...
0
votes
1answer
1k views

bower vs web3 vs nodejs vs golang apis

What benefits does the use of following bring to my Ethereum application if I wish to interact smart contracts for sending multiple transactions, upload files on blockchain, etc.? bower web3js ...
2
votes
0answers
268 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 - ...
1
vote
1answer
150 views

How can the cost of changing 2 state variables and emitting 1 event reach 50K gas units?

I have this contract: pragma solidity ^0.4.23; contract Test { event Event(address indexed wallet); mapping (address => bool) public authorizedWallets; uint256 public ...
0
votes
1answer
371 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://...
1
vote
0answers
87 views

Should I connect to the blockchain from the client or server side? [closed]

I am trying to build a simple Dapp for buying and trading tokens. Which of the following would be a better way to integrate with blockchain: On the server side On the client side Which is more ...
3
votes
1answer
675 views

Geth with clique block sealing without unlock account

Hello I have a local blockchain, Geth client, 2 nodes and clique proof of authority algorithm. I start geth with this command: geth --datadir node2/ --syncmode 'full' --port 30312 --rpc --...
1
vote
1answer
139 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 ...
2
votes
2answers
2k views

TypeError: Web3 is not a constructor when trying to use node.js with truffle-contract

I'm trying to use node.js with my smart contract for my app. As I've tried to convert from using the default app.js set-up to index.js set-up I've ran into this weird issue I can't fix. It throws ...
1
vote
1answer
185 views

How to run Private Ethereum Node forever

I want to run my Private Ethereum Node continuously, even if it stops in between,it should get started automatically. Like forever npm in node which ensures that a given script runs continuously. so ...
8
votes
0answers
1k views

web3 websocket connection prevents node process from exiting

I have a node js process that creates a web3 websocket connection, like so: web3 = new Web3('ws://localhost:7545') When the process completes, it does not exit, but rather hangs forever with no ...
2
votes
3answers
280 views

Event firing before data is actually set

Let's say this is my smartcontract: event NewUser( address userAddress, uint amount ); function addUser() public payable{ require(msg.value <= maxValue && msg.value > ...
1
vote
1answer
468 views

Events not being received in nodejs, using truffle, ganache and metamask

I'm using web3 1.0, lets say this is my smartcontract: contract Foo { event NewUser( address userAddress, uint amount ); function addUser() public payable{ emit ...
0
votes
1answer
2k views

How to get ropsten test token? [duplicate]

Please help me!. to found out the ropsten test token on the eth address, thanks for the help.
0
votes
1answer
171 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 ...
1
vote
1answer
345 views

Show an event with nodejs

in my Smart Contract I have a function such that it fires an event at the end of its code. function sendTran(arguments) public { *code* emit Event(argument 1,argument 3,argument 3,...
0
votes
1answer
192 views

How to retrive the data which was sent to previous deployed contract?

I want to access the data which i sent via a function during the previous contract instance . Is it possible to retrieve the data by the the contract instance or transaction hash ?
0
votes
1answer
113 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 ...
0
votes
1answer
81 views

How to return the funtion value using the contract instance which was deployed previously? [closed]

I am not able to retrieve the variable content stored for the previous contract instance deployed,i am only getting the content of the present contract instance that is generated(In my case i am ...
-2
votes
1answer
581 views

Test in Mocha failing [closed]

I am getting the following error on running the test. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! inbox@1.0.0 test: mocha npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the inbox@1.0....
1
vote
0answers
333 views

web3 v 1.0.0-beta.34 contract.methods.myMethod().send hangs

I am using web3 (installed from npm, version 1.0.0-beta.34) to write a nodejs script that should invoke the method update() defined in a contract I deployed with Truffle on my private ethereum ...
1
vote
2answers
1k views

Error in unboxing truffle-react on Windows

I am trying to unbox truffle-react but I am stuck with this error: $ truffle unbox react Downloading... Unpacking... Setting up... Error: Command failed: npm install npm WARN deprecated ethereumjs-...
0
votes
2answers
79 views

Is it necessary to store transaction data into a database?

I am wondering if there are no security risks if i store transaction data in a database besides the fact that is stored on the ethereum blockchain. I am using an API to manage my smart contracts and ...
1
vote
1answer
85 views

API or websocket

I am trying to develop an crypto traking site like coinmarketcap, for market data I am using exchanges API. but I am little bit confuse whether i should use api or websocket? as i don't have much ...
1
vote
1answer
1k views

truffle init not working

I am trying to run "truffle init" in the empty directory, facing the following error. /usr/local/lib/node_modules/truffle/build/cli.bundled.js:26041 return new Promise((resolve, reject) => { ...
0
votes
2answers
285 views

how to call deployed smartcontract with sendRawTransaction [duplicate]

with this code i want to call my token smartcontract's transfer function. as per my knowledge i have to add this ".transfer(address,amount)" to data field. am i correct? also i am using web3 0.20. in ...
0
votes
3answers
790 views

web3.eth.personal : “Method not found”

When I invoke a method of web3.eth.personal I receive an error as follows: > web3.eth.personal.getAccounts().then(console.log); Promise { <pending>, domain: Domain { domain: ...
0
votes
2answers
533 views

using abi generated by truffle in DApp

I use truffle to deploy contract to ganache network. I like to use the json file generated by the truffle in the DApp rather writing messy ABI into it. I tried the below piece of code and it gives ...
1
vote
2answers
290 views

Unable to work with web3.js on geth

This is my code: function send() { Web3.providers.HttpProvider.prototype.sendAsync = Web3.providers.HttpProvider.prototype.send; var web3 = new Web3("http://localhost:8545"); var data =...
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"; ...
2
votes
2answers
1k views

How to use Solidity solc to compile A.sol that imports B.sol file?

I know how to install solc via "npm install --save solc" then use solc.compile to compile one sol file. But now I've got A.sol file that imports B.sol file, and when I run node compile.js, no error in ...
0
votes
2answers
305 views

Need a decent alternative to define json interface in web3.eth.Contract function

I created a file called contract.js with the abi code as follows. var contract_abi = [{ "constant": true, "inputs": [ { "name": "...
0
votes
1answer
155 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
1k views

How to build an API that communicate with Smart contract Event?

I want to build an API to manage the smart contract events and I wonder how to do it using Node.js. Anyone that can help?
2
votes
0answers
74 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 ...
7
votes
1answer
507 views

Truffle unbox drizzle not working properly

truffle version = 4.1.4 truffle unbox drizzle truffle compile truffle migrate npm run build npm run start this gets me this error: Truffle Drizzle-box fails with TypeError: (0 , _drizzle....