Giter Club home page Giter Club logo

mintabletokencrowdsale's Introduction

How to deploy smart contracts to Ganache

  1. start Ganache
  2. start truffle console in the project root folder, by default, it will connect to the development network
  3. using bellow statement in Truffle console to send money from default Ganache account to an account in Metamask web3.eth.sendTransaction({ from: accounts[0], to: "metamask account address", value: web3.utils.toWei("10", "ether") })
  4. exit current Truffle console: .exit
  5. deploy contracts to ganache network using first Metamask account truffle deploy --network ganache --reset

How to config network

At the moment, there are two networks, the default network is development and another network is ganache. ganache network using HDWalletProvider to sign transactions with an account in Metamask

Explanation for step 3, why I have to send ether from Ganache account to Metamask account

By default, Truffle will sign transactions with default accounts Ganache, but it's not convenient. I want to use an account in Metamask to do so. But my Metamask account has 0 ether in the ganache network. So, first of all, I have to connect to the development network and send some ether to my Metamask account. Then, I can use the Metamask account to deploy smart contracts, to send transactions.

Metamask, Ganache, and HDWalletProvider

If you type ganache console in the project root folder, and then type accounts. A list of 10 account addresses will show up and it is the same with 10 accounts you see in Ganache UI. However, type ganache console --network ganache, then type accounts. You will see the account addresses are printed out are your Metamask account address.

Config file

You can see configuations of networks in truffle-config.js

mintabletokencrowdsale's People

Contributors

khanh1998 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.