---
# System prepended metadata

title: 智能合約solidity開發進階實戰教學文件
tags: [區塊鏈, Dapp]

---

# 智能合約solidity開發進階實戰教學文件


[TOC]

###### tags: `Dapp` `區塊鏈`

[區塊鏈大雜燴](https://easonwang.gitbook.io/blockchain/hyperledger-fabric)
[hd wallet](https://www.chainnews.com/zh-hant/articles/928898827430.htm)


---


# truffle
----

## 安裝指令

* yarn install truffle
* npm install -g truffle
* truffle init--->
==ex:產生 ./contracts/1_initial_migration.js.  ./contracts/2_crypto_zombies.js==
* npm install truffle-hdwallet-provider
* truffle compile---> compile ABI (compile smart contracts' byte code)--->產生build artifacts 存在./build 目錄內

* 程式碼驗證--->
 ```solidity=
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {//contract 名稱為migrations.sol 可更改
  deployer.deploy(Migrations);
};

```
truffle-config.js
* 設定好smart contract 要 migrate 的 network(testnet/mainnet(poa)--->mainnet又可以分tokenaddress mainnet/mianet--->多種各自==rpc不同==的mainnet)

# 補充文件
* [如何避免在程式中引入私鑰](https://medium.com/@rogerwutw?p=d5cdcd3281c6)