Connection not open on send when subscribing to new block headers

I am running a local ethereum node with the below configuration geth –syncmode “full” –datadir “.” –ethash.dagdir “.” –cache=4096 –rpc –rpcaddr test.example.com –rpcapi=”web3,miner,admin,db,net,eth,personal,debug,txpool” –rpccorsdomain “test.example.com” –rpcvhosts “test.example.com” –ws –wsaddr test.example.com –wsapi=”web3,miner,admin,db,net,eth,personal,debug,txpool” –wsorigins “*” I am listening to new block headers by subscribing to blockchain events. I am using web socket connection. web3 version 1.2.4 let…

TypeError: Cannot create property ‘constant’ on number ‘123’ web3js

I am trying to send transaction to my contract via node js but I am encountering many problems. This is my node js code: var Web3 = require(‘web3’); var web3 = new Web3(new Web3.providers.HttpProvider(‘http://localhost:7545’)); var myAddress = ‘0x4e5d87aB06D13a17E9f35dfC235B4fC70669151d’; var fs = require(‘fs’); var parsedABI = JSON.parse(fs.readFileSync(‘../abis/Marketplace.json’, ‘utf-8’)); var contractABI = fs.readFileSync(‘../abis/Marketplace.json’) var contractAddress = ‘0x15Cb1e185b0269fFd93516BE007B2aF4BA59f2F5’;…

Error:gas required exceeds allowance (9975570) or always failing transaction

I am trying to calculate the gas limit, to conduct an erc20 token transaction from 1 address to another and get this error:Returned error: gas required exceeds allowance (9975570) or always failing transaction can you help interpret it? let contract = new web3.eth.Contract(ABI, token_contract_Address, { from: Address }) const acc_balance= contractInstance.methods.balanceOf(walletAddress).call(async function(err, result) { await…

What is the algorithm that adjusts the difficulty of the proof of works in a proof of work based cryptocurrency?

For instance, Bitcoin has a proof of work based consensus algorithm, it’s how Bitcoin chooses a node to create the next block in Bitcoin’s blockchain. In this way the network is in consensus about the creation of the next block. Part of this block creation process is issuing the next proof of work to the…