ethers-simple-storage-fcc
ethers-simple-storage-fcc copied to clipboard
ganache UI doesn't show transactions
I'm having an issue with the ganache UI. I'm fairly certain that my transactions are going through since the nonce of the wallet keeps going up (I think I'm at 3 or 4 now). However, when I view the Transactions tab on Ganache's UI, it shows nothing.
No error messages in the console either.
Any ideas for how I can display the transactions on the Ganache UI?
const ethers = require("ethers");
const fs = require("fs");
async function main() {
// create the provider
const provider = new ethers.providers.JsonRpcProvider(
"http://172.18.192.1:7545"
);
// note: never put your private key in the code editor!
const wallet = new ethers.Wallet(
"privatewalletstuff",
provider
);
// to deploy: ABI + bin
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const bin = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8");
const nonce = await wallet.getTransactionCount();
const tx = {
nonce: nonce,
gasPrice: 20000000000,
gasLimit: 1000000,
to: null,
value: 0,
data: "0x...... bunch of data",
chainId: 1337,
};
// Signing the tx
// const signedTxResponse = await wallet.signTransaction(tx);
// console.log(signedTxResponse);
const sentTxResponse = await wallet.sendTransaction(tx);
await sentTxResponse.wait(1);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Ganache wallet
Ganache UI
My console after deploying the contract shows that the transaction went through
Contract Address: 0x55e505d8e6489B5189C00f420A87df82Dfff240A
Current favorite number: 0
{
to: '0x55e505d8e6489B5189C00f420A87df82Dfff240A',
from: '0x0659D4134ed0E0A8A4BB5637Bb9e42Ca0C212843',
contractAddress: null,
transactionIndex: 7,
gasUsed: BigNumber { _hex: '0xaacc', _isBigNumber: true },
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
blockHash: '0x12cf19c6b49ee678a97ab191ee63b819261a8fffc7d36bf36efc64d2968d7359',
transactionHash: '0x0b541c9e9c318d167dcc1cce9e553c46b873fd33e92e68a5ea96bde2aadb9020',
logs: [],
blockNumber: 8106356,
confirmations: 1,
cumulativeGasUsed: BigNumber { _hex: '0x59563d', _isBigNumber: true },
effectiveGasPrice: BigNumber { _hex: '0x59682f70', _isBigNumber: true },
status: 1,
type: 2,
byzantium: true,
events: []
}
Updated Favorite Number: 7
I'm confused on what actually happened because:
-
The etherscan shows the contract was created https://goerli.etherscan.io/address/0x55e505d8e6489B5189C00f420A87df82Dfff240A
-
BUT the Ganache UI shows no funds being depleted from the test wallet used. So I'm guessing there must be some issue with the Ganache UI.