Skip to content

Commit

Permalink
Merge pull request #179 from Fonta1n3/JoinMarket
Browse files Browse the repository at this point in the history
Fixes for Bitcoin Core 22.0, refactoring.
  • Loading branch information
Fonta1n3 authored Sep 16, 2021
2 parents 16c2a00 + 8eab82c commit 0612657
Show file tree
Hide file tree
Showing 61 changed files with 3,119 additions and 1,161 deletions.
35 changes: 35 additions & 0 deletions Docs/Wallets/JoinMarket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Join Market

The next major release of Fully Noded will make Join Market wallet creation default for single-sig wallets.

## Wallet creation

#### Single-sig wallets

* BIP84 account for deriving the primary descriptors (invoice address generation and change)
* Join Market native segwit standard 5 mixdepth accounts (0 to 4)
* Utxos on the BIP84 keys will have a `mix` button which allows you to deposit to external addresses for any JM mixdepth

WIP
* Confirmation of a utxo on external deposit address will trigger...
* This is clearly better suited for desktop environments as the bot will run on the device
* If using a mobile device plug it in and disable auto lock


Example `bitcoin-cli` command for new Fully Noded single sig default wallet:

```
{"jsonrpc":"1.0","id":"80758B3E-CEF0-4330-A2E4-49D29F553C74","method":"importdescriptors","params":[
[{"desc": "wpkh([e15fb5b0/84'/1'/0']tpubDCw9rnRn7vdJGRLHxc67Keq4NUqFLbWpRxMsBf9YFvstLjJkis2pdNsPwAAA25zGLYrkRHDEjZ2DJhxK9qFiFJQf7P7qLSdHYunUpQZtgLa/0/*)#mu3n5jxf", "active": true, "range": [0,2500], "next_index": 0, "timestamp": "now", "internal": false},
{"desc": "wpkh([e15fb5b0/84'/1'/0']tpubDCw9rnRn7vdJGRLHxc67Keq4NUqFLbWpRxMsBf9YFvstLjJkis2pdNsPwAAA25zGLYrkRHDEjZ2DJhxK9qFiFJQf7P7qLSdHYunUpQZtgLa/1/*)#2g5jf8k3", "active": true, "range": [0,2500], "next_index": 0, "timestamp": "now", "internal": true},
{"desc": "wpkh([e15fb5b0/0/0]tpubDBbCP4LCwv2oyomaDcPMSEk7twZ4YTZ84a9YACUSgbMnAPUmMtWgucRLJiqYqJF12MaQBj177wDTYVSzSkv1eyFJuK2neqNWzb9vDw8X5Sw/0/*)#a42mvpmy", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": false},
{"desc": "wpkh([e15fb5b0/0/0]tpubDBbCP4LCwv2oyomaDcPMSEk7twZ4YTZ84a9YACUSgbMnAPUmMtWgucRLJiqYqJF12MaQBj177wDTYVSzSkv1eyFJuK2neqNWzb9vDw8X5Sw/1/*)#vp0635tu", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": true},
{"desc": "wpkh([e15fb5b0/0/1]tpubDBbCP4LCwv2p2YaZezC3bNAWhJAMxYfqWhtQ9ZURqoZEduVA4K2zHuaiZDZprCVBzK7wD1g9soRUPJ72N9geerQdQTiZhWS9cP5ecmQ77n3/0/*)#vlperyly", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": false},
{"desc": "wpkh([e15fb5b0/0/1]tpubDBbCP4LCwv2p2YaZezC3bNAWhJAMxYfqWhtQ9ZURqoZEduVA4K2zHuaiZDZprCVBzK7wD1g9soRUPJ72N9geerQdQTiZhWS9cP5ecmQ77n3/1/*)#atyc730u", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": true},
{"desc": "wpkh([e15fb5b0/0/2]tpubDBbCP4LCwv2p3Co7G9qCCeb3BiGNrVb7mqXuxoGpxvZzRD8uCgGKXihMGghRVes7Ap4KP3bZK2qeJRgUA1uSwKbFNQDjGhtD1Zc1g6or2i3/0/*)#t030xyh8", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": false},
{"desc": "wpkh([e15fb5b0/0/2]tpubDBbCP4LCwv2p3Co7G9qCCeb3BiGNrVb7mqXuxoGpxvZzRD8uCgGKXihMGghRVes7Ap4KP3bZK2qeJRgUA1uSwKbFNQDjGhtD1Zc1g6or2i3/1/*)#6m5wm38l", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": true},
{"desc": "wpkh([e15fb5b0/0/3]tpubDBbCP4LCwv2p79hw74vN9EM7GTDwkEibPoTFwAwe2h7sERPdrATMXv3bMQ1HWebtRzk7Kjz1yHWnUDyvHftEy1AR15uE2bn5Nmqx8jeYq8R/0/*)#3cu9u32t", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": false},
{"desc": "wpkh([e15fb5b0/0/3]tpubDBbCP4LCwv2p79hw74vN9EM7GTDwkEibPoTFwAwe2h7sERPdrATMXv3bMQ1HWebtRzk7Kjz1yHWnUDyvHftEy1AR15uE2bn5Nmqx8jeYq8R/1/*)#qveypy6n", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": true},
{"desc": "wpkh([e15fb5b0/0/4]tpubDBbCP4LCwv2p9ihQnbevHgEP7exoHXVeS6JNjkYk1YfvetaYLxop2RFxurbbac6tm7nf1kSt9dow4m9wKsTrEx5xHgkozw7rb1PeiTA8HF7/0/*)#7j5up4xr", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": false},
{"desc": "wpkh([e15fb5b0/0/4]tpubDBbCP4LCwv2p9ihQnbevHgEP7exoHXVeS6JNjkYk1YfvetaYLxop2RFxurbbac6tm7nf1kSt9dow4m9wKsTrEx5xHgkozw7rb1PeiTA8HF7/1/*)#0x3auqkm", "active": false, "range": [0,500], "next_index": 0, "timestamp": "now", "internal": true}]]}
```
64 changes: 39 additions & 25 deletions FullyNoded.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

