Coder Social home page Coder Social logo

hello-token's Introduction

Hello Token

This is a simple mock project to develop smartcontracts to deploy to Ethereum network using Truffle framework or Web3.js.

Quick Start

Set environment variables in .env file and type npm test to call a property method for pre-deployed HelloToken smart contract.

Smart Contracts

Contracts written in Solidity will be placed in ./contracts directory. (see truffle-config.js to modify the directory)

  • HelloToken.sol: A simple contract that has public fields(name, nextTokenId) and methods (mint, getData).
  • Migrations.sol: This is provided by Truffle and used for deployment by truffle migrate.

Environment variables

Please refer to .env.sample and create .env to provide secret info such as private keys, Infura ID.

Compile

To compile smart contracts, type truffle compile. Use --all option to recompile everyting if needed.

The compiled output is a json file called Artifacts and saved in ./contracts directory. (Hello.token.json. See truffle-config.js to modify the directory) ABI and bytecode will be saved in the json file.

Deploy

There are two ways to deploy. By A) Truffle or B) Web3.js.

A) Truffle

  1. truffle develop to launch local network. (see truffle-config.js to modify the host 127.0.0.1:9545)

  2. migrate to deploy smartcontracts specified in ./migrations/2_deploy_contracts.js.

B) Web3.js

A sample test file ./test/web3Test.ts is provided. It uses ./src/services/web3/web3.service.ts library.

The web3.service is created to deploy smart contracts, send transactions, and interact with smart contracts.

hello-token's People

Contributors

onion797jp 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.