DOkwufulueze / eth-vue

Featured in Awesome Vue [https://github.com/vuejs/awesome-vue], a curated list maintained by vuejs of awesome things related to the Vue.js framework, and Awesome List [https://awesomelists.net/150-Vue.js/3863-Open+Source/18749-DOkwufulueze-eth-vue], this Truffle Box provides everything you need to quickly build Ethereum dApps that have authentication features with vue, including configuration for easy deployment to the Ropsten Network. It's also Gravatar-enabled. Connecting to a running Ganache blockchain network from Truffle is also possible -- for fast development and testing purposes. Built on Truffle 5 and Vue 3, eth-vue uses vuex for state management, vuex-persist for local storage of app state, and vue-router for routing. Authentication functionalities are handled by Smart Contracts running on the Ethereum blockchain.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is an "unlocked account" in truffle.js?

davepuchyr opened this issue · comments

Hi, Daniel,

Thanks for sharing this comprehensive dApp.

In truffle.js, the "from" property in the development stanza is blank and needs to have an "unlocked account":

...
development: {
      host: "localhost",
      port: 9545, // This is the conventional port. If you're using the Ganache Blockchain, change port value to the Ganache default port 7545. If you're using Truffle develop network, change port value to 9545
      network_id: "*", // Match any network id. You may need to replace * with your network Id
      from: "", // Add your unlocked account within the double quotes
      gas: 4444444
    }
...

What is an "unlocked account"? Where do I find it? If I'm running against ganache, it it just one of the available accounts?

PS Congratulations on your new born!

Hi, @davepuchyr

Thanks for appreciating eth-vue. An "unlocked account" is an account that can engage in all sorts of transactions from within Truffle. The account can be used to deploy Smart Contracts, make calls to Smart Contracts including payable calls, etc. In geth, you have to unlock an account using a command I've shared below. But in Ganache, the accounts all come unlocked, so any available account works.

Since you'll be compiling and migrating [deploying] all eth-vue Smart Contracts, you need an account that has the capability to do such. In geth, for example, all accounts are locked when you start your local blockchain, so you must unlock the accounts [say 5 accounts, for instance] using something like:
geth --networkid '666' --datadir '/path/to/your/blockchain/db' --rpc --rpccorsdomain 'localhost:8545' --unlock '0, 1, 2, 3, 4' --password '/path/to/your/blockchain/passwords' --mine
Since the five accounts are now unlocked, any of them can be used for the from key.
Hope this helps clarify things.

NOTE: You don't necessarily have to unlock multiple accounts, one is fine, just ensure you have at least one unlocked account so you can deploy your Smart Contracts with it. You may need to unlock other accounts so they too can be used to send transaction calls when you're testing the dApp.

PS: Thanks for your congratulatory remark on the arrival of my little pricess.

Thanks a lot for the quick and detailed answer!