While running my deploy.js file code am getting error #6196
taruntailor7
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is my code
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
// compile them in our code
// compile them separately
// http://127.0.0.1:7545
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
const wallet = new ethers.Wallet(
"0x59234cf02296eab141a699263f354e6e58e4097fbb98b6fb9b95032df8ddfe65",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying, please wait...");
const gasLimit = 2000000;
const contract = await contractFactory.deploy({gasLimit}); // STOP here! Wait for the contract to be deployed
// console.log(contract, "Contract");
const deploymentReceipt = await contract.deployTransaction.wait(1);
console.log(
Contract deployed to ${contract.address}
);}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error, "Error");
process.exit(1);
});
and am getting this error :
Error: could not coalesce error (error={ "code": -32000, "data": { "name": "Error", "stack": "Error: sender doesn't have enough funds to send tx. The upfront cost is: 40000000000000000 and the sender's account only has: 0\n at t. (/Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2008456)\n at /Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2007756\n at Object.next (/Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2007861)\n at c (/Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2006575)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)" }, "message": "sender doesn't have enough funds to send tx. The upfront cost is: 40000000000000000 and the sender's account only has: 0" }, payload={ "id": 9, "jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": [ "0xf90a9a808504a817c800831e84808080b90a4560806040526040518060400160405280600781526020016040518060400160405280600581526020017f546172756e000000000000000000000000000000000000000000000000000000815250815250600260008201518160000155602082015181600101908051906020019061007792919061008c565b50505034801561008657600080fd5b50610190565b8280546100989061012f565b90600052602060002090601f0160209004810192826100ba5760008555610101565b82601f106100d357805160ff1916838001178555610101565b82800160010185558215610101579182015b828111156101005782518255916020019190600101906100e5565b5b50905061010e9190610112565b5090565b5b8082111561012b576000816000905550600101610113565b5090565b6000600282049050600182168061014757607f821691505b6020821081141561015b5761015a610161565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6108a68061019f6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80636f760f411161005b5780636f760f411461010357806377ec2b551461011f5780639e7a13ad1461013e578063b2ac62ef1461016f57610088565b80632e64cec11461008d57806343ede4ae146100ab5780634f2be91f146100c957806369404ebd146100e7575b600080fd5b61009561019f565b6040516100a2919061065f565b60405180910390f35b6100b36101a8565b6040516100c0919061065f565b60405180910390f35b6100d16101ae565b6040516100de919061065f565b60405180910390f35b61010160048036038101906100fc91906105a2565b6101b7565b005b61011d60048036038101906101189190610546565b6101c1565b005b610127610251565b60405161013592919061067a565b60405180910390f35b610158600480360381019061015391906105a2565b6102eb565b60405161016692919061067a565b60405180910390f35b610189600480360381019061018491906104fd565b6103a7565b604051610196919061065f565b60405180910390f35b60008054905090565b60005481565b60006002905090565b8060008190555050565b600460405180604001604052808381526020018481525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010190805190602001906102279291906103d5565b5050508060018360405161023b9190610648565b9081526020016040518091039020819055505050565b600280600001549080600101805461026890610773565b80601f016020809104026020016040519081016040528092919081815260200182805461029490610773565b80156102e15780601f106102b6576101008083540402835291602001916102e1565b820191906000526020600020905b8154815290600101906020018083116102c457829003601f168201915b5050505050905082565b600481815481106102fb57600080fd5b906000526020600020906002020160009150905080600001549080600101805461032490610773565b80601f016020809104026020016040519081016040528092919081815260200182805461035090610773565b801561039d5780601f106103725761010080835404028352916020019161039d565b820191906000526020600020905b81548152906001019060200180831161038057829003601f168201915b5050505050905082565b6001818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b8280546103e190610773565b90600052602060002090601f016020900481019282610403576000855561044a565b82601f1061041c57805160ff191683800117855561044a565b8280016001018555821561044a579182015b8281111561044957825182559160200191906001019061042e565b5b509050610457919061045b565b5090565b5b8082111561047457600081600090555060010161045c565b5090565b600061048b610486846106cf565b6106aa565b9050828152602081018484840111156104a7576104a6610839565b5b6104b2848285610731565b509392505050565b600082601f8301126104cf576104ce610834565b5b81356104df848260208601610478565b91505092915050565b6000813590506104f781610859565b92915050565b60006020828403121561051357610512610843565b5b600082013567ffffffffffffffff8111156105315761053061083e565b5b61053d848285016104ba565b91505092915050565b6000806040838503121561055d5761055c610843565b5b600083013567ffffffffffffffff81111561057b5761057a61083e565b5b610587858286016104ba565b9250506020610598858286016104e8565b9150509250929050565b6000602082840312156105b8576105b7610843565b5b60006105c6848285016104e8565b91505092915050565b60006105da82610700565b6105e4818561070b565b93506105f4818560208601610740565b6105fd81610848565b840191505092915050565b600061061382610700565b61061d818561071c565b935061062d818560208601610740565b80840191505092915050565b61064281610727565b82525050565b60006106548284610608565b915081905092915050565b60006020820190506106746000830184610639565b92915050565b600060408201905061068f6000830185610639565b81810360208301526106a181846105cf565b90509392505050565b60006106b46106c5565b90506106c082826107a5565b919050565b6000604051905090565b600067ffffffffffffffff8211156106ea576106e9610805565b5b6106f382610848565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561075e578082015181840152602081019050610743565b8381111561076d576000848401525b50505050565b6000600282049050600182168061078b57607f821691505b6020821081141561079f5761079e6107d6565b5b50919050565b6107ae82610848565b810181811067ffffffffffffffff821117156107cd576107cc610805565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61086281610727565b811461086d57600080fd5b5056fea264697066735822122072abd8b5bab2fdbb5e29c852d9fc96a56ac5b71f08b9cd301510d73ee5cb213e64736f6c63430008070033820a95a03cddd60bc1f0713d44b33387b049a191663829436a9de2f06066dcd6de77c0fea05a7105249cd5a89f07dea6ba9694b5b417a79ab2fcb414de6406e1c751a3f7f0" ] }, code=UNKNOWN_ERROR, version=6.7.1)
at makeError (/Users/taruntailor/Desktop/Study/Hardhat/ether-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
at JsonRpcProvider.getRpcError (/Users/taruntailor/Desktop/Study/Hardhat/ether-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:653:41)
at /Users/taruntailor/Desktop/Study/Hardhat/ether-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:268:45
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'UNKNOWN_ERROR',
error: {
message: "sender doesn't have enough funds to send tx. The upfront cost is: 40000000000000000 and the sender's account only has: 0",
code: -32000,
data: {
stack: "Error: sender doesn't have enough funds to send tx. The upfront cost is: 40000000000000000 and the sender's account only has: 0\n" +
' at t. (/Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2008456)\n' +
' at /Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2007756\n' +
' at Object.next (/Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2007861)\n' +
' at c (/Users/taruntailor/.nvm/versions/node/v20.5.1/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:55:2006575)\n' +
' at processTicksAndRejections (node:internal/process/task_queues:95:5)',
name: 'Error'
}
},
payload: {
method: 'eth_sendRawTransaction',
params: [
'0xf90a9a808504a817c800831e84808080b90a4560806040526040518060400160405280600781526020016040518060400160405280600581526020017f546172756e000000000000000000000000000000000000000000000000000000815250815250600260008201518160000155602082015181600101908051906020019061007792919061008c565b50505034801561008657600080fd5b50610190565b8280546100989061012f565b90600052602060002090601f0160209004810192826100ba5760008555610101565b82601f106100d357805160ff1916838001178555610101565b82800160010185558215610101579182015b828111156101005782518255916020019190600101906100e5565b5b50905061010e9190610112565b5090565b5b8082111561012b576000816000905550600101610113565b5090565b6000600282049050600182168061014757607f821691505b6020821081141561015b5761015a610161565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6108a68061019f6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80636f760f411161005b5780636f760f411461010357806377ec2b551461011f5780639e7a13ad1461013e578063b2ac62ef1461016f57610088565b80632e64cec11461008d57806343ede4ae146100ab5780634f2be91f146100c957806369404ebd146100e7575b600080fd5b61009561019f565b6040516100a2919061065f565b60405180910390f35b6100b36101a8565b6040516100c0919061065f565b60405180910390f35b6100d16101ae565b6040516100de919061065f565b60405180910390f35b61010160048036038101906100fc91906105a2565b6101b7565b005b61011d60048036038101906101189190610546565b6101c1565b005b610127610251565b60405161013592919061067a565b60405180910390f35b610158600480360381019061015391906105a2565b6102eb565b60405161016692919061067a565b60405180910390f35b610189600480360381019061018491906104fd565b6103a7565b604051610196919061065f565b60405180910390f35b60008054905090565b60005481565b60006002905090565b8060008190555050565b600460405180604001604052808381526020018481525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010190805190602001906102279291906103d5565b5050508060018360405161023b9190610648565b9081526020016040518091039020819055505050565b600280600001549080600101805461026890610773565b80601f016020809104026020016040519081016040528092919081815260200182805461029490610773565b80156102e15780601f106102b6576101008083540402835291602001916102e1565b820191906000526020600020905b8154815290600101906020018083116102c457829003601f168201915b5050505050905082565b600481815481106102fb57600080fd5b906000526020600020906002020160009150905080600001549080600101805461032490610773565b80601f016020809104026020016040519081016040528092919081815260200182805461035090610773565b801561039d5780601f106103725761010080835404028352916020019161039d565b820191906000526020600020905b81548152906001019060200180831161038057829003601f168201915b5050505050905082565b6001818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b8280546103e190610773565b90600052602060002090601f016020900481019282610403576000855561044a565b82601f1061041c57805160ff191683800117855561044a565b8280016001018555821561044a579182015b8281111561044957825182559160200191906001019061042e565b5b509050610457919061045b565b5090565b5b8082111561047457600081600090555060010161045c565b5090565b600061048b610486846106cf565b6106aa565b9050828152602081018484840111156104a7576104a6610839565b5b6104b2848285610731565b509392505050565b600082601f8301126104cf576104ce610834565b5b81356104df848260208601610478565b91505092915050565b6000813590506104f781610859565b92915050565b60006020828403121561051357610512610843565b5b600082013567ffffffffffffffff8111156105315761053061083e565b5b61053d848285016104ba565b91505092915050565b6000806040838503121561055d5761055c610843565b5b600083013567ffffffffffffffff81111561057b5761057a61083e565b5b610587858286016104ba565b9250506020610598858286016104e8565b9150509250929050565b6000602082840312156105b8576105b7610843565b5b60006105c6848285016104e8565b91505092915050565b60006105da82610700565b6105e4818561070b565b93506105f4818560208601610740565b6105fd81610848565b840191505092915050565b600061061382610700565b61061d818561071c565b935061062d818560208601610740565b80840191505092915050565b61064281610727565b82525050565b60006106548284610608565b915081905092915050565b60006020820190506106746000830184610639565b92915050565b600060408201905061068f6000830185610639565b81810360208301526106a181846105cf565b90509392505050565b60006106b46106c5565b90506106c082826107a5565b919050565b6000604051905090565b600067ffffffffffffffff8211156106ea576106e9610805565b5b6106f382610848565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b8381101561075e578082015181840152602081019050610743565b8381111561076d576000848401525b50505050565b6000600282049050600182168061078b57607f821691505b6020821081141561079f5761079e6107d6565b5b50919050565b6107ae82610848565b810181811067ffffffffffffffff821117156107cd576107cc610805565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61086281610727565b811461086d57600080fd5b5056fea264697066735822122072abd8b5bab2fdbb5e29c852d9fc96a56ac5b71f08b9cd301510d73ee5cb213e64736f6c63430008070033820a95a03cddd60bc1f0713d44b33387b049a191663829436a9de2f06066dcd6de77c0fea05a7105249cd5a89f07dea6ba9694b5b417a79ab2fcb414de6406e1c751a3f7f0'
],
id: 9,
jsonrpc: '2.0'
}
}
how can i resolve this ?
Beta Was this translation helpful? Give feedback.
All reactions