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

AnyswapV5ERC20 deployment - set totalSupply

I have some questions about the anyswapV5ERC20.sol contract. First of all, are there some more detailed docs than the guide of andre cronje? My main question is: How can I set the totalSupply or mint ...
0
votes
0answers
19 views

BEP20: transfer amount exceeds allowance

I want to swap bep20 tokens like BUSD - BNB and BNB - BUSD, i already approved tokens for the swapping but while i try to swap BNB - BUSD it's throw error like BEP20: transfer amount exceeds allowance ...
0
votes
0answers
7 views

EtherscanProvider.getHistory(), got an error;

nodejs.SERVER_ERRORError: missing response (requestBody=null, requestMethod="GET", serverError={"code":"ECONNRESET","path":null,"host":"api....
0
votes
0answers
20 views

Make offer to opensea asset through opensea-js

I'm using opensea-js alongside with nodejs to make offer on opensea testnet assets. The code is following: process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const Web3 = require('web3') const opensea = ...
1
vote
2answers
30 views

Hardhat: How to "spin up" a local JSON-RPC fork node at a specific block number with my new contract deployed in it?

I can "spin up" a local fake blockchain in Terminal using $ hardhat node I can also make it fork the real mainnet using Alchemy, even pin it to a specific block N. Other local applications ...
0
votes
0answers
16 views

Check if smart contract function exists from code and then call it

I'm getting the code of a smart contract by using web3.eth.getCode(contract_address) I want to call certain functions that I'm fairly certain exist on that contract, however I don't know the ...
0
votes
0answers
11 views

web3.eth.getBlock(i) is not working in my code. i am getting error for the 2nd block which is web3.eth.Block(1). Please anyone help

async function AllDocuments() { try { const latest = await web3.eth.getBlockNumber() let txStr = '' console.log("latest") for(let i = 0; i <= latest; i++ ) { ...
0
votes
0answers
8 views

Listen events synchronously using web3js

I am listening two events like this. contractConnection.events.allEvents(options).on('data', async (data) => { if (data.event == 'AddData') { await this.storeSecondarySale(data....
0
votes
0answers
37 views

OpenSea.js No output using web3 and node 8

Working with OpenSea.js and have the following code but the output is absolutely nothing. Can someone help? const Web3 = require("web3"); const OpenSea = require("opensea-js"); // ...
0
votes
0answers
28 views

How to load web3 in front-end correctly?

I am trying to develop a new Dapp. I have written the smart contracts and they are working well. I now need to use web3 to interact with the smart contracts, for now using ropsten or rinkeby. I get ...
1
vote
0answers
49 views

How to transfer an ERC1155 Matic token using Node.js?

I'm trying to write a Node script that will transfer an ERC1155 token on the Matic network from my address to someone else's address. Here's an example token: https://opensea.io/assets/matic/...
0
votes
0answers
29 views

I want to get the image(IPFS link) of the NFT i am using etherscan api

I am trying to list of all NFT tokens in account I am using this etherscan API to get all ERC721 tokens but not getting image in in https://api.etherscan.io/api ?module=account &action=...
0
votes
0answers
99 views

MetaMask - Internal JSON-RPC error

i was developing a full stack nft marketplace, where i can mint nfts but when i try to buy it gives me this error :MetaMask - Internal JSON-RPC error code: 3, message: "execution reverted: Please ...
0
votes
2answers
18 views

how can i send a transaction in spesific block numbers with web3Js?

I wanna know how to send the transaction in spesific block numbers with web3js ( Yes its for sniping bot ) The purpose is to avoid the tax in 1-3 blocks since liquidity is added For example : New ...
2
votes
0answers
26 views

Why does web3 say the transaction hasn't been mined in 750 seconds when the blockchain transaction says it was mined in 1:30 seconds

We keep getting an error from our node application with the following error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent. Be aware that it might ...
0
votes
0answers
9 views

How to take input in remix for 2D array in solidity?

My Contract code contract SomeTokenVesting { mapping(address => uint256[6]) public vestingAmounts; constructor() { // some code } function addSomeBeneficiaries(address[] ...
0
votes
0answers
9 views

Web3js Module Not Found

I'm using latest version of node, latest version of web3js. I'm pretty new to this and trying to test out some web3 stuff. I'm trying to use the getPendingTransactions as mentioned on the web3js ...
0
votes
0answers
15 views

Can you call a variable value with web3.js, without writing the function in solidity?

I have used remix and I can see that whenever I create a public variable, it also creates a function for the variable and when you press it, it shows the variable value but, when I want to call a ...
0
votes
0answers
22 views

Solidity ABI decode equivalent in web3js

This is the Solidity code from this oracle contract: function transmit(bytes calldata _report, ...) external { ... (r.rawReportContext, rawObservers, r.observations) = abi.decode( ...
0
votes
0answers
34 views

Deposit tokens to pool -> transaction reverted by the EVM

I`m trying to deposit funds from my wallet into a pool using the following Node.JS code. require('dotenv').config() const Web3 = require('web3') //WEB3 Config const web3 = new Web3(process.env....
0
votes
0answers
16 views

Why do we convert private key to hexadecimal via the Buffer module in a transaction performed in Node.js with ethereumjs-tx & Web3?

I'm following a tutorial on how to send a signed transaction in Node.js with Web3 and the ethereumjs-tx module. My code works fine, but I don't understand the use of the Buffer module for my private ...
0
votes
0answers
6 views

predefined error in web3js like poocoin

Sometimes I need to check the error before sendSignedTransaction, like poocoin, they has predefined error before transaction send, how to make that with web3js?
0
votes
0answers
10 views

Error: Network not synced; last block was 1630630627.508 seconds ago

I checked eth.syncing in the console and it says false which should mean the blockchain is synced, but in my node script I get an error that blockchain is not done syncing: const fs = require('fs'); ...
0
votes
1answer
26 views

Is there a way to specific the block when buy BEP20 token?

To avoid bot, some of fairlaunch and dev make a 99% tax in 2 first block buying after liquidity, it called antibot system. https://bscscan.com/tx/...
0
votes
0answers
25 views

How to check if an address is included in a mapping of address' key from Web3?

I would like to check if a specific address is included in an address key mapping from web3? Here is my Solidity Smart Contract: pragma solidity >=0.4.21 <0.7.0; contract Election { //...
0
votes
0answers
21 views

What is the primary cause of error ECONREFUSED?

I have written a few small scripts using Node and Ethers to do simple buy and sell transactions through the PCS router and have had success when I write the code however, I am just learning and i have ...
0
votes
2answers
63 views

Signing transaction on frontend and sending on backend server

Hi I'm making an NFT auction site similar to OpenSea to learn blockchain technology. But I have some security concerns about sending transactions on the frontend of my application because if a user ...
0
votes
0answers
54 views

Insufficient funds for intrinsic transaction "response" "jsonrpc 2.0 method=sendTransaction

I have a problem, when i try to buy a token with my sniper bot have this error. I have > funds of gas require. this is my script (i use BNB) const ethers = require('ethers'); const prompt = ...
0
votes
0answers
34 views

Best practice for Single or Multiple instances of Provider for different types of block chain requests #

What the best practice is in terms of using the ethers provider as either a singleton (or persistent instance) in a module or to create a new instance every time a request is made. For example, for a ...
0
votes
1answer
103 views

Transaction reverted during swapExactTokensForTokens (UniswapV2Router02, web3.js)

I am attempting to swap ETH for DAI using the Uniswap Router, but am facing a problem where the transaction gets reverted, along with the following message: Transaction has been reverted by the EVM. I ...
0
votes
1answer
55 views

Setting the value of AmountOutIn

I have been running this small script to buy through the PCS router contract and as it works, the slippage is set to 0. I need to know how to find the value and what it expects so that i can set ...
0
votes
0answers
23 views

Must I have metamask installed in order to use Web3js

I forked the GitHub repository https://github.com/dappuniversity/price-bot and made some edits to the code. I used my laptop and ran the code using by typing the command npm run start in my terminal ...
1
vote
0answers
17 views

How to decode estimateGas Error

i'm having a problem with estimateGas function. var method = contract.methods.doSomething(); var estimateGas = await method.estimateGas({ from: address, to: toAddress, }).then(...
0
votes
1answer
17 views

Charge ecr20 token for network fee instead of eth [duplicate]

Is it possible to subtract the network fee from the user's ERC token instead of subtracting from the eth balance using web3js
0
votes
0answers
14 views

I am trying to deploy on Polygon network using truffle suite however during migration I am getting error!

Error message: truffle migrate --network matic --reset Compiling your contracts... =========================== / Fetching solc version list from solc-bin. Attempt #1 C:\Users\aryan\Documents\GitHub\...
0
votes
0answers
38 views

How do I get the token symbol, token name, and size of liquidity pool for a newly minted pair using Node.js and Web3?

//original code courtesy of EatTheBlocks factory.on('PairCreated', async (token0, token1, pairAddress) => { console.log(` New pair detected on PancakeSwap ================= ...
0
votes
1answer
280 views

How can I get the token symbol from the token contract address using Node.js?

PLEASE DO NOT HELP ME BY SUGGESTING PYTHON CODE. I'M ONLY INTERESTED IN SOLUTIONS THAT RELY EXCLUSIVELY ON NODE.JS. I am trying to build out a sniping bot in Node.js using a snippet from EatTheBlocks ...
1
vote
0answers
212 views

[ Web3.js on BSC ]: Returned error: unknown account

Here's the error: index.js:1 Error: Returned error: unknown account I'm getting this error while running this method: nftMintingContract.methods.mint(account, cid).send({from: account}) The ...
0
votes
1answer
29 views

The contract code couldn't be stored, please check your gas limit

I tried to deploy my contracts but every time I get this error. The first two contracts were deployed successfully, but the third contract, "PostFactory.sol" is facing this issue in loops. I ...
0
votes
1answer
13 views

index within block

is it possible to choose which index you want to aim for when sending a transaction? Lets say there are 100 transactions all with 5 gwei, if i want to be on index 25, would it be possible to send the ...
0
votes
0answers
110 views

MetaMask - RPC Error: Error: [ethjs-query] while formatting outputs from RPC

I am very new to Ethereum smart contract solidity programming. Currently, I have been facing this issue when I try to pass a variable from my Node.js servlet to the smart contract I deployed using ...
0
votes
0answers
13 views

Send different signed transactions in a batch?

I have signed transactions and want to make a batch request with all the different signed transactions. How can i achieve that?
0
votes
1answer
272 views

How to set private key for Ethers Signer

I would like to invoke a smart contract function using Ethers library. Since I have my own node I'm connecting using RPC connection and now I would like to invoke a transfer function (of an ERC20 ...
1
vote
2answers
314 views

Using solc to compile contract that imports local OpenZeppelin contracts

I am trying to compile and deploy a contract based on OpenZeppelin using Node.js app.get("/", (req, res) => { const input = fs.readFileSync("./BaseContract.sol", "utf8&...
0
votes
0answers
99 views

Connecting Metamask with Web3

I am relatively new to Solidity, Node.js, and Web3, and I am trying to create a simple betting platform that runs on the Ethereum blockchain. I have been digging around the internet for proper ...
0
votes
0answers
37 views

Truffle Compile Fails with Error " Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition"

When running truffle compile in the root directory of my project I get the following error: ParserError: Expected pragma, import directive or contract/interface/library/struct/enum/constant/function ...
0
votes
1answer
446 views

How to connect ethers.js with MetaMAsk and other Wallets?

const provider = new ethers.providers.Web3Provider(window.ethereum) while using this i am getting window is not defined error..and i dont know how to use it. Do anyone has idea how to do it
0
votes
0answers
23 views

Getting correct decimals in ethers.io library, using getAmountsOut() ABI

I am using the getAmountsOut() interface to get the current PancakeSwap price of a random BSC token that has 9 decimals in its smart contract, see https://bscscan.com/token/...
0
votes
0answers
71 views

web3js is not executing contract functions

I am trying to call the following simple function from web3.js but none of the function is being executed as I find no transaction entry in ganache. pragma solidity ^0.5.11; contract FirstContract { ...
1
vote
0answers
20 views

How to know the number of transactions sent to an address?

Ethereum assign random nonces to contract transacctions? I am trying to send my transacctions with web3js assigning a correlative nonce. I read the last nonce and increment it in one to send the tranx....

1
2 3 4 5
13