New answers tagged

0

The only reasonable thing I can imagine is that the transaction was replaced by another with a larger fee. Ethereum clients have a limit on how many transaction they can have in the pending pool at any moment. So transactions with lower fees can be dropped. Since synchronization it is a p2p protocol some of the low fee transactions will keep appearing and ...


0

WebSockets provide a persistent connection between a client and server. This connection has to be manually closed, otherwise the library tries to keep the connection alive. It feels funny to me that you have to manually do this rather than have the object destroy itself on process end. The process does not end unless all connections and methods end. Node....


1

In a block multiple uncles can be included. This method returns only one uncle. web3.eth.getUncle(blockHashOrBlockNumber, uncleIndex [, callback]) uncleIndex is a number starting from 0 which represents which uncle will be returned. If for example a block has 2 uncles, the first uncle has uncleIndex=0 while the second uncle has uncleIndex=1.


1

This question is not related to ethereum at all. Try using PM2 for your nodejs, there is auto starting option for nodejs applications.


0

Change this: console.log(res.pending[adrOfKey[0]]); To this: for (const key of adrOfKey) console.log(res.pending[key]);


0

The number '11' is the decimal value of nonce of the account '0x0000000186c96Ab17A967d7A3033db82efcA587B'. The below example has been taken from the link below: 0x326 = (806) decimal Example Tx Pool Get Content { pending: { 0x0216d5032f356960cd3749c31ab34eeff21b3395: { 806: [{ blockHash: "", blockNumber: null, from: "...


0

You asked another way to get transaction data other than querying by its hash. Here is one : You can get transaction details by providing the block number/block hash containing the transaction and the positional index of the transaction in the block. getTransactionFromBlock(hashStringOrNumber, indexNumber [, callback]) Get Transaction From Block


0

So I don't know the meaning of the number, for example '11' in first line of pending object which is included above response. Instead of console.log(response), use console.log(JSON.parse(response, null, 4)). However, it does not provide details such as the meaning of the number mentioned above. Yes it does: Each of these fields are associative arrays, ...


0

Your problem is the attempt to JSON.parse(compiledFactory.interface). Function JSON.parse expects an input string which represents a valid JSON object. You're attempting to obtain that object by requiring a JSON file: const compiledFactory = require('../ethereum/build/LotteriaFactory.json'); But require statements are designated for importing JS code, ...


0

login to your https://infura.io/ panel then you can get your project secret and Id


1

I have created and compiled a contract according to the one that you've posted in a comment. I have deployed it to Ropsten, and then verified it on Etherscan. As you can see on Etherscan, its byte-code contains the sequence 704f1b94, which is the function-selector of function registerUser(string). And as you can see on Etherscan, the byte-code of your ...


1

It seems you are using your contract from the backend. In that case you cannot use MetaMask because it runs in the browser. You have these options: Execute the transactions that make changes from the frontend. The UI has to connect to MetaMask and use it as provider for @truffle/contract. Use your own wallet in the backend and configure truffle to use it ...


1

I know it's too late to answer this question. But I hope it could help others. You can not list transactions directly using web3 and JSON-RPC. In order to have a list of translations involving an address you need to scan Whole(or a part of) blocks of ethereum blockchain to find them. You could guess! It's pretty time intensive! To solve this problem you ...


1

Using below code you can deploy your contract using truffle-contract. const contract = require('truffle-contract'); const DeployJson = fs.readFileSync("E:/Deploy/build/contracts/Deploy.json"); const DeployContract = contract(DeployJson); DeployContract.setNetwork('network_id'); // Unlock the account from which you want to deploy the contract await web3.eth....


0

I'd like to get pending transactions with using geth via web3.js (or with using other client via other node.js library). In order to get pending transactions using web3.js, the required steps are: npm i web3 Create a file getPendingTx.js const Web3 = require('web3'); const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); const ...


0

To get the pending transactions you need a node that you're running on your own because this type of action requires a lot of resources. You can run your own Geth node and wait until it is synchronized. When I want to run a Geth node on the main net and query for the transaction pool, I usually start it like this. Download the Geth binary and rename it as ...


1

There's no deploy method in the API provided by require('truffle-contract'). Given truffleContract = require('truffle-contract'), you need to do something like this: const myContract = truffleContract({abi: ..., unlinked_binary: ...}); const block = await web3.eth.getBlock('latest'); myContract.setProvider(web3.currentProvider); myContract.defaults({from: ...


1

I am able to connect to your contract. Try this. I got your abi from etherscan. const express = require('express') const Web3 = require('web3') const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/')); const abi = [{"constant":false,"inputs":[{"name":"CopyMatch","type":"address"}],"name":"proxy_ActiveStrategy","outputs":[{"name":"...


0

new web3.eth.Contract calls the constructor of class web3.eth.Contract. This constructor (naturally) returns an instance of class web3.eth.Contract. Your attempt: var contract_object=new web3.eth.Contract(...); var theContract=contract_object.new(...); Fails because class web3.eth.Contract does not have a member function named new. You are most likely ...


1

Assuming that you have already compiled the contract, and that its abi and bytecode are in files <ContractName>.abi and <ContractName>.bin respectively, you can use this script (web3 v1.2.1): const fs = require("fs"); const Web3 = require("web3"); const NODE_ADDRESS = "..."; const PRIVATE_KEY = "..."; const CONTRACT_NAME = "..."; const ...


0

Hey if you are using truffle framework you can set your gas limit and gas price in your truffle-config.js file for different network and env like this: module.exports = { networks: { development: { host: "127.0.0.1", port: 7545, network_id: "*" // Match any network id }, develop: { port: 8545 }, rinkeby: { provider: () => new ...


0

I used ABI and bytecode of my contract as a value and the mentioned error never occured. var contractAbi=[ { "constant": true, "inputs": [], "name": "notation", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], ...


0

There are several errors I see in your code: Do not use absolute paths such as fs.readFileSync('E:/Deploy/contracts/Deploy.sol','utf8'); but start using relative paths, because the moment you change the project path or run it from other device the project won't work. You are looping thru all contracts in contract_compiled.contracts how do you after the loop ...


0

Probably contract_compiled.contracts[contractName] does not have a field named interface. This means that contract_compiled.contracts[contractName].interface == undefined. I believe that the field you're looking for is called _jsonInterface. But in either case, do yourself a favor: console.log(JSON.stringify(contract_compiled.contracts[contractName], ...


0

This is happening, because you are saving to the file the index of the element that's being pushed to keys and not the actual address. Try this: for(var i = 0; i < amount; i+=1) { var account = accounts.create(web3.utils.randomHex(32)); keys.push(account); fs.appendFileSync('accounts.txt', account.address + ',\n'); } Or if you want to save ...


0

I think you need to remove to in rawTx.


Top 50 recent answers are included