Developers Forum for XinFin XDC Network

Shashank Gupta
Shashank Gupta

Posted on • Updated on

[Solved] Invalid contract value: xdc gets appended instead of 0x

The contract address in my code is "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266".

It still says its the same issue.
index.ts:213 Uncaught (in promise) Error: invalid BigNumber string (argument="value", value="xdcf39fd6e51aad88f6f4ce6ab8827279cfffb92266", code=INVALID_ARGUMENT, version=bignumber/5.4.1)
at _Logger.makeError (index.ts:213:28)
at _Logger.throwError (index.ts:225:20)
at _Logger.throwArgumentError (index.ts:229:21)
at _BigNumber.from (bignumber.ts:240:27)
at _Formatter.transactionResponse (formatter.ts:323:41)
at _Web3Provider. (base-provider.ts:1426:39)
at Generator.next ()
at fulfilled (formatter.ts:518:1)
makeError @ index.ts:213
throwError @ index.ts:225
throwArgumentError @ index.ts:229
from @ bignumber.ts:240
transactionResponse @ formatter.ts:323
(anonymous) @ base-provider.ts:1426
fulfilled @ formatter.ts:518
setTimeout (async)
(anonymous) @ inpage.js:17
write @ inpage.js:17
b @ inpage.js:17
(anonymous) @ inpage.js:17
v.write @ inpage.js:17
g @ inpage.js:17
(anonymous) @ inpage.js:8
o.emit @ inpage.js:8
_ @ inpage.js:17
w @ inpage.js:17
b.push @ inpage.js:17
_write @ inpage.js:1
b @ inpage.js:17
(anonymous) @ inpage.js:17
v.write @ inpage.js:17
g @ inpage.js:1
(anonymous) @ inpage.js:8
o.emit @ inpage.js:8
_ @ inpage.js:1
w @ inpage.js:1
b.push @ inpage.js:1
_onData @ inpage.js:1
_onMessage @ inpage.js:1
postMessage (async)
_postMessage @ contentscript.js:1
_write @ contentscript.js:1
v @ contentscript.js:1
(anonymous) @ contentscript.js:1
b.write @ contentscript.js:1
m @ contentscript.js:45
(anonymous) @ contentscript.js:21
o.emit @ contentscript.js:21
_ @ contentscript.js:45
w @ contentscript.js:45
v.push @ contentscript.js:45
_write @ contentscript.js:39
v @ contentscript.js:45
(anonymous) @ contentscript.js:45
b.write @ contentscript.js:45
m @ contentscript.js:45
(anonymous) @ contentscript.js:21
o.emit @ contentscript.js:21
_ @ contentscript.js:45
w @ contentscript.js:45
v.push @ contentscript.js:45
_write @ contentscript.js:39
v @ contentscript.js:45
(anonymous) @ contentscript.js:45
b.write @ contentscript.js:45
m @ contentscript.js:45
(anonymous) @ contentscript.js:21
o.emit @ contentscript.js:21
_ @ contentscript.js:45
w @ contentscript.js:45
v.push @ contentscript.js:45
_onMessage @ contentscript.js:30
(anonymous) @ contentscript.js:30

my hardhat.config.js file

require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config({ path: ".env" });

const XINFIN_PRIVATE_KEY = process.env.XINFIN_PRIVATE_KEY;

module.exports = {
solidity: "0.8.0",
networks: {
txdc: {
url: "https://erpc.apothem.network",
accounts: [XINFIN_PRIVATE_KEY],
chainId: 51
},
},
};

Discussion (1)

Collapse
mitali_blocksscan profile image
Mitali_BlocksScan

Hello, @shashankgupta10,
Could you confirm if you include the '0x' prefix in your private key?
Additionally, would you be able to upload your code to GitHub and share the repository link?