menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Truffle Suite

Sweet tools for smart contracts

Channels
Team

contract distribution problem on ganache

September 17, 2020 at 1:42pm

contract distribution problem on ganache

September 17, 2020 at 1:42pm
Hello everyone! I recently used the truffle suite for programming a dapp for my thesis. I have a problem with distributing the contract on ganache, that is, I can only distribute the contract to the first ganache account, the one with zero index and if I try to use the parameter "from" inside the truffle-config.js file I can only enter a specific account while I would like to distribute the contract on all accounts. How can I distribute the agreement to the all available accounts?

September 17, 2020 at 2:23pm
Hey (nala23), what do you mean "distribute the contract to the first ganache account" and "I would like to distribute the contract on all accounts"? Can you provide a little more detail? If you send transactions you can only have one "from" address that initiates the transaction.
Thank you for your answer (eggplantzzz). in the file truffle-config.js when I set the variables for network without the from attribute, truffle implements the contract only on the first account that is the one with zero index while putting from: "address" the contract is distributed on that specific address while I would like that every user on the network has the same copy of the smart contract. in my thesis I have to represent the trust triangle and to do this I need at least three accounts to access the same smart contract, but at this point I wonder if it is possible...

September 18, 2020 at 3:54pm
I don't exactly know what it means when you say "truffle implements the contract only on the first account". When you set from, you are setting the address from which transactions are created.
Once a contract is deployed, you can interact with it from ANY account that you send a transaction from. And I'm also not sure what you mean by "every user on the network has the same copy of the smart contract". Once the contract is deployed, it exists on the network as its own entity and can be interacted with. Accounts do not "have a copy of the contract" in any sense.
Are you saying you don't know how to interact with your contract from other accounts?