41 changes: 30 additions & 11 deletions FullyNoded/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -2264,11 +2264,11 @@ xxxxx</string>
<objects>
<viewController storyboardIdentifier="QRDisplayer" useStoryboardIdentifierAsRestorationIdentifier="YES" id="GlR-4A-eAx" customClass="QRDisplayerViewController" customModule="FullyNoded" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="1Ax-bN-O8E">
<rect key="frame" x="0.0" y="0.0" width="375" height="574"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kj5-uB-hmc">
<rect key="frame" x="16" y="422" width="343" height="132"/>
<rect key="frame" x="16" y="422" width="343" height="225"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
Expand Down Expand Up @@ -4879,7 +4879,7 @@ You can upload the wallets.fullynoded file that was created when you made the ba
</objects>
<point key="canvasLocation" x="2718" y="376"/>
</scene>
<!--v0.2.25-->
<!--v0.2.26-->
<scene sceneID="Ajv-p7-tUm">
<objects>
<viewController extendedLayoutIncludesOpaqueBars="YES" id="AS8-ke-Yxh" customClass="SettingsViewController" customModule="FullyNoded" customModuleProvider="target" sceneMemberID="viewController">
Expand Down Expand Up @@ -5026,7 +5026,7 @@ You can upload the wallets.fullynoded file that was created when you made the ba
</constraints>
</view>
<tabBarItem key="tabBarItem" title="" image="Settings" id="n34-O3-Fyo"/>
<navigationItem key="navigationItem" title="v0.2.25" id="YNb-Gd-Hqq"/>
<navigationItem key="navigationItem" title="v0.2.26" id="YNb-Gd-Hqq"/>
<connections>
<outlet property="settingsTable" destination="hcp-eG-lok" id="xPg-8r-KBs"/>
<segue destination="bKH-sI-MiM" kind="show" identifier="goLogIn" id="qed-hl-jG5"/>
Expand Down Expand Up @@ -6099,7 +6099,7 @@ COLD means no keys will be generated and no private keys can be imported.</strin
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To create the channel scan a QR code in the format of publickey@ip:port (standard URI format)." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bmf-3G-mD0">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To create the channel scan or paste a QR code in the format of publickey@ip:port (standard URI format)." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bmf-3G-mD0">
<rect key="frame" x="16" y="322" width="343" height="29"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand All @@ -6113,25 +6113,43 @@ COLD means no keys will be generated and no private keys can be imported.</strin
<constraint firstAttribute="width" constant="167" id="d26-R0-PRs"/>
</constraints>
<color key="tintColor" systemColor="systemTealColor"/>
<state key="normal" title=" scan now" image="qrcode.viewfinder" catalog="system">
<state key="normal" title=" scan" image="qrcode.viewfinder" catalog="system">
<color key="titleColor" systemColor="systemTealColor"/>
</state>
<connections>
<action selector="scanNowAction:" destination="Ccs-1J-WKN" eventType="touchUpInside" id="Rio-wy-aRF"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vh2-gq-tc4">
<rect key="frame" x="104" y="414" width="167" height="40"/>
<color key="backgroundColor" red="0.1215686351" green="0.1294117719" blue="0.1411764771" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="width" constant="167" id="c8F-pG-1vo"/>
<constraint firstAttribute="height" constant="40" id="hcw-sC-HMX"/>
</constraints>
<color key="tintColor" red="0.34901961679999999" green="0.77647060160000003" blue="0.97254908080000002" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<state key="normal" title=" paste" image="doc.on.clipboard" catalog="system">
<color key="titleColor" red="0.34901961679999999" green="0.77647060160000003" blue="0.97254908080000002" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</state>
<connections>
<action selector="pasteAction:" destination="87K-Q0-lFo" eventType="touchUpInside" id="JGs-AE-F14"/>
<action selector="pasteAction:" destination="Ccs-1J-WKN" eventType="touchUpInside" id="LKC-pR-Jki"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="Dig-wA-gAJ"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="t7F-SI-0t5" secondAttribute="trailing" constant="16" id="1X1-56-DmX"/>
<constraint firstItem="dQ2-EQ-aje" firstAttribute="leading" secondItem="Dig-wA-gAJ" secondAttribute="leading" constant="16" id="1ed-H1-Zte"/>
<constraint firstItem="LVT-jy-ind" firstAttribute="top" secondItem="bmf-3G-mD0" secondAttribute="bottom" constant="15" id="34D-RD-igw"/>
<constraint firstItem="vh2-gq-tc4" firstAttribute="centerX" secondItem="NUp-Zk-LeU" secondAttribute="centerX" id="4yq-TK-bK5"/>
<constraint firstItem="1Ed-BV-iZs" firstAttribute="top" secondItem="Dig-wA-gAJ" secondAttribute="top" constant="19" id="5wX-Yz-PHm"/>
<constraint firstItem="Dig-wA-gAJ" firstAttribute="trailing" secondItem="SRg-gq-aWa" secondAttribute="trailing" constant="16" id="9GU-Qr-1nb"/>
<constraint firstItem="Dig-wA-gAJ" firstAttribute="bottom" secondItem="gUo-3Y-mJY" secondAttribute="bottom" constant="20" id="CQC-aH-5FO"/>
<constraint firstItem="gUo-3Y-mJY" firstAttribute="leading" secondItem="Dig-wA-gAJ" secondAttribute="leading" constant="16" id="D6h-oV-aTT"/>
<constraint firstItem="SRg-gq-aWa" firstAttribute="top" secondItem="dQ2-EQ-aje" secondAttribute="bottom" constant="8" id="IQt-lS-vuN"/>
<constraint firstItem="vh2-gq-tc4" firstAttribute="top" secondItem="LVT-jy-ind" secondAttribute="bottom" constant="8" symbolic="YES" id="JMM-rf-PhM"/>
<constraint firstItem="dQ2-EQ-aje" firstAttribute="top" secondItem="t7F-SI-0t5" secondAttribute="bottom" constant="29" id="Jtr-ti-TZk"/>
<constraint firstItem="Dig-wA-gAJ" firstAttribute="trailing" secondItem="bmf-3G-mD0" secondAttribute="trailing" constant="16" id="L82-V3-Fg0"/>
<constraint firstItem="1Ed-BV-iZs" firstAttribute="leading" secondItem="Dig-wA-gAJ" secondAttribute="leading" constant="16" id="LfY-OV-pCz"/>
Expand All @@ -6156,6 +6174,7 @@ COLD means no keys will be generated and no private keys can be imported.</strin
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="BWE-L0-Kij" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
<exit id="87K-Q0-lFo" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="4653.6000000000004" y="2818.7406296851577"/>
</scene>
Expand Down Expand Up @@ -7479,17 +7498,17 @@ COLD means no keys will be generated and no private keys can be imported.</strin
</scenes>
<inferredMetricsTieBreakers>
<segue reference="qed-hl-jG5"/>
<segue reference="Fvb-gy-rb3"/>
<segue reference="DLx-HT-rGm"/>
<segue reference="dhu-ZV-762"/>
<segue reference="4g3-DC-Q5z"/>
<segue reference="w2g-bl-j8v"/>
<segue reference="kq8-dj-bJ2"/>
<segue reference="Cd3-qW-ujG"/>
<segue reference="IAz-j1-Gq6"/>
<segue reference="6KH-E3-p33"/>
<segue reference="1fQ-PG-chF"/>
<segue reference="8MS-xS-DMP"/>
<segue reference="hqP-uS-RkV"/>
<segue reference="if0-NE-c9T"/>
<segue reference="yAt-Ra-aPH"/>
<segue reference="7PS-EL-3d2"/>
<segue reference="eLW-PX-CgI"/>
<segue reference="j10-wi-hpr"/>
<segue reference="qmy-fM-U4p"/>
</inferredMetricsTieBreakers>
Expand Down
13 changes: 12 additions & 1 deletion FullyNoded/BitSense.xcdatamodeld/BitSense.xcdatamodel/contents
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
<attribute name="index" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="label" optional="YES" attributeType="String"/>
<attribute name="maxIndex" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="mixDepthFourExt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthFourInt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthOneExt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthOneInt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthThreeExt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthThreeInt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthTwoExt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthTwoInt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthZeroExt" optional="YES" attributeType="Binary"/>
<attribute name="mixDepthZeroInt" optional="YES" attributeType="Binary"/>
<attribute name="mixIndexes" optional="YES" attributeType="Transformable" valueTransformerName="NSSecureUnarchiveFromData"/>
<attribute name="name" optional="YES" attributeType="String"/>
<attribute name="receiveDescriptor" optional="YES" attributeType="String"/>
<attribute name="type" optional="YES" attributeType="String"/>
Expand All @@ -92,6 +103,6 @@
<element name="Signers" positionX="-27" positionY="189" width="128" height="104"/>
<element name="Transactions" positionX="-36" positionY="279" width="128" height="149"/>
<element name="Utxos" positionX="-36" positionY="234" width="128" height="238"/>
<element name="Wallets" positionX="-36" positionY="180" width="128" height="194"/>
<element name="Wallets" positionX="-36" positionY="180" width="128" height="359"/>
</elements>
</model>
26 changes: 15 additions & 11 deletions FullyNoded/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import UIKit

