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
27
votes
7answers
27k 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'); ...
23
votes
5answers
30k 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 ...
22
votes
6answers
32k 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....
22
votes
3answers
6k 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
1answer
16k 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 ...
15
votes
5answers
10k 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 ...
15
votes
7answers
30k 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 ...
14
votes
4answers
19k 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 --...
12
votes
1answer
8k 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 ...
11
votes
1answer
6k 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
4k 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 ...
10
votes
2answers
2k views

How can I trigger a PHP script when a transaction is received?

My goal is to have a PHP script be invoked whenever a transaction is received by a given address. I know Javascript but this is my first sally into Node.js. I think the right approach is to run a ...
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 ...
9
votes
1answer
2k 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 ...
9
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 ...
9
votes
1answer
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 ...
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 ...
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 ...
7
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 ...
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? ...
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" --...
7
votes
3answers
2k views

How to send a lot of transactions to ethereum, using js

I'm trying to send a lot of transactions to Ethereum with one program written in js. I use node js, web3 and infura ropsten. The problem is: if i send transactions at once, most of them just disappear....
7
votes
1answer
394 views

“bloc init” not found

I am trying to start programming with solidity for Ethereum. I am working with this tutorial: https://medium.com/@ConsenSys/solidity-integration-with-visual-studio-8bdab2ff8a74#.hunrp4l0i Apparently ...
7
votes
1answer
595 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....
6
votes
1answer
5k views

Truffle and Node JS

The dApp I'm building requires a traditonal backend and as a result I need to use Node.js and MongoDB alongside Truffle. Does anybody know how to set Node to work with Truffle? Thanks!
6
votes
2answers
6k 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 ...
6
votes
3answers
2k 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 = ...
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 ...
6
votes
1answer
3k views

Geth get deployed contract

I am new to the blockchain and up until now I have managed to deploy contracts and transfer ether through both geth console and node code... I am now trying to figure out how to get the contract that ...
6
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/...
6
votes
1answer
431 views

Is truffle based on node and is it possible to run some kind of node debugger in order to pause the Javascript tests and examine variables?

I am currently developing a Dapp and using truffle test to verify the contract. However, I find that I am also debugging the Javascript that runs the test with a lot of console.log() statements. This ...
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 ...
6
votes
1answer
584 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 ...
5
votes
5answers
10k views

Solc --version: command not found

I'm trying to use solc with no success. I download solc with npm install solc but when I run solc --version the console output is: command not found. If I list packages npm list I'm able to see ...
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 ...
5
votes
2answers
6k views

Create ether wallet account using node js and web3

Hello I want to create a ether wallet account using node js and web3. Can anyone please help me in this regard. Thanks in advance!
5
votes
1answer
148 views

Is the Ethereum client Javascript API supposed to be publically available? [duplicate]

I am still trying to understand the Ethereum design, and one thing I can't work out is if all Ethereum nodes are supposed to expose the JavaScript API and if that is supposed to be publically ...
5
votes
2answers
4k views

How would you integrate Ethereum smart contracts into an existing node/react project?

I have an existing node/graphql/mongodb/react/redux project that is in beta and I would like to integrate Ethereum smart contracts to be able to save transaction information into the block chain. Is ...
5
votes
5answers
2k views

nodejs and web3: Unhandled rejection Error: Transaction was not mined within 50 blocks, please make sure your transaction was properly send

I am trying to send ETH from one of my account to another with web3 from nodejs: web3.eth.personal.unlockAccount(config.mainGethAccount, config.gethPassword, function () { console.log("...
5
votes
2answers
503 views

How do I fix Javascript stack overflows when compiling very large file with solc?

If I compile a very large file with solc the stack overflows. This will happen most commonly in node because the default stack is only 984kbytes, which is strangely what you would expect for a 1990s ...
5
votes
1answer
250 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 ...
5
votes
3answers
2k views

Subscription sample using websockets or IPC?

So I was using the web3 API from the NodeJS 'web3' module very happily and it works very well (it uses HTTP transport AFAIU). But now I want to receive events from the server (without polling), and ...
4
votes
1answer
3k views

Different hash values for keccak256 functions?

In solidity i used the following command: keccak256(firstName, lastName, studentId); ->0x157effbe0a2f53d887ad79b0dc3e9eb6084c3025ae0114a253b8f94f83c1462d And, in NodeJS i used the following ...
4
votes
2answers
670 views

What does “code and ABI that are needed by web3” refer to in solc / nodejs

var input = "contract x { function g() {} }"; var output = solc.compile(input, 1); // 1 activates the optimiser for (var contractName in output.contracts) { // code and ABI that are needed by web3 ...
4
votes
1answer
758 views

Check if web3js is connected to node

I have a private chain with several nodes. Connecting to only one works fine. However, if this one goes down, I want to connect to one of the other node. Using web3js 1.0.0 beta 26, according to the ...
4
votes
1answer
370 views

node loses connection to testrpc

Following this tutorial on writing a voting contract and deploying on testrpc I created the below js code into voting.js and ran it by: > node > require('./voting.js'); After printing web3....
4
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 ...
4
votes
2answers
996 views

Testing in ropsten network with truffle.js gives me this error

root@ubuntu-4gb-nyc3-01:~# truffle migrate --network ropsten (node:14686) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: this.provider.sendAsync is not a ...
4
votes
3answers
1k views

How to retrieve stored data from blockchain?

I built a dapp integrating IPFS and Ethereum, in which the blockchain will store (in transaction) the links of every file uploaded to IPFS. But I want to display the IPFS links of all the files I ...

1
2 3 4 5
10