Closed sfl0r3nz05 closed 3 years ago
Hey, so the following code creates a javascript client only (without the webserver). Perhaps that's the issue?
const provider = ganache.provider({mnemonic: process.env.GANACHE_CLI, network_id: process.env.NETWORK_ID});
If you want to launch via docker you'll need to pass ganache-cli options through the docker container. See: https://github.com/trufflesuite/ganache-cli#docker
Hey @davidmurdoch,
To deploy successfully ganache on docker-compose, I recommend this configuration:
To interact with ganache, i recommend to use websocket to recover events:
const Web3 = require("web3");
const web3 = new Web3(ws://${process.env.HOST_PROVIDER_GANACHE}:${process.env.PORT_PROVIDER_GANACHE}
);
Also it works with http, however, this configuration it is not able to decode events.
Hi, I have deployed a ganache-cli on docker. In addtion, I have deployed the smart contract successfully through truffle migrate, however when I try to access from the application a new instance is generated even though I define correctly the mnemonic and the network id.
Expected Behavior
The expected behavior is that when emitting a transaction, the number of blocks increases, for example to 5.
Current Behavior
In the following images you can see how when the application is launched (via postman) a transaction is executed, but generating the block Number 1, while ganache once the contract is deployed is in block 4.
Node App behavior:
Ganache behavior:
I have passed both: mnemonic and network id (determined when contract was deployed)
const provider = ganache.provider({mnemonic: process.env.GANACHE_CLI, network_id: process.env.NETWORK_ID});
I have also passed smart contract address:
const contract_address = process.env.CONTRACT_TRUST_ANCHOR;
Docker environment is set to true in docker-compose
Network definition in truffle-config.js
Possible Solution
I think it might be a matter of missing some of the options defined for ganache-cli
Your Environment