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
1answer
45 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 ...
6
votes
2answers
11k 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 ...
0
votes
0answers
18 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 ...
0
votes
1answer
674 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
79 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
0answers
40 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
55 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 ...
7
votes
1answer
806 views

Truffle unbox drizzle not working properly

truffle version = 4.1.4 truffle unbox drizzle truffle compile truffle migrate npm run build npm run start this gets me this error: Truffle Drizzle-box fails with TypeError: (0 , _drizzle....
27
votes
1answer
27k views

How to convert string to bytes32 in web3js?

I have a contract with a public variable that's bytes32. If I enter the value 20160528 then it auto converts to bytes32. Is there anyway to convert it back from the nodejs terminal? I've been ...
1
vote
0answers
94 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
234 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 ...
3
votes
1answer
1k 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
14 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
747 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 ...
24
votes
7answers
42k views

Deploy contract from NodeJS using web3

I'm trying to create and deploy a smart contract through NodeJS using web3, but it is not working as I get a "web3.eth.contract.new is not a function". Here is my code: var web3 = require('ethereum....
0
votes
1answer
121 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
0answers
40 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 ...
1
vote
1answer
2k views

Using vanilla javascript with web3 and metamask

I have searched severally on how to use web3 with metamask without nodejs without any success. I want to be able to get an instance of a user's metamask account through web3 and vanilla javascript ...
0
votes
2answers
581 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 ...
27
votes
3answers
8k views

How to programmatically detect and accept ETH and ERC20 deposits

I'm looking to replicate the functionality provided by cryptocurrency exchanges such as Kraken and Poloniex when it comes to depositing ETH and tokens. Namely: Users can generate and send funds to ...
0
votes
0answers
64 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 ...
1
vote
1answer
928 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 ...
0
votes
0answers
284 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('...
1
vote
1answer
81 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 ...
0
votes
0answers
21 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
207 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 "...
9
votes
6answers
18k views

Solc --version: command not found

I'm trying to use solc with no success. I download solc with npm install solc but when I run solc --version the console output is: command not found. If I list packages npm list I'm able to see ...
1
vote
1answer
70 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 ...
2
votes
3answers
3k views

How to use Solidity solc to compile A.sol that imports B.sol file?

I know how to install solc via "npm install --save solc" then use solc.compile to compile one sol file. But now I've got A.sol file that imports B.sol file, and when I run node compile.js, no error in ...
5
votes
2answers
5k views

Web3.js browser version only

I want to create a simple page to interact with my deployed contract. I don't want to use Node.js. I want to use html + web3.js browser version. I got a link: https://github.com/ethereum/web3.js/tree/...
0
votes
1answer
78 views

Wrong version of web3.js

$ npm show web3 web3@1.2.5-rc.0 | LGPL-3.0 | deps: 8 | versions: 115 Ethereum JavaScript API https://github.com/ethereum/web3.js#readme ... $ node app/test.js VERSION { api: '0.18.4', node: [...
0
votes
0answers
455 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
3k 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
1answer
59 views

How to configure APIs to run with Ropsten addresses

I have my contracts deployed on Ropsten network. I deployed those contracts from my local machine using Truffle migrate. Then I set up an AWS EC2 Ubuntu server to host my RESTful APIs. I installed ...
5
votes
2answers
2k 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) { ...
4
votes
2answers
1k views

How to compile Solidity ^0.5.5 contract with Node.js?

I am terribly new in Solidity and now I try to learn how to compile a contract in Solidity ^0.5.5 (No versions below). I have the contract as follow (UsersContract.sol) pragma solidity ^0.5.5; ...
0
votes
0answers
58 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
3answers
51 views

Could not assign contract state variable value to javascript variable

I want to retrieve and assign the value of my contract state variable to my javascript variable.I am doing as per guidlines provided on this community, but failed to assigned. my javascript code is ...
0
votes
1answer
630 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
1k 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), ...
2
votes
1answer
294 views

How can i deploy compilled contract with node/web3 and metamask?

Does anybody knows how to deploy smart contract with node/web3 and using unlocked metamask account. I mean over internet it is advised to use HDWalletProvider with mnemonic but I want that user that ...
1
vote
1answer
508 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
117 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
320 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 ...
2
votes
0answers
228 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
2k 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 + " ...
2
votes
0answers
181 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
31 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 ...
0
votes
1answer
49 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 &...
1
vote
2answers
1k 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 ...

1
3 4
5
6 7
13