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
194 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
408 views

Smart Contract is being deployed but call does not return contract address after deployment

So I have been trying to deploy a smart contract using nodejs, but when I call the function to deploy, I get no contract address on my console. It's like the send() function never completed its ...
2
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
27 views

getTransaction sometimes returns null when transaction is pending

I am looking to get real time transaction data as it is broadcasted to the ethereum network, so I have subscribed to pendingTransactions. This only returns the transaction hash though, so I have to ...
7
votes
1answer
563 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....
0
votes
1answer
48 views

getPastEvents on localhost is not a function error

Now, I'm working on an Ethereum Blockchain project to transfer the ownership of stored devices by using local web3 provider at the truffle environment. Truffle v5.0.27 (core: 5.0.27) Solidity v0.5....
1
vote
1answer
92 views

How do I send multiple transactions from one wallet in Nodejs?

Hi I've been reading around and I came across Web3.js It's not apparent to me how I can send Ether from one wallet to multiple recipients other than in a batch-style request (which inevitably takes a ...
0
votes
0answers
17 views

How to make sign tx for erc20 token transfer? [duplicate]

How can I make an erc20 token transfer in node, I know to transfer eth is like this for using ethers. Lib: let privateKey = "0x3141592653589793238462643383279502884197169399375105820974944592" let ...
0
votes
0answers
25 views

How to get type of a contract internal transaction? [duplicate]

I'd like to get type(create, call, ...) of a contract internal transaction, like [this page of etherscan.][1] However, I couldn't find it any responses and documents of web3js. I'm getting a contract ...
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 ...
1
vote
1answer
16 views

What is an index position of an uncle?

I see this document. But I don't understand what is an index position of an uncle. I'd like to get informations of uncle blocks like etherscan.io However I don't know a value of the index position ...
0
votes
1answer
19 views

How can I keep nodejs running even after crash on Ubuntu [closed]

Is there any way I can run the nodejs program app.js always in the server even it crash? So I do not need to keep restarting node app.js by nohup
1
vote
0answers
16 views

How to deploy blockchain app in heroku

I want to deploy my blockchain app in heroku and i just want to use ganache as my blockchain network. is that possible?
0
votes
1answer
197 views

ipfs.files.add(Buffer) function causing TypeError: Cannot read property 'add' of undefined

I am trying to upload an image to ipfs using ipfs.files.add() function but it is causing me this error Uncaught TypeError: Cannot read property 'add' of undefined at App.onSubmit (App.js:70) at ...
0
votes
0answers
21 views

Is it possible to use ganache blockchain when I deploy my web app in heroku? or should I deploy the contract first to a test network?

const web3 = new Web3( new Web3.providers.HttpProvider( "https://kovan.infura.io/v3/INFURA_KEY" ) ); const abi = JSON.parse( '[ { "constant": false, "inputs": [ { "internalType": "string", "...
1
vote
1answer
97 views

Error while I am compiling the contract using node

saitejas-MacBook-Air:Inbox saitejakuruva$ sudo node compile.js assert.js:340 throw err; ^ AssertionError [ERR_ASSERTION]: Invalid callback specified. at wrapCallback (/Users/saitejakuruva/...
1
vote
1answer
25 views

Get each transactions from response of txpool.getContent()

I'm trying to get each transactions from response of txpool.getContent(). The response structure is here. > pending: { '0x0000000186c96Ab17A967d7A3033db82efcA587B': { '11': [Object] }, '...
2
votes
2answers
30 views

Meanings of a txpool.getContent() response

I'd like to understand the structure of response for txpool.getContent(). I got a following response from my geth node. > pending: { '0x0000000186c96Ab17A967d7A3033db82efcA587B': { '11': [...
1
vote
2answers
33 views

Get hash transaction by your encode input data

In my application i must follow the use case: I need to record any document hash on the Ropsten (eth testnet) blockchain. The hash is unique and i'm using a mapping in my smart contract to accomplish ...
1
vote
1answer
158 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
1
vote
1answer
43 views

When testing a contract, NodeJS returns: “SyntaxError: Unexpected token u in JSON at position 0”

My NodeJS script gives me this error: 1)"before each" hook for "deploy a factory and a lottery" SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse((anonymous)) at Context.(anonymous) ...
1
vote
1answer
83 views

How can i deploy compilled contract with node/web3 and metamask?

Does anybody knows how to deploy smart contract with node/web3 and using unlocked metamask account. I mean over internet it is advised to use HDWalletProvider with mnemonic but I want that user that ...
1
vote
3answers
250 views

Project ID is required

I got an error at sendSignedTransaction is : Project ID is required. Can you please let me know that what is the actual problem? This is my code: try { const ethereumUri = 'https://ropsten....
1
vote
0answers
17 views

How to sign transactions using Metamask and send the signed transaction to NodeJS so that it can be added on Ropsten Infura?

I have developed a secure file sharing application in NodeJS(v10.16.1) + Express(v4.17.1) + Truffle(v5.1.15) + Metamask(v7.7.8) which works perfectly on localhost. I am using @truffle/contract(v4.1.11)...
1
vote
1answer
17 views

Problem with contracts being deployed multiple times in Node.JS backend

I have a Javascript frontend that passes records in a JSON to the backend via Express to be deployed to the blockchain (currently using Rinkeby) with truffle-hdwallet-provider. This appears to work ...
1
vote
2answers
41 views

web3 - Error when calling sendTransaction with @truffle/contract on Ropsten Infura

My smart contract is already deployed on Ropsten TestNet provided by Infura at 0x63865E0F065C7b865e1a2EE4d99C383A414Bec22 address. I want to sendTransaction using NodeJS(v.10.16.1) + Web3(v.1.2.6) + @...
14
votes
7answers
28k 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 ...
1
vote
1answer
433 views

Cannot connect to ganache-cli with web3 and nodejs

from package.json: "ganache-cli": "^6.3.0", "web3": "^1.0.0-beta.41", in my createContract.js const Web3 = require("web3"); const ganache = require("ganache-cli"); console.log('ganache.provider :', ...
1
vote
2answers
31 views

Contract deployment with “truffle-contract”

My purpose is deploying a smart contract to a private network with Node-js. I work on Truffle and Ganache. I tried it with "truffle-contract". But in deploying process an error occurs. My contract ...
1
vote
2answers
60 views

How to get pending transactions with using geth or other client?

I would like to get pending transactions with using geth. And I tried to use 'web3.eth.pendingTransactions' on geth console. So the geth returned '[]'. > web3.eth.pendingTransactions [] But I ...
0
votes
1answer
62 views

end process after web3 sendTransaction return transactionHash

I want to end the process after sendTransaction return transactionHash. Here is my code currently : const Web3 = require('web3'); const web3 = new Web3("http://127.0.0.1:8545"); async function task(...
1
vote
1answer
16 views

problem of connecting to ethereum

I am using web3@0.20.7 and infura to connect Ropsten testing network. I haven't opened my website(using ethereum) for a while. Today I restarted my website, and I can not connect to ethereum with ...
0
votes
1answer
22 views

What is .new()?

I am using the following code to deploying a smart contract to a private network with Node-js. But the error TypeError: contract_object.new is not a function occurs. What are .new() and the error's ...
0
votes
1answer
231 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
0answers
20 views

ipfs with ethereum

Module not found: Can't resolve 'ipfs-api' in 'C:\Users.......\src' I have used this code //using the infura.io node, otherwise ipfs requires you to run a //daemon on your own computer/server. const ...
1
vote
2answers
43 views

Assigning address, data, and gas to smart contract to deploy with Node-js

I used this guide to deploy a smart contract with Node-js. I followed as far as my contract was created as an object. Because the mentioned guide is old some web3 methods changed nowadays. So it looks ...
1
vote
0answers
36 views

UnhandledPromiseRejectionWarning TypeError when deploying multiple contracts (>200) at the same time

I get the following error: (node:6540) UnhandledPromiseRejectionWarning: TypeError: this.removeListener is not a function at Object.receipt (c:\Users\pruto\OneDrive\Documents\Smart contracts\...
1
vote
3answers
29 views

Deploy smart contract with Node-js

I want to deploy a smart contract with Node-js. I followed this guide but an error occurs where i effort instantiate my smart contract. app.js: var Web3=require('web3'); var fs=require('fs'); var ...
0
votes
1answer
17 views

Write eth address to file

I need to generate several hundred addresses with eth keys and write them to a file, but only iteration numbers are written to the file, what's the problem? for(var i = 0; i < amount; i++) { fs....
6
votes
1answer
543 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 ...
1
vote
1answer
122 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
vote
1answer
124 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
14 views

Deployment transaction mined but contractAddress still empty

I'm trying to deploy a very simple smart contract on Ropsten through Infura When I launch (on Ubuntu) my deploy.js script, everything seems to work except I don't get the contractAddress in the ...
2
votes
1answer
264 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 ...
1
vote
1answer
65 views

liaison entre web3 et nodejs [using web3js and nodjs]

Bonjour, j'ai développé une app avec nodejs et je voulais la transférer vers une dapp en intégrant le web3 librairie. En effet j'ai crée les smart contract il le me reste juste la façon de faire la ...
1
vote
1answer
59 views

Problems subscribing to infura via websockets

So I have a dapp that includes a node server, which I have got to work successfully using ganache, using this line: web3 = new Web3(new Web3.providers.WebsocketProvider('http://127.0.0.1:8545')) I ...
0
votes
2answers
130 views

Ethereum transactions inside full node

I am creating basic peer-to-peer ETH exchange on running geth full node, and can't find out how to make transactions inside node, from one account to another. Is it even possible to transfer funds ...
1
vote
1answer
41 views

Ethereum - How does the smart contract get deployed via web3?

I am trying create an application using NodeJS, web3, ganache and write a smart contract with solidity on Ethereum as a part of my final year project. Reading the documentations, I still have a few ...
1
vote
1answer
34 views

web3 - Error while calling smart contract pure function via web3 using nodejs?

This is my smart contract written in solidity (v.0.5.16) - pragma solidity ^0.5.0; contract MyContract { function myFunction() public pure returns(uint256 myNumber, string memory myString) { ...
2
votes
2answers
93 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 ...

1
2 3 4 5
10