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
3
votes
1answer
304 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 ...
0
votes
0answers
22 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 ...
1
vote
1answer
29 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
2answers
114 views

Solidity event isn't fired

I'm trying to listen for an event I've created on remix IDE , from NodeJS. I call a smart contract method from where the event is triggered and I'm waiting for it in my console...but I don't receive ...
0
votes
1answer
437 views

Sending string as address to smartcontract

I have trouble sending an address to a deployed contract, my function looks like this: function addNote(uint _value, address _owner) public { ... } and when I'm sending the parameters: contract....
0
votes
1answer
22 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) ...
2
votes
2answers
96 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
vote
0answers
19 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
48 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
0answers
41 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
0answers
22 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
28 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
2answers
59 views

Could not deploy contract with valid data

I have downloaded contracts with their abi and json. I have to deploy them. when i extract bytecode from downloaded files and then assign it to my data variable to deploy contract whic gives following ...
0
votes
1answer
48 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
1
vote
1answer
165 views

How can I configure node when I run truffle test?

How can I get truffle test to execute node with the --abort-on-uncaught-exception option? I'm guessing that I should probably add something in the Truffle's configuration file (truffle.js), but the ...
0
votes
1answer
25 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
46 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
4answers
5k views

Error: Cannot find module 'truffle-hdwallet-provider'

I got the following errors while trying to deploy my smart contract: sers-Air:lottery user$ node deploy.js internal/modules/cjs/loader.js:582 throw err; ^ Error: Cannot find module '...
0
votes
1answer
142 views

About send Ethereum Classic (ETC) coin

Need guideline for send ETC coin using web3js,As per documented flow I understand we can access all methods same as ETH but I have query regarding set provider for ETC after that I can connect to ETC ...
0
votes
0answers
14 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
20 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
1answer
75 views

Get an error: insufficient funds for gas * price + value

I need to send erc20 tokens from one address to another, provided that the token balance is not empty. I check the balance as follows: const balance = contractInstance.methods.balanceOf (...
0
votes
0answers
21 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, ...
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
426 views

Error: Cannot find module 'ethereumjs-wallet'

A truffle test needs ethereumjs-wallet const wallet = require('ethereumjs-wallet'); I tried npm install ethereumjs-wallet and even npm uninstall ethereumjs-wallet npm install --save ethereumjs-...
0
votes
1answer
49 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
3answers
504 views

ReferenceError: address is not defined

Truffle v5.0.5 (core: 5.0.5) Solidity v0.5.0 (solc-js) Node v10.15.1 ReferenceError: address is not defined. const ApprovalContracts = artifacts.require('../../contracts/ApprovalContracts.sol'); /...
0
votes
1answer
153 views

Ethereum gas limit using Geth

I am running a private blockchain using Geth, after upgrading the servers- I had stopped the miner and restarted it after upgrading the specs. Now I am getting all sorts of errors, the main one being ...
1
vote
3answers
628 views

web3.setProvider is not a function

I am trying to learn about web3.js I install npm install ethereumjs-testrpc and npm install web3 // version 0.20.6 npm install ganache-cli // version 6.0.3 then i using the following code var ...
0
votes
1answer
170 views

Solidity solc compiler error on code Remix can compile

I am attempting to compile the following solidity code using solc in NodeJS. pragma solidity ^0.4.11; contract helloWorld { string public message; function constructor() public{ message = "...
3
votes
4answers
448 views

How essential is a knowledge of Javascript to learning solidity/ethereum?

I am new to the ethereum space, and though I can code in C and C++, I keep noticing in the docs that there are references to Javascript and node.js and how similar it is to solidity as well as ...
0
votes
0answers
10 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 ...
1
vote
2answers
75 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
263 views

testrpc --account private key length is invalid even though its my account

I tried to initiate a testrpc account and passing my account with value to test the transactions but when I keyed in my key 0x94fd019eeb92780477b01ce5555513d3755b5193 it says that the key is invalid. ...
2
votes
1answer
259 views

Does it make sense to have a Node.js backend serving json to frontend for dapp?

Currently, the architecture I am looking at is that the smart contract (SC) sits on the ethereum network, but it is a complex and multilevel contract system. Just navigating through the tiers of the ...
0
votes
1answer
49 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){ ...
0
votes
1answer
86 views

Deploy contract didnt resolve the promise

im facing a problem deploying a simple smart contract. When i use ganacha-cli, the program enter in a loop of confimation event, counting from 1. Thats the first problem. Output: Account: ...
4
votes
2answers
552 views

Cannot make subscribe newBlockHeaders work

I'm doing this to get all blocks from the network: var web3 = new Web3(); web3.setProvider(new Web3.providers.IpcProvider("...", net)); web3.eth.subscribe('newBlockHeaders', function (err, result) { ...
1
vote
1answer
57 views

How could return events of specific args?

In my solidity contract, I just have one event which is: transferOwnerShip (uint id, address indexed newowner); and I want to filter the events log in order to retrieve only the events that belong ...
1
vote
1answer
43 views

How to print the value of encoded getter functions of contract

UPDATED: Sorry for Inconvenience, I have updated all my question and accept my apology , being naive user. I have encoded getter functions of my contract i.e. ...
0
votes
1answer
9 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 ...
1
vote
1answer
40 views

how can i fetch all the tokens from ethereum network to my wallet ?using web3js(nodejs) or web3j(java)?

I'm trying to fetch all the available tokens from ethereum network into my android wallet but could not able to find an suitable solution other than web scrapping
0
votes
1answer
18 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 ...
1
vote
1answer
756 views

Parity, Web3, Nodejs - Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent

I'm using Parity ( "ropsten" test net), Nodejs and web3js to deploy smart contract from my system. Parity is synchronised in test mode, but when I run below code using Nodejs, it gave me a transaction ...
0
votes
1answer
407 views

Error: `Invalid JSON RPC response` when running estimateGas on Infura

Why am I getting an error when doing a gas estimation on infura. I am using web3 v1.0 and here is my code: let Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('http://...
1
vote
1answer
948 views

call to smart contract function from express project using web3

I'm trying to create a API fo my smart contract functions like following: router.get('/',function (req,res) { var web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/key'));...
3
votes
3answers
246 views

How to setup 'topics' for function getPastLogs ()?

Sir, I want to read the past event log by using getPastLogs(),but I got the whole log.I hope I can filter some log. I find I can setup the 'topics' in getPastLogs(),but it always fails. How ...
0
votes
0answers
16 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
21 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
1answer
175 views

Sending value to a solidity contract method from web3 results in `Invalid Tuple Value` error

I'm sending values to a solidity 0.5.1 method using web3 and keep getting an invalid Tuple value error. Here's the relevant contract code: struct mystruct { bytes32 id; string str; } ...

1
2 3 4 5
10