Main source for this: Mac beginner's guide by ETS – This whole guide is a blatant copy & paste, I deserve zero credits!
This guide mostly assumes a primary SSD and an external SSD, formatted as APFS. If you want to follow the commands verbatim, name your external SSD volume as ord-dev. You'll still need ~100 GB free on your internal disk, as only the bitcoin blocks are moved to the external SSD. This configuration allows for moving the bulk of the storage needs to the external but leaving enough in the default locations to make commands easier.
Install Homebrew from http://brew.sh/
During installation you may be prompted for a password. This is your main Mac password and you won't see any letters as you type it. After typing it, press enter to continue.
After Homebrew installation and "Next steps", run this from terminal:
brew install bitcoinAfter the bitcoin installation, create your bitcoin blocks directory on your external SSD (most Macs don't have enough storage on their internal SSDs. 1 TB free for comfort.) Name the folder bitcoin. If your external SSD volume name has a space, rename that, too. No spaces! In this guide, the external SSD has the name ord-dev!
Run these commands in Terminal:
mkdir ~/Library/Application\ support/Bitcoin
echo blocksdir=/Volumes/ord-dev/Bitcoin > ~/Library/Application\ Support/Bitcoin/bitcoin.conf
echo txindex=1 >> ~/Library/Application\ Support/Bitcoin/bitcoin.conf
echo server=1 >> ~/Library/Application\ Support/Bitcoin/bitcoin.conf
echo mempoolfullrbf=1 >> ~/Library/Application\ Support/Bitcoin/bitcoin.conf
echo blocksdir=/Volumes/ord-dev/Bitcoin\\ntxindex=1\\nserver=1\\n > ~/Library/Application\ support/Bitcoin/bitcoin.conf(where the /ord-dev/Bitcoin part is the actual path to the SSD and folder you created above. CAREFUL MODIFYING THIS COMMAND, EVERY SPACE AND SLASH AND ~ IS NEEDED!)
blocksdir line!
txindex=1If you want to be able to access any transaction with commands like gettransaction , you need to configure Bitcoin Core to build a complete transaction index, which can be achieved with the txindex option.server=1tells bitcoin to accept JSON-RPC commands, so you can query it
Confirm all settings with:
cat ~/Library/Application\ Support/Bitcoin/bitcoin.confIn terminal:
brew services start bitcoinand this if you want to stop it again (not yet)
brew services stop bitcoinIn the debug.log file located in ~/Library/Application\ Support/Bitcoin/, look for lines similar to these:
2023-11-15T13:16:47Z Default data directory /Users/username/Library/Application Support/Bitcoin
2023-11-15T13:16:47Z Using data directory /Users/username/Library/Application Support/Bitcoin
2023-11-15T13:16:47Z Config file: /Users/username/Library/Application Support/Bitcoin/bitcoin.conf
2023-11-15T13:16:47Z Config file arg: blocksdir="/Volumes/ord-dev/Bitcoin"
2023-11-15T13:16:47Z Config file arg: server="1"
2023-11-15T13:16:47Z Config file arg: txindex="1"
2023-11-15T13:16:47Z Generated RPC authentication cookie /Users/username/Library/Application Support/Bitcoin/.cookie
tail -F -n 10000 ~/Library/Application\ Support/Bitcoin/debug.logThese entries in the output confirm that the blocks dir and the configuration entries have been recognized and have taken effect. Pay attention to the cookie line. You'll need that later, so make sure you have it!
The initial block download will generally take 1+ days, depending on factors like CPU/disk/network speed. As it progresses, you'll see lines like this in the debug.log file:
2023-02-22T15:18:23Z UpdateTip: new best=00000000000000000000e2319131e7e41d3b93e8b9086fc427f2ee9383aa2686 height=777656 version=0x20004000 log2_work=94.017345 tx=807469638 date='2023-02-21T14:40:00Z' progress=0.999679 cache=2.5MiB(18835txo)The progress= entry tells you how far you are along. It will reach 1.000000 at completion of the initial block download and then you can leave bitcoin running as a service and proceed to the ord installation and configuration.
Run this in terminal:
bitcoin-cli getindexinfo
You should see a response like this:
{
"txindex": {
"synced": true,
"best_block_height": 839505
}If it shows synced:false or the block height is not current, wait longer and run the command again. If it shows synced:true and current block height, proceed to ord installation!
Here are some tips for getting the bitcoin core node up and running and accepting RPC connections from external hosts.
This is not an efficient setup in combination with ord (it should be much faster when everything runs on the same machine), but useful for other development tasks.
~/Library/Application\ Support/Bitcoin/bitcoin.conf (mac).
/bitcoin/.bitcoin/bitcoin.conf (linux)
server=1
rpcbind=0.0.0.0
rpcallowip=<your_network_range>
rpcport=8332
rpcauth=<username>:<hashed_password>
txindex=1
mempoolfullrbf=1This tells tells Bitcoin to accept JSON-RPC commands.
This will tell Bitcoin to listen an every available network interface. If you would like to only accept connections on a specific network interface, replace 0.0.0.0 with the IP of your desired network interface.
With rpcallowip you can either specify an IP range in CIDR format, or specify the rpcallowip option multiple times with distinct IP addresses that you want to allow connections from.
Note: Wildcards are no longer supported. You need to use subnets now.
To allow everything that would be 0.0.0.0/0 (ipv4) or ::/0 (ipv6).
Of course, this is not save to expose to untrusted networks such as the public internet!
This sets the port that Bitcoin will listen on for RPC connections. Port 8332 is the default.
This configuration sets a username and password (hashed) to be used for authenticating RPC requests. Bitcoin Core RPC Auth Config Generator is a useful tool for generating the hashed passwords.
With txindex=1 Bitcoin Core maintains an index of all transactions that have ever happened, which you can query using the remote procedure call (RPC) method getrawtransaction or the RESTful API call get-tx .
Next, restart the bitcoind service!
Then, on the machine that you’ll be making RPC requests from, make a test request using curl:
curl -f --user <username> --data-binary \
'{"method":"getblockhash","params":[0],"id":1}' \
-H 'content-type: text/plain;' http://<hostname>:<port>/In the above request, replace the following values:
<username>– Replace this with the value you specified for rpcuser in your bitcoin.conf file.<hostname>:<port>- Replace<hostname>with the IP address or hostname of your Bitcoin server and<port>with the value you specified forrpcportin yourbitcoin.conffile Hint: executeifconfigto figure out your IP address.
If everything is set up correctly, after running the curl command, you should be prompted for your RPC password and Bitcoin will respond with a valid result.