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

Object { code: -32000, message: “unknown account” } while sending transaction to smart contract

I know there are many questions revolving around same. But none of the answers are concrete. I have deployed my contract using remix on BSC test net and now making frontend to interact with my ...
1
vote
0answers
14 views

must be a lvalue, what's this error mean, precisely?

I am writing a few contracts and I'm all good to go until I migrate and hit this bump in the road, it has tormented me for 3 days I can't seem to figure out the issue I am thinking it is a camel case ...
2
votes
2answers
23 views

why do i get the error Contract Token“ and ”Ethswap" token contract is not deployed to detected network error

I deployed my contract sent my decentralized application to Github pages. (GH.pages) here is the link to see it, it will say error not deployed to the detected network if you want to see the ...
1
vote
1answer
27 views

get a list of all erc20 tokens including address and decimals

Is there a way to programmatically fetch a list of all erc20 tokens including contract addresses and decimals? Im using web3 but if there is any rest service I dont know Im happy to get to know about ...
0
votes
0answers
24 views

Monitor transfers to given addresses

I have a program that monitors all token transfers going out from a set of addresses I have. That works fine, I get the transactions, the tokens, the amount etc. But now when I apply the whole logic ...
2
votes
2answers
22 views

Find address of a contract before deployment in Hardhat and Ethers.js

I have 2 contracts which take each other's addresses as constructor arguments. Here's the pseudocode, constructor A(address B) constructor B(address A) I am deploying contracts using const Contract = ...
0
votes
0answers
15 views

how to calculate create2 ? convert solidity to node/python [closed]

anyone can convert this code to nodejs? function predictDeterministicAddress(address master, bytes32 salt, address deployer) internal pure returns (address predicted) { // solhint-disable-next-...
0
votes
1answer
10 views

format transfered value with contracts decimals

I have the amount of transfered tokens converted from a transactionreceipts log data. for example USDT the value I got is 500000000 , USDT has 6 decimals. The actual transfered value is only 500 USDT, ...
1
vote
1answer
11 views

Server firewall is blocking the Web3.js connection in NODE

My Centos server has running the "ConfigServer Security & Firewall" and its blocking the Web3.js connection with Ethereum node. The functions calls returns: "Error: Invalid JSON RPC ...
0
votes
0answers
7 views

value property from decoded txreceipt logs appending zeros

I wrote a program that scans all transaction for token transfers and logs the amounts transfered. I am using node package abi-decoder to decode the transaction receipt logs for this. My question is, ...
0
votes
0answers
13 views

Executing the Truffle console script:Error: ENOENT: no such file or directory,

I am trying to execute the following script: module.exports = (callback)=> { Message.setProvider(web3.currentProvider); const MyContract = require("~/Truffle programs/...
0
votes
0answers
21 views

Web3js works in my localhost NODE server but return an error in my remote webserver

All Web3js functions works correctly in my NODE (10.7.0) localhost server but the same configuration return the next error in my remote NODE webserver (same configuration and versions). Any idea? ...
0
votes
0answers
9 views

get amount of transferred tokens from transaction receipt

Can someone explain to me how to get the amount of tokens that have been transfered from a transaction receipt? I came across some posts that said I can get it out of the data property from the ...
0
votes
0answers
6 views

web3 transaction value always 0

Can anyone explain to me, why the transaction object I receive via web3 always has a value of 0? When I open up the transactionhash in etherscan, it shows under the to field which is named "...
0
votes
1answer
21 views

web3 - get contract from transaction object

I am fetching the latest blocks transactions using web3 and then I use the getTransaction(txhash) function to get the transaction object. I was wondering, how could I get the information about which ...
1
vote
0answers
20 views

subscribe to address (wallet) and get transaction info including receiving token name (if token)

I just started playing arround with blockchain development and the use of web3 so I have more questions than my fingers are able to type, hope some of you are able to answer the first one I have. What ...
0
votes
1answer
16 views

Calling smart contracts with value using web3js and galanche

I'm fairly new to Ethereum smart contracts, so this might be a stupid question, but I need someone to help me out. I've set up Galanche on my machine (MacOS 11) and written a very simple currency ...
0
votes
0answers
34 views

Listing NFT on OpenSea via JS API: Failed to extract transfer calldata Error 400

I am trying to use the OpenSea JavaScript API in order to list NFTs for sale automatically. I can't seem to figure out why I keep getting the error Error: API Error 400: ['Failed to extract transfer ...
0
votes
0answers
13 views

How to transfer Bep20 token using web3.js [duplicate]

I want to transfer a Bep20 custom token from a wallet to another using web3.js in Binance Smart Chain. I can transfer BNB using this code: // Create transaction const myTransfer = async () => { ...
0
votes
1answer
15 views

Secure data for NodeJs interface

I want to secure data for my NodeJs+Express+Mongodb website : ABI Contract address Infura.io API key Those data are very important because if an attacker can change them, it can steal ETH from my ...
0
votes
1answer
26 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
15 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
71 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
19 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
13 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 ...
3
votes
2answers
66 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
26 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
29 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
17 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
166 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
11 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
119 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
82 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
29 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
50 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
107 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
28 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
55 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
14 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
33 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
26 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
264 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
57 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
76 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
85 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
233 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
42 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 ...

1
2 3 4 5
11