Closed scripnichenko closed 3 months ago
Hello @scripnichenko This problem seems to be related to a wrong private key being passed to the forge create command.
Could you try printing $PRIVATE_KEY
to the console to see if the variable is set up correctly?
If not, you could repeat the command by manually replacing the $PRIVATE_KEY
with your account's private key, for example: forge create --rpc-url linea-testnet src/DutchAuction.sol:DutchAuction --private-key afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140
@MatheusDaros getting the same error when keeping the secret key inline. Sharing the entire command with valid creds (will remove the API key in 3 days):
forge create --rpc-url https://linea-sepolia.infura.io/v3/61ce278a3d124bafa6afbbe0946f4a78 \
--private-key hJ13h6CJXRi/5TFOrFEq42iYyxGcz8hskmdOkDWZ6RKteGM3gdb6oQ \
src/DutchAuction.sol:DutchAuction
I see the problem.
The parameter should be a valid private key
and not the API Key/Secret.
You can export the private key
from your wallet (for example, Metamask) to use there.
Beware that if you share this key, anyone would be able to transact your assets, so make sure to keep it safe.
To be extra careful, I'd advise creating a new wallet specifically for development, so you don't risk to lose assets.
Thanks, @MatheusDaros, for your valuable suggestions; it was not quite clear from the docs! So, I was able to deploy a contract when I updated the private key based on my MetaMask wallet doc.
forge create --rpc-url linea-testnet \
--private-key ${PRIVATE_KEY} \
src/DutchAuction.sol:DutchAuction \
--constructor-args 10000000 8 0xED0Ff7E8B655dFFfCA471ea3B6B649ce7C5C3b83 33434
[ā ] Compiling...
No files changed, compilation skipped
Deployer: 0xD9E5053ae9de9ca409Ef1bA2241A92b56Ca9F1f3
Deployed to: 0x7A8f628F63461972602E020034E73Ca982E1d9e0
Transaction hash: 0x6836c751be665ecc49b1f81130e998fd362bda0b183b3e558cb2e13a67dd6eda
ššš The contract is available in sepolia.lineascan.build
: https://sepolia.lineascan.build/address/0x7A8f628F63461972602E020034E73Ca982E1d9e0
Scenario
GIVEN
DutchAuction.sol
smart contract AND Infura API Key (copied from created API Key , example61ce278a3d124rtfa6afbbe0946f4a78
) AND Infura Private Key (copied from API Key settings, examplehJ13h6CJXRi/5TFOrFEq42iYyxGcz09klmdOkDWZ6RKteGM3gdb6oQ
) WHEN deploying a contract with commandforge create --rpc-url linea-testnet src/DutchAuction.sol:DutchAuction --private-key $PRIVATE_KEY
THEN gettingError: Failed to decode private key
Set-up
foundry.toml
ENV