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

What is the best practice when storing a custodial wallet with node.js and mysql?

I'm using Adonis.js v4 (it's node.js) and mysql (on RDS) as my database. I need to create an ethereum wallet for each of my user's and I need to make transaction on their behalf with their wallet (...
0
votes
1answer
18 views

Can't install Truffle Framework to Mac OS Big Sur

so I checked to see if I had the latest version of nodejs, and it turns out that I do. kalebamarante$ node -v v15.5.0 then I tried installing a version of Truffle and it didn't work ~ kalebamarante$ ...
0
votes
0answers
15 views

How can I make Withdrawal with Metamask api?

I have a system, people buy my erc20 tokens through this system. I want to automatically transfer the token to their wallet address when they buy it. how can I do that? Can this be done with the ...
0
votes
0answers
28 views

Cannot Deploy to Rinkeby using Truffle, Infura, and Node

I am trying to deploy a contract to Rinkeby using Node and Truffle but I get a lengthy error: Truncated Error: Attempting to deploy from account 'MYACCOUNT#' [object Object] [object Object]...
0
votes
0answers
17 views

How can I compile multiple smart contracts in a single compile.js file?

There is another post on this question but I don't find it useful enough so I thought I should ask again. In my compile.js file, I'm taking each smart contract's complied code and put it in a ...
1
vote
1answer
53 views

Call contract view method from web3

I am trying to call a function on a smart contract using web3 and web3-eth-contract but I get the error Provider does not have a request or send method to use. Here is the general code I am attempting:...
0
votes
0answers
21 views

Why is my pair price value undefined?

I'm still pretty fresh to all this code life, please help me out. I am writing this price scanner to get the prices of pairs in Uniswap. Even though console.log(tradePrices) shows me an object with ...
0
votes
0answers
16 views

New to blockchain development

hope everyone's doing ok. So I am really interested in blockchain development. My programming experience so far has been C++ and a little bit of Python. I know the basics of Javascript as well. So I ...
0
votes
1answer
80 views

Why is my for loop not fetching multiple token data?

I'm a little bit noob, so bear with me, but I love the blockchain very much and that's why I'm here, so please hear/help me out. I am building a price scanner for Uniswap, so I have this program to ...
1
vote
1answer
99 views

How to sign and verify data with ethereumjs-utils?

In my contract I'm verifying if some data was correctly signed by the owner. It looks like this: require( owner() == ecrecover(keccak256(abi.encodePacked(this, aCustomId)), v, r, s), ...
1
vote
0answers
19 views

Verifying ETH Deposit Contract signatures using Chainsafe BLS library

I am attempting to verify BLS signatures using the Chainsafe BLS library. I am attempting to independently verify signatures associated with deposits to the ETH Deposit Contract. In order to test that ...
1
vote
1answer
38 views

Why am I receiving invalid transaction hashes?

I am very new to this whole ethereum and web3 part. I've learned from this tutorial Link Here about how it is suposed to work and what information should my code deliver to me. But for some reason all ...
0
votes
1answer
23 views

how to covert a string to a ether address (20 bytes)?

I have tried to use sha3 but it return error since invalid address. Here is my code. The sha3 returns 32 bytes address. I wonder is there other function that returns 20 bytes . var to_add = web3.sha3(...
1
vote
1answer
61 views

Truffle ganache fork

Suppose I have access to a full archive Node and I want to fork from a specific block using Ganache. Using ganache-cli, I can specify where to fork using the --fork parameter by passing it the Node ...
1
vote
0answers
49 views

Call() function returns “Error: Returned values aren't valid, did it run Out of Gas?”

I am connecting to Binance Smart Chain mainnet via rpc. The error message I get is following: (node:17667) UnhandledPromiseRejectionWarning: Error: Returned values aren't valid, did it run Out of Gas? ...
0
votes
0answers
85 views

throw new Error(“Could not find artifacts for ” + import_path + “ from any sources”);

I’m receiving then ex error: C:\Users\xxxxx\AppData\Roaming\npm\node_modules\truffle\build\commands.bundled.js:455204 throw new Error("Could not find artifacts for " + import_path + " ...
0
votes
0answers
42 views

Compatible versions of npm, truffle, node and web3 for Solidity 0.7.2

I'm using: Solidity 0.7.2, Node v12.18.4, Truffle v5.1.49 (core: 5.1.49), npm 6.14.8, web3 1.3.0 I want to know what versions are compatible with solidity 0.7.2. Many thanks and have a nice weekend.
1
vote
0answers
19 views

How to filter 2 indexed event fields, both fields array?

I have this event: event onSubmissionBoth(bytes32[] indexed docHash, string[] indexed doc4DHash); Now I log into the event like this: function submitHash(bytes32[] calldata docHash,string[] calldata ...
1
vote
1answer
58 views

Where to define the MetaMask window.ethereum.on Listener

I have tried to include the window.ethereum.on listener to detect account changes in MetaMask, in my mounted () {} method. When the listener is triggered, it itself triggers the location.reload() ...
0
votes
1answer
49 views

Receiving 'undefined' when using getBalance from web3

I am trying to fetch the balance of an address by web3 and node from Ropsten network with the commands below: var Test = require('web3') var url = 'https://ropsten.infura.io/v3/...' var web3 = new ...
0
votes
0answers
14 views

howt to generate AST tree form (not in JSON form) from Solidity File (.sol)

I have .sol file and want to generate AST only from .sol file. My scenario is that at the command line (after installation some package), I just have to give a command like package_command --AST [from ...
0
votes
0answers
11 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
81 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
60 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
43 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 ...
1
vote
0answers
24 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
29 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
24 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
189 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
66 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
63 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
211 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.
3
votes
1answer
397 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
42 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
123 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
48 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
38 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
81 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
26 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
92 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
25 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
229 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
13 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
12 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
48 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
35 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
141 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
107 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
52 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
2 3 4 5
11