# 2021/11/22-2021/11/26 shawn_intern_diary [TOC] ###### tags: `實習日誌` `thundercore` --- ## 2021.11.23(二) 10:00-19:00 * Goal :a: * 改動 tt20 deploy 的 code + hackmd content ![](https://i.imgur.com/eJ0cTMP.png =x300) * Deploy a Dapp (deplot truffle + content重頭修訂) ![](https://i.imgur.com/FHeAIer.png =x300) * Today Finished :100: * hardhat config檔 在gitbook上修改完成 ![](https://i.imgur.com/8jXmaaQ.png =x350) * 改動 tt20 deploy 的 code + hackmd content ![](https://i.imgur.com/eJ0cTMP.png =x300) * Deploy a Dapp (deploy truffle + content重頭修訂) ![](https://i.imgur.com/FHeAIer.png =x300) ---- ## 2021.11.25(四)15:00-19:00 * Goal :a: * gitbook 上 ==remix內文== 的 smart contract 從 erc20 換成自己寫的 hellothundercore.sol * deploy * [screenshots](https://hackmd.io/4yfC-ecXQOmP03eBUHAhSQ) * 把 步驟流程 寫在gitbook content裡面 **未publish沒有公開網址** * gitbook 上 ==truffle內文== 的 smart contract 從 erc20 換成自己寫的 hellothundercore.sol * deploy * screenshots * 把 步驟流程 寫在gitbook content裡面 **未publish沒有公開網址** ![](https://i.imgur.com/nCRaTUL.png) * Today Finished :100: * gitbook 上 ==remix內文== 的 smart contract 從 erc20 換成自己寫的 hellothundercore.sol * deploy * [screenshots](https://hackmd.io/4yfC-ecXQOmP03eBUHAhSQ) * 把 步驟流程 寫在gitbook content裡面 **未publish沒有公開網址** * gitbook 上 ==truffle內文== 的 smart contract 從 erc20 換成自己寫的 hellothundercore.sol * deploy * screenshots * 把 步驟流程 寫在gitbook content裡面**未publish沒有公開網址** ---- ## 2021.11.26(五)15:00-19:00 * Goal :a: * gitbook 上 將 兩個repo 解 conflict 再做 git merge * Today Finished :100: * 和 kevin claire cowork 看要怎麼處理 * devops team建議我在developer guide這個repo另開一個branch 把我個人的gitbook內容以md檔 clone下來 以後再跟claire目前在 developer guide上master branch上最新merge的版本(也就是3hr前那版本)在我自己private repo做merge,比較完改成內容相同再push上去在developer guide repo 上我自己新開的branch上,這樣clarie就可以從github上找到我的branch, * 另外gitbook上要換branch,但我不確定我們有沒有這個權限(沒有的話可以請devops team開) * 之後和claire cowork * 提醒claire若要更動發一個change request---->這樣對方才會知道我們要merge branch * To be developing :+1: * gitbook 繼續解 conflict * 回家摸熟git book ---- ## references ### compile hellothundercore.sol by remix #### smart contract ---- ```solidity hellothundercore.sol // Specifies that the source code is for a version // of Solidity greater than 0.5.10 pragma solidity ^0.5.10; // A contract is a collection of functions and data (its state) // that resides at a specific address on the Ethereum blockchain. contract hellothundercore { // The keyword "public" makes variables accessible from outside a contract // and creates a function that other contracts or SDKs can call to access the value string public message; // A special function only run during the creation of the contract constructor(string memory initMessage) public { // Takes a string value and stores the value in the memory data storage area, // setting `message` to that value message = initMessage; } // A publicly accessible function that takes a string as a parameter // and updates `message` function update(string memory newMessage) public { message = newMessage; } } ``` ``` javascript= const HDWalletProvider = require('@truffle/hdwallet-provider'); const fs = require('fs'); let privateKeys; try { privateKeys = fs.readFileSync('.private-keys', {encoding: 'ascii'}).split('\n').filter(x => x.length > 0); } catch (err) { if (err.code === 'ENOENT') { privateKeys = null; } else { throw err; } } module.exports = { plugins: [ "truffle-plugin-save-per-network-deployment-record" ], /** * Networks define how you connect to your ethereum client and let you set the * defaults web3 uses to send transactions. If you don't specify one truffle * will spin up a development blockchain for you on port 9545 when you * run `develop` or `test`. You can ask a truffle command to use a specific * network from the command line, e.g * * $ truffle test --network <network-name> */ networks: { 'development': { host: "127.0.0.1", port: 9545, network_id: "5777", }, 'thunder-testnet': { network_id: 18, gasPrice: 20 * 1e9, // 20 gwei, default 100 gwei provider: () => { if (privateKeys === null) { throw (new Error('Create a .private-keys file')) } return new HDWalletProvider(privateKeys, 'https://testnet-rpc.thundercore.com', 0 /*address_index*/, privateKeys.length/*num_addresses*/); }, }, 'thunder-mainnet': { network_id: 108, provider: () => { if (privateKeys === null) { throw (new Error('Create a .private-keys file')) } return new HDWalletProvider(privateKeys, 'https://mainnet-rpc.thundercore.com', 0 /*address_index*/, privateKeys.length/*num_addresses*/); }, }, // Useful for testing. The `development` name is special - truffle uses it by default // if it's defined here and no other network is specified at the command line. // You should run a client (like ganache-cli, geth or parity) in a separate terminal // tab if you use this network and you must also set the `host`, `port` and `network_id` // options below to some value. // // development: { // host: "127.0.0.1", // Localhost (default: none) // port: 8545, // Standard Ethereum port (default: none) // network_id: "*", // Any network (default: none) // }, // Another network with more advanced options... // advanced: { // port: 8777, // Custom port // network_id: 1342, // Custom network // gas: 8500000, // Gas sent with each transaction (default: ~6700000) // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) // from: <address>, // Account to send txs from (default: accounts[0]) // websockets: true // Enable EventEmitter interface for web3 (default: false) // }, // Useful for deploying to a public network. // NB: It's important to wrap the provider as a function. // ropsten: { // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), // network_id: 3, // Ropsten's id // gas: 5500000, // Ropsten has a lower block limit than mainnet // confirmations: 2, // # of confs to wait between deployments. (default: 0) // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) // }, // Useful for private networks // private: { // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), // network_id: 2111, // This network is yours, in the cloud. // production: true // Treats this network as if it was a public net. (default: false) // } }, // Set default mocha options here, use special reporters etc. mocha: { // timeout: 100000 }, // Configure your compilers compilers: { solc: { version: "0.4.25", // Fetch exact version from solc-bin (default: truffle's version) docker: false, // Use "0.5.1" you've installed locally with docker (default: false) settings: { // See the solidity docs for advice about optimization and evmVersion optimizer: { enabled: true, runs: 200 }, evmVersion: "byzantium" } } } } ```