Andrew-gogo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Andrew的第一週作業 *** 1. 請簡單描述錢包助記詞,私鑰,公鑰之間的關係 錢包助記詞是由私鑰創建,最早是使用BIP39轉換,是為了讓使用者更好的記住,而私鑰是一個隨機數字,這個隨機數字介於1~n-1(n=1.15810^77),用16進制顯示為64位數,然後私鑰再通過ECDSA方法生成公鑰,最後再取公鑰Keccak-256雜湊結果的最右邊40位元,前面加上0x生成地址。 2. 用 Remix 部署智能合約(Local London) ![](https://i.imgur.com/0b8oTui.png) 3. Solidity TodoList 延伸 * 將寫好的合約部署到 Görli / Goerli 測試鏈上,並 verify 開源程式碼 https://goerli.etherscan.io/address/0x32e82aedc287d40d8fe20f9a7f02d40f4a8d481d#code * 請貼上合約地址 0x32E82AEDC287D40D8fe20f9A7F02d40F4a8d481d * Todo List 增加 Pending 功能 提示:多新增一個 Pending 狀態,string[] public pending; * 撰寫此功能測試 * 增加清空 Completed 功能 * 增加 Pending 最多滯留 n 秒(當 TODO 搬移到 PENDING 後,要記錄時間,當時間超過 n 秒,就不可以再搬回 TODO) Array Mapping Struct (懷恩💜熱情推薦) --- ```// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; contract TodoList { string[] public todos; string[] public todoCompleted; //延遲項目的屬性 struct pendingitems{ string itemname; uint pendingtime; // uint pendinghowlong; } //延遲項目 mapping(uint=>pendingitems) public pendings; uint count = 0; //延遲項目編號 uint public howlong; //延遲項目的延遲時間 constructor() { } // 永久儲存是storage,短暫使用就用memory,calldata傳入後只能參考不能改變的data type function addTodo(string memory todo) public { todos.push(todo); } //設定完成項目 function setCompleted(uint256 index) external { string memory completedTodo = todos[index]; for (uint256 i = index; i < todos.length - 1; i++){ todos[i] = todos[i + 1]; } delete todos[todos.length - 1]; todos.pop(); todoCompleted.push(completedTodo); } //設定延遲項目 function setpending (uint256 whichone) external { string memory pendingitem = todos[whichone]; for (uint256 i = whichone; i < todos.length - 1; i++){ todos[i] = todos[i + 1]; } delete todos[todos.length - 1]; todos.pop(); pendings[count] = pendingitems(pendingitem, block.timestamp); count++; } //轉移延遲項目,看是否超過指定時間,可否回到Todolist function Moveoutpendingitem (uint256 whichone) public { howlong = block.timestamp - pendings[whichone].pendingtime; require(howlong < 3600 , "This item has been pending for more than 1 hours and can't be moved."); // if(howlong < 20){ // todos.push(pendings[whichone].itemname); // } // else{ // return "This item has been pending for more than 3 hours and can't be executed. This item has been deleted."; // } } //刪除延遲項目 function deletepending (uint256 whichone) external { delete pendings[whichone]; for (uint256 i = whichone ; i < count - 1 ; i++){ pendings[i] = pendings[i + 1]; } delete pendings[count - 1]; } //計算延遲時間 function countpendinghowlong(uint256 whichone) public { howlong = block.timestamp - pendings[whichone].pendingtime; } //清除全部資料 function Complete() public { delete todos; delete todoCompleted; //delete pendings; } function getTodo(uint256 index) external view returns (string memory) { return todos[index]; } function deleteTodo(uint256 index) external { delete todos[index]; } function getCompleted(uint256 index) external view returns (string memory) { return todoCompleted[index]; } function getAllTodo() external view returns (string[] memory) { return todos; } function getAllCompleted() external view returns (string[] memory) { return todoCompleted; } // function getAllpendings() external view returns (string[] memory) { // return pendings; // } } ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully