The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
19
votes
3answers
5k views

How to programmatically detect and accept ETH and ERC20 deposits

I'm looking to replicate the functionality provided by cryptocurrency exchanges such as Kraken and Poloniex when it comes to depositing ETH and tokens. Namely: Users can generate and send funds to ...
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....
16
votes
5answers
25k 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 ...
16
votes
1answer
13k views

How to convert string to bytes32 in web3js?

I have a contract with a public variable that's bytes32. If I enter the value 20160528 then it auto converts to bytes32. Is there anyway to convert it back from the nodejs terminal? I've been ...
5
votes
2answers
5k views

What is a HD wallet for Ether and how to create one using nodejs?

I know the basics of blockchain and how to use geth. However, I'm curious to know how to build a wallet using nodejs. What I basically is that you can create a account using geth console (private ...
12
votes
1answer
7k views

How to generate a keystore (UTC) file from the raw private key?

If I have the plaintext private key, -how- can I generate a geth-compatible keystore file using Node.js? I think I need to encrypt it using the scrypt algorithm by supplying a password, but I don't ...
8
votes
1answer
13k views

Error: Invalid JSON RPC response: undefined from node web3.js app

I'm getting Error: Invalid JSON RPC response: undefined from my node.js application when it tries to execute a function. My steps: ethereum wallet 0.5.1 to deploy a contract to the testnet. start the ...
6
votes
1answer
5k views

Send signed transaction web3

Trying to send a transaction with web3 on ropsten. The code runs on Remix, but now I'm trying to send it via the node console. It connects fine too(web3 works), but for some reason the transaction ...
2
votes
2answers
731 views

How open local ethereum chain (leveldb) using Nodejs levelup package?

Read the article about how to get info from local chain, but example not work. My code stoped when i create connection to LevelDB of my local chain in var db = levelup(...): var levelup = require('...
7
votes
1answer
2k views

Why can't I connect by IPC?

I have successfully run geth --rpc to test some functionality, but I need the personal API which according to this answer should be done by IPC. When I run geth --ipcapi "db,eth,net,web3,personal" --...
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-...
14
votes
6answers
25k views

How to get transactions by account using web3 js?

I'm sure this question was asked before, but I did not find any result that helped my problem. How can I get the transactions (in and out) for a given account? I use nodejs and web3? With this line ...
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 ...
14
votes
4answers
18k views

unable to connect Ethereum node even RPC port: 8545 is open

I have created my private Ethereum blockchain network. From different servers I am able to connected and added into the network as peer without any problem. The way I run my server: geth --...
25
votes
6answers
22k views

web3.eth.contract is not a function when making contract

Whenever I try and make a contract, I get: web3.eth.contract is not a function I'm using this code: const path = require('path'); const fs = require('fs'); const solc = require('solc'); ...
9
votes
1answer
2k views

Is it possible to call debug_traceTransaction from nodejs?

Following answer (https://ethereum.stackexchange.com/a/9437/4575) [ 1 ] guide us to call debug_trace through using geth: As documented in debug.traceTransaction(...), you can only access this API ...
5
votes
1answer
2k views

Making web3.js work from node server code

I'm running a geth node on the testnet and trying to run web3.js method from my node server code. var coinbase = web3.eth.coinbase; console.log(coinbase); However, I'm getting a provider not set or ...
2
votes
3answers
2k views

for using web3.js it is necessary to install geth into your system

for using web3.js it is necessary to install geth into your system or it automatically connect with geth or ethereum blockchain? var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:...
6
votes
1answer
1k views

How can i setup a web3 webservice that listens for events from my smart contract?

I have a smart contract that broadcasts events to web3 clients, upon each event being broadcast, the listening client makes a tx call to my contract. I would like to set up an 'always on' event ...
2
votes
1answer
412 views

etherwallet-3.4.1/ on private chain setup - having 404 error

I am following the MyEtherWallet: Use Your Own Server Guide to use MyEtherWallet on my private ethereum network. I am doing this setup on my node, where my ethereum node runs. I have done first 4 ...
2
votes
3answers
282 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 > ...
0
votes
2answers
360 views

Solc error invalid opcode, but works in truffle

I am trying to compile solidity code in solc(nodejs) but unsuccessful so far. I have created a sample app for demo. Here is sample's directory structure (node.js and truffle combined): │ app.js │ ...
11
votes
1answer
5k views

Error: personal_unlockAccount method not implemented

Using web3 under nodejs I suddenly want to unlock my account before calling a DAO contract function: var Web3 = require('./node_modules/web3/lib/web3'); // dont override global variable if (typeof ...
11
votes
2answers
3k views

How to connect etherwallet to my private blockchain?

I am unable to make etherwallet v3.4.2 to connect to my private blockchain. The way I run my private network: (please note that it works perfectly fine) geth --port 3000 --networkid 23422 --identity ...
7
votes
2answers
2k views

Unhandled rejection Error: Couldn't decode uint256 from ABI

I am working on using a sample Contract using NodeJS, Web3, and Solc but I encountered some error that the given address in the Contract that I've created couldn't decode. Am I doing something wrong? ...
1
vote
1answer
7k views

How to make transactions using private key in web3? [duplicate]

I have account private key, contract address and abi and I need to call contract function with this account. Is it possible?
1
vote
1answer
134 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 ...
9
votes
1answer
1k views

Is it safe to publicly host a parity node?

In the normal use case, Parity runs on localhost. However, I'm building a demo web site that uses Web3JS to connect to a public parity node running on port 8545. I am publicly serving a Node/VueJS ...
3
votes
2answers
4k views

web3.accounts.create() is not a function

I want to create a new account via code (Node.js), so I ran the following code, which was copy-pasted from the docs: web3.eth.accounts.create(); How ever accounts' value is an empty array, and ...
8
votes
1answer
3k views

How to connect NodeJS to the Ethereum network?

I have Mist wallet running on Windows 8. I want to connect my NodeJS applcation to the Ethereum network. I have no idea where to start. Could you point me to the direction I should be looking at? Are ...
8
votes
2answers
2k views

contract event not firing in web3 node console

It appears my events are not being fired in my node application when I transact the contract in the ethereum wallet gui. I deployed a custom contract via ethereum-wallet I have fired up geth attach ...
8
votes
2answers
3k views

How can I connect to geth by IPC on nodejs?

This this the command line i have used to get geth running. geth ipc --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --ipcpath "/root/.ethereum_experiment/geth.ipc" so from node js ...
6
votes
2answers
2k views

getData() is not working

I want to call a function of the contract, something like this - module.exports.transfer = function(to,value,){ return token.methods.transfer.getData(to, value); } But I am facing the error ...
5
votes
1answer
2k views

How to update the web3 API version in geth?

I spent a couple of hours on upgrading web3 API to v0.15.3 in geth (on Mac OSX) with no effect. I installed the newest geth and it says: web3.version { api: "0.13.0", client: "Geth/v1.3.4/darwin/...
2
votes
2answers
751 views

Using node.js modules/code from the JavaScript console of geth

I have a JS filter which checks for the ether transferred in a recent transaction. I have loaded this script from the interactive JS console and it's working fine. Based on the ether in the ...
5
votes
1answer
244 views

How to retrieve The DAO proposals using geth?

I'm using Node.JS with Web3 interface to a Go Geth server. I'm trying to get proposals in both TESTNET and LIVENET but I'm unable: What I've done so far: I'm using Node.JS I've got the .abi ...
3
votes
1answer
723 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 ...
3
votes
0answers
196 views

How to derive the private key from UTC file? [duplicate]

I want to implement a client-side wallet where the transaction is generated and signed on the browser, and sent to the server which is running a geth node. Apparently ethereumjs-tx does what I want ...
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; ...
2
votes
3answers
2k views

How to read all token balances from wallet?

The following code works for me to read Ether value from wallet: var web3Instance = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); export async function readAccountEtherValue(...
1
vote
1answer
1k views

Cannot run truffle behind proxy? [duplicate]

I've installed truffle and related software on my office PC. I've set the proxy server for node.js. The truffle init got the following error. Is it proxy issue? H:\work\eth> truffle.cmd init ...
1
vote
0answers
140 views

metamask and infura - Managing and signing with private keys

I am using Infura as a node for my DApp so I need to send raw transactions by signing them. These transactions can come from multiple users of an application so each user must sign and send a raw ...
1
vote
1answer
699 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
3answers
826 views

Using ganache-cli provider causes “Error: Provider not set or invalid”

I'm trying to write and run tests for my smart contract and I get this error: "Error: Provider not set or invalid" Smart contract code: const assert = require('assert'); const ganache = require('...
1
vote
2answers
3k views

Unable to npm install web3 on Windows 10

I followed every thing on this page : https://medium.com/@PrateeshNanada/steps-to-install-testrpc-in-windows-10-96989a6cd594 Except step number 5 where my Node.js version is 8.10.0 instead of 8.10.2 ...
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
702 views

Unlock remote account

I have smart contract deployed that accepts funds (via fallback function function() payable { ... }). Also I have frontend using web3 to send funds. When I tested it with local node (and JSON wallets ...
0
votes
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
284 views

TestRPC and persistence of data

I am using a smart contract on the TestRPC net. In order to deploy my contract for the first time I write this in the node cmd: >Web3 = require('web3') > web3 = new Web3(new Web3.providers....
0
votes
1answer
2k views

Invalid JSON RPC response: undefined

I'm trying to create an account through Node.js. This is my code: export async function createNewAccount() { var web3Instance = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));...