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

Recursively search for Ethereum nodes

Hi I'm trying crawl the Ethereum network to get a full list of nodes including IP and client info in nodejs. I know that it's hard to achieve 100% accuracy on a p2p network but I would like to get ...
0
votes
0answers
57 views

Remixd won't connect to browser IDE

I have a small issue with remixd connecting to my browser IDE instance. I have tried on both MacOS and Linux with the result being virtually the same When I run the following: remixd -s /home/garrett/ ...
1
vote
1answer
28 views

Truffle - deploy and interact with a contract locally from a script

I have created a contract, wrote a migration and a test. When I run truffle test the contract is deployed locally and then the tests are run against it. All is working fine. I also added a function to ...
1
vote
1answer
35 views

Node version upgrade for contract deployment throws error

I wrote a solidity contract using version 0.4.24 using OpenZeppline-solidity version 1.12.0. This used to deploy using the Nodejs version 8.12. The Nodejs version 8 is no longer being maintained from ...
0
votes
0answers
10 views

Events stop triggering after a while

I created a script that subscribes to PairCreated event on Uniswap using Web3 and Infura API. The event works for a few minutes but stops working after a while (timeouts?). How can I make it watch the ...
0
votes
0answers
16 views

How to get a public IP address with IPFS-JS

With IPFS JS when I run this: const ipfsNode = await IPFS.create(); const addresses = await ipfsNode.swarm.localAddrs(); console.log(addresses); I get this: Swarm listening on /ip4/127.0.0.1/tcp/4002/...
1
vote
1answer
20 views

Get deployed contract dynamically in node JS

I am using Node JS and ethereum smart-contract. Every time contract gets deployed new addresses generated. Is there a way that node JS always gets an updated address of a contract? Any API so that I ...
0
votes
1answer
39 views

Error: Returned error: VM Exception while processing transaction: revert when using methods.MyMethods.Send

I am writing a simple betting application that will return double the ether deposited by the player, provided they guess correctly the random number generated by the virtual slot machine. it works ...
1
vote
1answer
32 views

Automatically register number into Kovan test net with signed transaction (Infura API + NodeJS)

I have a very simple Smart Contract deployed using remix.ethereum which is: pragma solidity ^ 0.6.0; contract primerContrato { uint storeddata; function set(uint x) public{ storeddata = x; } ...
0
votes
0answers
32 views

Getting an “ Unhandled promise rejection” error when making transaction from account1 to a contract

I keep getting a Promise Rejection error whenever I make a transaction from account 1 to a contract. The contract is used to send ether to account 2 when it receives ether from account 1. For security ...
0
votes
1answer
40 views

web3 eth return returns a nonexistent transaction hash

I'm trying to create transactions something like this: var sender = meth.eth.accounts.privateKeyToAccount(data.fromPrivate) meth.sendTransaction({ sender, to: data.to, amount: data.value, }, cb) ...
1
vote
0answers
23 views

where to host express api that communicates with smart contract to be fully decentralised?

I need to host express api that communicates with smart contract to be fully decentralised. Any to host it decentralised.
1
vote
1answer
129 views

Ethereum Error: Provider does not support subscriptions: HDWalletProvider

I am making a flash loan request using web3 , truffle and keep getting the error in an event listener: The current provider doesn't support subscriptions: HDWalletProvider. I am connecting to the ...
0
votes
1answer
37 views

web3.eth basic functionality

I'm just trying to get web3.eth in node.js to tell me what the current block number is but I get an error 'UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: ""', I have &...
0
votes
0answers
42 views

How to Manage Bulk of transaction through web3.js?

I have following code to send a transaction: const account = web3.eth.accounts.privateKeyToAccount(process.env.PRIVATE_KEY_1) const transaction = contract.methods.submitHash(docHash); const options = ...
0
votes
0answers
46 views

require Statement returns Transaction Revert Error instead of provided custom error message

For example, i have this piece of code here require(keys[_address].purpose != _purpose, "Key Already Exists"); in a Smart Contract. Upon executing a function and failing a requirement, ...
0
votes
1answer
27 views

Decoding input paramters throws invalidity error

Using the abi for a smart contract that I got, I was trying to decode the input parameters for a transaction receipt using web3.eth.abi.decodeParameters function. The logs.json file is as below: { &...
1
vote
0answers
67 views

Solidity function calls from javascript work locally but fail on ropsten,kovan etc with Error: Returned values aren't valid, did it run Out of Gas?

I have a smart contract whose function calls works fine when called locally using javascript and ganache. But when I deploy to ropsten and others, the calls to its functions fail with Error: Returned ...
0
votes
0answers
19 views

Trying to deploy a simple contract using node and getting the error: Unhandled Promise Rejection / Contract code couldn't be stored

I am doing an online course and trying to deploy using node. Can anyone help ID what I might be doing wrong. Thank you for any help! The error is below, followed by the js code. iii@iii:~/Digital ...
1
vote
0answers
38 views

How to speed up ethreum transaction after initiating

Is there any possibility to speed up transaction after creating transaction receipt. My project need to similar functionality we have with metamask is there a way we can accomplish this using any ...
0
votes
0answers
23 views

Can we determine gas price for a function without deploying it? [duplicate]

I want to store a document hash on an Ethereum network. I have two options. 1st one is to send the transaction directly through a node js application with input field as the document hash ie, ...
1
vote
1answer
76 views

Could not find a declaration file for module 'solc''

I have installed solc without any errors or warning, but when i am trying to run node compile.js command in cmd then i am getting following error On checking the code, i found that "const solc = ...
0
votes
0answers
12 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
11 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
23 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
22 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
36 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
55 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
34 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
28 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
35 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
73 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
26 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
23 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
28 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
46 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
39 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
61 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
85 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
639 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
79 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
108 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
669 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
108 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
23 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
33 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
25 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
128 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
64 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
2 3 4 5
10