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
14 views

Truffle cant find script file

I am trying to execute a script in my truffle project. The script is located in the scripts folder. But whether I run the command from within the root of the project or inside the scripts folder, it ...
0
votes
0answers
13 views

Use Web3js library

I am new to the use of blockchain we are building an application where I have the following problem to solve: Users when registering in our system will create a wallet of an ethereum token Be able to ...
1
vote
0answers
7 views

Subscribing to events using ethers / hardhat network

I have a basic node express application. It connects to my locally running hardhat network via ethers & websocket. The connection seems to work, since I can query the blockchain succesfully (for ...
0
votes
0answers
12 views

Web3.js call() on view function on Smart Contract is failing

I am trying to access a simple variable on my smart contract, locally inside my nodejs application. The relevant parts of my contract look like this import "@openzeppelin/contracts/utils/Counters....
0
votes
1answer
13 views

How to send erc20 tokens through web3 on nodejs

My transactions go through without errors, while they're pending the data field shows the amount of tokens I'm sending, but when the transaction goes through the data field is empty. Here is my code: ...
0
votes
0answers
22 views

Nodejs API to Solidity data transfer

I want to know that how can I transfer Nodejs API call response to Html, where for every call or response gas will be consumed by help of Solidity from the Ganache Ethereum account.
0
votes
0answers
10 views

Send web3js event to webhook when it happens

I have a transfer method that transfers a token using the deployed smart contract in Web3JS. I have to return the values to the customer, so I subscribe to the transfer event and wait for it to ...
0
votes
0answers
20 views

How to reserve ethereum addresses for data init

I would like to give each of my preloading users a blockchain address. I have used Sequelize to sync my database with the data. How to ensure all my users have their unique blockchain addresses? I am ...
3
votes
2answers
47 views

How to hide the private key for sign trnx with NodeJS?

When I sign a transacction in a website I do it with Metamask and my private key is safe. Now I am signing transactions automatically from a NodeJS like the next code. Can I somehow hide my privateKey ...
0
votes
0answers
17 views

Decoding function from transaction input [duplicate]

I am looking at tracking ERC-20 token swaps. For example, this transaction hash "0xbcc5eeae8313f2c958b858f7ad6998935f1e74362289571110dc0930779effea" is swapping DAI for ether. I can see ...
1
vote
0answers
25 views

Calculating price of a token

I am trying to calculate the price of an ERC20 token. My approach is to determine the total value of the token pool and divide that by the total number of tokens. However, the values I am getting for ...
1
vote
0answers
14 views

Arrayify error, when passing a string as an argument to a transaction

I have been having this problem with the web3 library for a while now and I am not sure how to solve. I am encoding a transaction within a react app. So far, all contract interactions inside the app ...
1
vote
2answers
92 views

Cannot install truffle. Node.js and npm are installed

I currently have node 12.21.0 + npm 6.14.41 + macos big sur 11.2.1 + ganache 2.5.4 + command line for xtools 12.4 I read online that truffle does not support node v13, so i uninstalled the one i had (...
0
votes
0answers
10 views

Serialized abi was altered during trasmission from Nodejs server

Here is the a text file when it is console out on Nodejs (12.16) server: forsale abi : [ { "inputs": [ { &...
0
votes
0answers
62 views

IPC Connection not work on Node.js (web3)

I have a geth node launch on linux, I want to access it through the IPC connection in a Node.js application. I am getting this error : /home/**/node_modules/web3-core-helpers/lib/errors.js:66 ...
0
votes
1answer
68 views

Truffle not working after install using npm

I just tried to install truffle using npm. I followed the documentation and did npm -g install truffle However, after that, when I try to do anything (such as just run truffle or truffle --version), I ...
0
votes
1answer
22 views

Why can't I establish a socket connection with Infura? Project ID is correct, I triple checked

I want to subscribe and listen to events that involve funds moving to my wallet, however I for some reason am not able to establish a socket connection to an Infura node. First I npm init and npm web3....
0
votes
1answer
42 views

Calling web3.eth.getAccounts() does nothing - no errors

I am trying to get all accounts using web3@1.3.3 and @truffle/hdwallet-provider@1.2.2. I am using HDWalletProvider with Infura. I am running this code on backend (Node.js v14.15.5). This is the code ...
0
votes
0answers
31 views

Problem reading chaindata that generated by ganacha gui

my intention is to write a script to analysis eth data from scratch. i run ganache gui in window with about 200 blocks up to now, and i quite sure that chaindata is keep growing big, then i simply run ...
0
votes
2answers
70 views

How does a node execute the smart contract in the EVM and update the blockchain with result of contract execution

I would like to understand how the Ethereum Node is loading the contract bytecode in the EVM and then write everything that it needs, back to the blockchain. This is how I understand it. The contract ...
0
votes
0answers
25 views

Script for running permutations of seed phrases and finding corresponding ethereum address

My metamask extension was deleted and what I thought was the correct ordering of the seed phrase turns out not to be so. I have all 12 BIP39 phrases and am looking to run a 12! permutation to find the ...
0
votes
0answers
36 views

Getting undefined transactions with web3.js

I use the following script to monitor pending transactions for a certain account: const sub = web3.eth.subscribe('pendingTransactions', (err, res) => { if (err) console.error(err) }) sub.on('...
0
votes
0answers
13 views

Withdraw ETH from Keythereum wallets

So I was using keythereum to generate public and private keys. const dk = ethereum.create(); parameters.address = ethereum.privateKeyToAddress(dk.privateKey); parameters.pKey = dk.privateKey.toString('...
0
votes
0answers
28 views

Programmatically convert log data (hexadecimal) into negative decimal value

I'm having some trouble converting negative numbers in the log data of an Ethereum transaction. In this transaction, log index 192, topic 3 is listed as "...
0
votes
0answers
21 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
2answers
140 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
40 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
1answer
55 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
32 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
165 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
34 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
21 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
201 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
212 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
1answer
26 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
90 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
29 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
135 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
111 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
210 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
90 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
20 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
121 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
102 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
21 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
14 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
137 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
192 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
52 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 ...
2
votes
0answers
68 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 ...

1
2 3 4 5
11