public extension UtxosStruct {
public extension Utxo {
var input: String {
return "{\"txid\":\"\(self.txid)\",\"vout\": \(self.vout),\"sequence\": 1}"
}
Expand Down Expand Up @@ -103,6 +103,10 @@ public extension Int {
}

public extension String {
var pong: String {
return self.replacingOccurrences(of: "PING", with: "PONG")
}

var btc: String {
return self + " btc"
}
Expand All @@ -116,11 +120,11 @@ public extension String {
}

if dbl < 1.0 {
return dbl.avoidNotation
return dbl.avoidNotation + " sat"
} else if dbl == 1.0 {
return "1 sat"
} else {
return "\(Int(dbl)) sats"
return "\(dbl) sats"
}
}

Expand Down Expand Up @@ -164,10 +168,11 @@ public extension String {

var satsToBtc: Double {
var processed = "\(self)".replacingOccurrences(of: ",", with: "")
processed = processed.replacingOccurrences(of: ".", with: "")
processed = processed.replacingOccurrences(of: "-", with: "")
processed = processed.replacingOccurrences(of: "+", with: "")
processed = processed.replacingOccurrences(of: "sats", with: "").condenseWhitespace()
let btc = processed.doubleValue / 100000000.0
let btc = Double(processed)! / 100000000.0
return btc
}

Expand All @@ -179,12 +184,6 @@ public extension String {
return Double(self)! / 1000.0
}

var bitcoinVersion: Double {
var versionString = String(self.dropFirst())
versionString = String(versionString.dropFirst())
return Double(versionString)!
}

var btcToSats: String {
return (Int(self.doubleValue * 100000000.0)).avoidNotation
}
Expand Down Expand Up @@ -276,6 +275,11 @@ public extension Data {
}

public extension Double {
func rounded(toPlaces places:Int) -> Double {
let divisor = pow(10.0, Double(places))
return (self * divisor).rounded() / divisor
}

var withCommas: String {
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = NumberFormatter.Style.decimal
Expand Down Expand Up @@ -353,7 +357,7 @@ public extension Double {
if dbl < 1.0 {
return "\(symbol)\(dbl.avoidNotation)"
} else {
return "\(symbol)\(Int(dbl).withCommas)"
return "\(symbol)\(dbl.rounded(toPlaces: 2).withCommas)"
}
}

Expand Down
4 changes: 0 additions & 4 deletions FullyNoded/FullyNoded.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.fullynoded.backup</string>
Expand Down
4 changes: 0 additions & 4 deletions FullyNoded/FullyNodedRelease.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.fullynoded.backup</string>
Expand Down
Loading

0 comments on commit 0612657

Please sign in to comment.