mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-08 08:26:17 +00:00
editing text to date
reminding myself of where I am, and what I've written, and giving everything a light polish in the meantime.
This commit is contained in:
parent
7063dee776
commit
84f6218329
@ -6,9 +6,9 @@ This section explains how to interact with `bitcoind` using the Swift programmin
|
||||
|
||||
## Setting Up Swift on Your Mac
|
||||
|
||||
To date, you've built all of your alternative programming language development environments on your Debian virtual node. However, that's not the best platform for Swift. Though there is a version of Swift available for Ubuntu platforms, it's not fully featured, and it works somewhat differently from the Mac-native Swift. A "Variant" at the bottom of this chapter explains how to set it up, but be warned that you'll be in uncharted territory.
|
||||
To date, you've built all of your alternative programming language development environments on your Debian virtual node. However, that's not the best platform for Swift. Though there is a version of Swift available for Ubuntu platforms, it's not fully featured, and it works somewhat differently from the Mac-native Swift. A "variant" at the bottom of this section explains how to set it up, but be warned that you'll be in uncharted territory.
|
||||
|
||||
There are three major steps to setting up Swift on your Mac.
|
||||
Instead. we suggest an optimal Swift environment on a Mac. There are three major steps in setting that up.
|
||||
|
||||
### 1. Install Xcode
|
||||
|
||||
@ -16,35 +16,41 @@ You're going to need `Xcode`, the integrated development enviroment for Swift an
|
||||
|
||||
#### Alternative: Install by Hand
|
||||
|
||||
Some people advise against an App Store because it's somewhat all-or-nothing; it also won't work if you're still using Mojave because you want to avoid Catalina's incompatibilities. In that case you can download directly from the [Developer Area](https://developer.apple.com/download/more/) at Apple.
|
||||
Some people advise against an App Store install because it's somewhat all-or-nothing; it also won't work if you're still using Mojave because you want to avoid Catalina's incompatibilities. In that case you can download directly from the [Developer Area](https://developer.apple.com/download/more/) at Apple.
|
||||
|
||||
If you're using Mojave, you'll need the xip for Xcode 10.3.1. Otherwise, get the newest one.
|
||||
|
||||
Once it's downloaded, you can click on the XIP to extract it, then move the Xcode app to your Applications folder.
|
||||
|
||||
(EIther way, you should have Xcode installed in your Applications folder at the end of this step.)
|
||||
|
||||
### 2. Install the Gordian Server
|
||||
|
||||
You're also going to need a Bitcoin node on your Mac, so that you can communicate with it. Technically, you could use a remote node, and access it with the RPC login and password over the net. However, we suggest instead install a full node directly on your Mac, because that's the safest and cleanest setup, ensuring that none of your communications leave your machine.
|
||||
You're also going to need a Bitcoin node on your Mac, so that you can communicate with it. Technically, you could use a remote node, and access it with the RPC login and password over the net. However, we suggest you instead install a full node directly on your Mac, because that's the safest and cleanest setup, ensuring that none of your communications leave your machine.
|
||||
|
||||
We suggest you use Blockchain Commons' [GordianServer for MacOS](https://github.com/BlockchainCommons/GordianServer-macOS). See the [installation instructions](https://github.com/BlockchainCommons/GordianServer-macOS#installation-instructions) in the README, but generally all you have to do is download the current DMG, open it, and install that app in your Applications too.
|
||||
To easily install a full node on your Mac, use Blockchain Commons' [GordianServer for MacOS](https://github.com/BlockchainCommons/GordianServer-macOS). See the [installation instructions](https://github.com/BlockchainCommons/GordianServer-macOS#installation-instructions) in the README, but generally all you have to do is download the current DMG, open it, and install that app in your Applications too.
|
||||
|
||||
Afterward, run the GordianServer App, and tell it to `Start` Testnet.
|
||||
|
||||
> :link: **TESTNET vs. MAINNET:** Or Mainnet.
|
||||
> :link: **TESTNET vs. MAINNET:** Or `Start` Mainnet.
|
||||
|
||||
### 3. Find Your GordianServer Info
|
||||
|
||||
As usual, you'll need the RPC login and password. That's in `~/Library/Application Support/Bitcoin/bitcoin.conf` by default under Gordian.
|
||||
|
||||
Pull out the `rpcuser` and `rpcpassword` information; you'll need it to build your RPC connection:
|
||||
```
|
||||
$ grep rpc ~/Library/Application\ Support/Bitcoin/bitcoin.conf
|
||||
rpcuser=oIjA53JC2u
|
||||
rpcpassword=ebVCeSyyM0LurvgQyi0exWTqm4oU0rZU
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
## Variant: Deploying Swift on Ubuntu
|
||||
|
||||
If you prefer to deploy Swift on Ubuntu, you can do so, though the functionality isn't the same. Some of the code in this chapter will likely generate errors that you'll need to resolve, and you'll also need to do more work to link in libraries.
|
||||
If you prefer to deploy Swift on Ubuntu, you can do so, though the functionality isn't the same. Some of the code in this chapter will likely generate errors that you'll need to resolve, and you'll also need to do more work to link in C libraries.
|
||||
|
||||
To get started, install some required libraries:
|
||||
To get started, install some required Debian libraries:
|
||||
```
|
||||
$ sudo apt-get install clang
|
||||
$ sudo apt-get install libcurl4 libpython2.7 libpython2.7-dev
|
||||
@ -59,7 +65,7 @@ $ wget https://swift.org/builds/swift-5.1.3-release/ubuntu1804/swift-5.1.3-RELEA
|
||||
$ tar xzfv swift-5.1.3-RELEASE-ubuntu18.04.tar.gz
|
||||
$ sudo mv swift-5.1.3-RELEASE-ubuntu18.04 /usr/share/swift
|
||||
```
|
||||
For things to work, you should update your `PATH` in your `.bashrc`:
|
||||
To be able to use your new Swift setup, you need to update your `PATH` in your `.bashrc`:
|
||||
```
|
||||
$ echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc
|
||||
$ source ~/.bashrc
|
||||
|
Loading…
x
Reference in New Issue
Block a user