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
0answers
8 views

migrate error from new buffer(process.env)

I follow the book Ethereum from Gavin Wood and when i use truffle migrate --network ganache it gives me following error; TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type ...
0
votes
1answer
5 views

Pushing process to background causes high kswapd0

I have a cpu-intensive process running on a raspberry pi that's executed by running a nodejs file. Running the first command (below) and then running the file on another tab works just fine. However ...
0
votes
1answer
12 views

ERC20 Transaction failing due to invalid nonce value

I am trying to send an erc20 transaction but I keep getting an error telling me that the account I'm sending the transaction from has a nonce value of 1 while the tx has a nonce value of 31613. I am ...
0
votes
0answers
15 views

web3 getTransactionReceipt instant response

How come the second time i call getTransactionReceipt with the same transactionhash i get an instant response? code: async function test() { prmoise1 = web3.eth.getTransactionReceipt( '...
1
vote
1answer
16 views

API node js with call and send to a contract without metamask

I am new in Solidity. I'm trying to create a API in node js, which can be use without a navigator like chrome with MetaMask. I would like to test it with postman. But i have some problems with web to ...
0
votes
0answers
28 views

Deploy contract with web3 with ABI in JSON file give me “SyntaxError: Unexpected token o in JSON at position 1” [duplicate]

I got problem with my deploy.js script to te deploy my smart contract with web3. When I run it, I always got this error: Attempting to deploy from account XXXXXXXXXXXXXX (node:25929) ...
0
votes
1answer
19 views

web3.eth.getBlock isn't triggered

Basically, i want get the callback result of first method to get each index value in pass it to the second method to scan this value, in this case is an ethereum transaction to get the input value. ...
1
vote
1answer
18 views

How to fix Data location must be “memory” for return parameter in function, but none was given.?

pragma solidity >= 0.5.0 < 0.7.0; contract Adoption { address[16] public adopters; function getAdopters() public view returns(address[16]) { return adopters; } function adopt(uint ...
0
votes
1answer
23 views

Why my contract binary does not set?

My project is in Truffle. I programmed a smart contract and want to deploy it with JavaScript. But the following error occurs: Error: Contract error: contract binary not set. Can't deploy new ...
0
votes
1answer
36 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 ...
0
votes
0answers
18 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 ...
0
votes
1answer
20 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
1answer
18 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 ...
1
vote
0answers
32 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
0answers
27 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
34 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
35 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
1answer
251 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
0answers
22 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
2answers
51 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) + @...
1
vote
2answers
143 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 ...
1
vote
2answers
52 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
1answer
18 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
2answers
27 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 ...
1
vote
0answers
22 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
0answers
59 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
53 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
3answers
43 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
24 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....
0
votes
1answer
17 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 ...
1
vote
1answer
46 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
44 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) { ...
0
votes
1answer
29 views

How can I extract a wallet address from event data?

I have a contract that returns event data including the sender's address: event Result( address indexed _walletAddress, string _name, uint256 _amount ) And in my Node.js app I try to ...
0
votes
2answers
28 views

Sending ether from list of addresses with web3.js

I would like to read the csv text file and make a transaction via web3.js like what I did with web3.py Here is my python code #!/usr/bin/python3.7 import os import time import pandas as pd from ...
0
votes
1answer
45 views

How to create an interaction between a smart contract and a HTML file with Node-js?

My Truffle project is this contract that just shows Yerevan is love: pragma solidity ^0.5.12; contract TEST{ string public note="Yerevan is love"; function rep() public view returns(string memory){ ...
1
vote
2answers
58 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 ...
0
votes
1answer
60 views

Access to smart contract's value in Node-js

I am working on a simple Truffle project that just shows "Yerevan is love". My contract code: pragma solidity ^0.5.12; contract TEST{ bytes note="Yerevan is love"; function fname() public view ...
0
votes
1answer
31 views

I cannot see Ethereum accounts in Browser

There are 10 Ethereum accounts in Ganache. I work on a Truffle project. Whenever i run the following codes in Nodejs: var Web3 = require('web3'); var web3 = new Web3("ws://localhost:8545"); var acc= ...
0
votes
1answer
24 views

XMLHttpRequest() does not work probably in a Truffle project

I want to connect to my smart contract in a Truffle project and get some information from it. The smart contract's name is "TEST". The follow is my app.js code that should communicate with my smart ...
1
vote
1answer
19 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
0answers
40 views

Why can I only deploy approx. 3 smart contracts per minute with infura using Ropsten and Rinkeby

I have created a Dapp that is written in Solidity and compiled with Truffle on both Rinkeby and Ropsten. I have also created a frontend for batch file uploads and a backend for the actual deploying ...
0
votes
1answer
137 views

Calling function from existing truffle contract in node.js

This is probably a very simple problem to solve, but I am setting up a node.js backend using express for my Dapp and I can now deploy new contracts just fine. I now need to figure out how to make ...
0
votes
0answers
19 views

How to send a value back to html from node.js using express and truffle

I am running truffle code with Node.JS in the backend to deploy contracts. Using the Express Library, I can interact with the Node backend. Here is the code for the HTML page: <form id="myForm" ...
0
votes
1answer
74 views

Problem with running truffle code with node.js

I am trying to run truffle code with Node.JS in the backend to deploy contracts. I want to be able to do this interactively and I am intending to use the Express Library to interact with the Node ...
0
votes
1answer
31 views

Why do we use `serialize` function of `ethereumjs-tx` package before broadcasting a transaction

I just want to know the purpose/functionality of serialize function which we use before broadcasting a transaction: const serializedTransaction = tx.serialize() const raw = '0x' + ...
2
votes
3answers
475 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
2answers
34 views

Node JS problem Interacting with Ethereum Smart Contract

I'm having only partial success with a Node.js script I wrote that interacts with one of my Ethereum Smart Contracts. Here's what's working: -I'm able to call methods in the Smart Contract from my ...
0
votes
1answer
18 views

Wrong version of web3.js

$ npm show web3 web3@1.2.5-rc.0 | LGPL-3.0 | deps: 8 | versions: 115 Ethereum JavaScript API https://github.com/ethereum/web3.js#readme ... $ node app/test.js VERSION { api: '0.18.4', node: [...
3
votes
1answer
92 views

Contract does not exist at address

I have setup a private Quorum network and successfully deployed contracts and executed contract functions using Visual Studio Code and remix. When i try to deploy the exact same contract manually ...

1
2 3 4 5
10