Peter Tyonum
    • 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
    # SETTING UP BTCD FOR A DEVELOPMENT ENVIRONMENT Bitcoin is made up of computing devices connected with each other on a peer-to-peer (P2P) network running the Bitcoin software. These computing devices participating in the network are called nodes. A Bitcoin node has a blockchain database, a routing mechanism to receive and propagate transactions and blocks, a mining function to validate and create new bitcoin, and a wallet to manage user keys. A node can have all (full node) of these features or selected features according to the needs of the user. The first and most popular full-node client implementation is the Bitcoin core. It is the original client that was released by Satoshi Nakamoto. It is open-source and actively maintained by the Bitcoin community. Installable binaries exist on [bitcoin.org](bitcoin.org) for any platform of choice. Another well-known client implementation is the BTCD by Conformal Systems. It is also an open-source project that has already been used in production as far back as 2014 and is actively maintained. Btcd implements most of the core functionalities of a node except wallet and chain functionality. The team has instead unbundled the wallet functionality into a separate wallet application called btcwallet. `btcd` client also has minor differences from `bitcoind` such as enabling TLS for RPC connections by default and accepting both HTTP requests and Websockets. You can read their blog post [here](https://blog.conformal.com/btcd-not-your-moms-bitcoin-daemon/) about why they were separated. `btcWallet` is a hierarchical deterministic (HD) bitcoin wallet client for a single user. It acts as both an RPC client to `btcd` and an RPC server for wallet clients and legacy RPC applications. It uses an HD path for address derivation (`BIP0044`) and encrypts both private keys and public data. You can read more about the wallet on their official repository [here](https://github.com/btcsuite/btcwallet). Having been using Bitcoin core for some time, I wanted to see how well I can work with `btcd` client. So the first thing is to compile `btcd` from the source. The following sections document how I was able to set up the `btcd` node. COMPILING BTCD One prominent thing I have noticed while compiling BTCD is that a lot of details are abstracted. I was wondering where to place the configuration file, what is the command line tool, ports for RPC calls, etc. I will attempt to answer these questions in this article. `btcd` is said to provide a compatible RPC interface with Bitcoin core, I am assuming that most features provided in `bitcoind` aside wallet and chain are found in `btcd`. Following the instructions on their official [repo](https://github.com/btcsuite/btcd), first, install `go` and check the version with `go version`, root path, and path with `go env GOROOT GOPATH`. Next, `cd $GOPATH` and create the subdirectories `mkdir -p src/github.com/btcsuite/btcd` Clone the repo into the directory: `git clone https://github.com/btcsuite/btcd $GOPATH/src/github.com/btcsuite/btcd` Then install: `GO111MODULE=on go install -v . ./cmd/...` List installed btcd and its utilities: `ls $GOPATH/bin/` We have `addblock`, `btcctl`, `btcd`, `findcheckpoint`, `gencerts`, `lncli`, `lnd` `btcctl` - is a command line utility used to query and control `btcd` via RPC. `gencerts`- is another command line utility used to generate TLS certificates for a specified host `lncli` is a command line tool for querying `lnd` via RPC. `lnd` Lightning Network Daemon is a lightning network node implementation by Lightning labs. There are other Bitcoin-related Go packages released by the team, you can check them out [here](https://btcd.readthedocs.io/en/latest/developer_resources.html) #### BTCD CONFIGURATION USING btcd.conf FILE Next, we will create our configuration file. Now that `btcd` has been successfully installed, run the command `btcd —help` to see where we can place our configuration option. ![](https://i.imgur.com/fm03SHA.png) For the macOS platform which I am using, the default `/Users/{username}/Library/Application Support/Btcd/btcd.conf`. Navigate to the Btcd directory and create a config file: `cd /Users/{username}/Library/‘Application Support’/Btcd && touch btcd.conf && code btcd.conf` Set the following options in the config file: Network settings: `simnet=1` or `testnet=1` depending on the test network you want to use. RPC Server: `rpcuser={username}`, `rpcpass={password}` set a strong password Indexes: `txindex=1` Debug: `debuglevel=info` Summary of config file: ``` rpcuser="username" rpcpass="password" simnet=1 txindex=1 debuglevel=info ``` Save the file and return to the terminal and start btcd by running `btcd`. #### SETTING UP BTCCTL COMMAND LINE TOOL Next, we will configure `btcctl` to interact with `btcd` similar to `bitcoin-cli` for `bitcoind`. Create a `btcctl.conf` file inside the default directory for your platform. For macOS, it is at `/Users/{username}/Library/Application Support/Btcctl/btcctl.conf`, check the default location for your platform by running `btcctl -h`. Set the credentials to be same as those used for btcd: `rpcuser`="username", `rpcpass`="password", and network: `simnet=1` You should be able to query btcd now. ![](https://i.imgur.com/6G5DwdW.png) You can use `btcctl -l` to list all available command options or visit this documentation page [here](https://btcd.readthedocs.io/en/latest/json_rpc_api.html#standard-methods) for further information. Thank you. References: - Btcd official repo: https://github.com/btcsuite/btcd - Btcd documentation: https://btcd.readthedocs.io - Conformal blog post: https://blog.conformal.com/btcd-not-your-moms-bitcoin-daemon

    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