Giter VIP home page Giter VIP logo

flutter-blockchain's Introduction

Blockchain Logo

This project is meant for those with a basic knowledge of Ethereum and smart contracts, who have some knowledge of the Flutter framework but are new to mobile dapps.

Flutter and Blockchain Logo

Table of Contents

Setting up the development environment

Truffle is the most popular development framework for Ethereum with a mission to make your life a whole lot easier. But before we install truffle make sure to install node .

Once we have node installed, we only need one command to install Truffle: npm install -g truffle

We will also be using Ganache, a personal blockchain for Ethereum development you can use to deploy smart contracts, develop applications, and run tests. You can download Ganache by navigating to http://truffleframework.com/ganache and clicking the “Download” button.

Directory Structure

Directory Structure
  • contracts/ : Contains solidity contract file.
  • migrations/ : Contains migration script files (Truffle uses a migration system to handle contract deployment).
  • test/ : Contains test script files.
  • truffle-config.js : Contains truffle deployment configurations information.

Compiling and Migrating Smart Contract

Compilation

In the terminal, make sure you are in the root of the directory that contains the flutter and truffle project, Run the following command: truffle compile

You should see output similar to the following:

Truffle Compile

Migration

Before we can migrate our contract to the blockchain, we need to have a blockchain running. We’re going to use Ganache, a personal blockchain for Ethereum development you can use to deploy contracts, develop applications, and run tests. If you haven’t already, download Ganache and double-click the icon to launch the application. This will generate a blockchain running locally on port 7545.

Ganache
  • Migrating the contract to the blockchain, run: truffle migrate

You should see output similar to the following:

Ganache
  • Take a look into the Ganache, the first account originally had 100 ether, it is now lower, due to the transaction costs of migration.

Testing the Smart Contract

  • Running the test as: truffle test
  • If all the test pass, you’ll see the console output similar to this:
truffle test

Contract Linking

📁 project(eg. helloworld,bidder,...)
    📁 lib
        🎯 contract_linking.dart
          - Update _rpcUrl, _wsUrl, _privateKey as per your needs.
  • You can get the RPC URL from the ganache :
truffle test
  • Get the Private Key from ganache:
truffle test
  • After Contract Linking, Just run the Flutter Project.

DAPPS

Hello World Dapp Population Dapp
Bidder Minter
Cat Adoption Election

Tutorials

Contributing:

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request.

Show some ❤ and star the repo to support the project

flutter-blockchain's People

Contributors

aniketambore avatar

Watchers

 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.