LoginSignup
0
1

More than 5 years have passed since last update.

bitcoinのデータの保存場所を変更する

Posted at

下記3つのやり方のいずれかで変更できる。
※ Bitcoin Core Daemon version v0.16, Mac OSX 10.12

1. bitcoindの起動時に -datadir オプションを付ける

$ cd bitcoin
$ ./src/bitcoind -datadir <ディレクトリ名>

2. 設定ファイルに設定する

Bitcoin Core Config Generatorで設定ファイルを自動作成できる。

$HOME/Library/ApplicationSupport/Bitcoin/bitcoin.conf
rpcuser=hoge
rpcpassword=hoge

# 下記を追記
datadir=<ディレクトリ名>

3. ソースコード上でデフォルトの保存場所を変更する

src/util.cpp
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -707,14 +707,14 @@ fs::path GetDefaultDataDir()
fs::path GetDefaultDataDir()
 {
     // Windows < Vista: C:\Documents and Settings\Username\Application Data\Bitcoin
     // Windows >= Vista: C:\Users\Username\AppData\Roaming\Bitcoin
     // Mac: ~/Library/Application Support/Bitcoin
     // Unix: ~/.bitcoin
 #ifdef WIN32
     // Windows
     return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin";
 #else
     fs::path pathRet;
-    char* pszHome = getenv("HOME");
+    char* pszHome = "/";
     if (pszHome == nullptr || strlen(pszHome) == 0)
         pathRet = fs::path("/");
     else
         pathRet = fs::path(pszHome);
 #ifdef MAC_OSX
     // Mac
-    return pathRet / "Library/Application Support/Bitcoin";
+    return pathRet / "<ディレクトリ名>";

変更後、ソースコードをコンパイルしてbitcoindを立ち上げる。

参考

Running Bitcoin

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1