Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5db6a5bfe2 | ||
|
|
3d88a95823 | ||
|
|
bf7c7e7144 | ||
|
|
bb6992cadb | ||
|
|
fcf488b065 | ||
|
|
33d508fb44 | ||
|
|
00bc56adc3 | ||
|
|
b8847bd8a9 | ||
|
|
52ea558811 | ||
|
|
b32a6e6bbb | ||
|
|
5c83114197 | ||
|
|
963a9b074a |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/.build
|
||||||
|
*.xcuserstate
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
//
|
|
||||||
// main.swift
|
|
||||||
// Blockchain
|
|
||||||
//
|
|
||||||
// Created by Victor BODINAUD on 27/02/2020.
|
|
||||||
// Copyright © 2020 Victor BODINAUD. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
print("Hello, World!")
|
|
||||||
|
|
||||||
@@ -3,15 +3,15 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 50;
|
objectVersion = 77;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
B5E66EBD2407FDE000E89D17 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E66EBC2407FDE000E89D17 /* main.swift */; };
|
57BA298C2CF77907009E4448 /* CryptoSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 57BA298B2CF77907009E4448 /* CryptoSwift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
B5E66EB72407FDE000E89D17 /* CopyFiles */ = {
|
57BA297E2CF778F5009E4448 /* CopyFiles */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
dstPath = /usr/share/man/man1/;
|
dstPath = /usr/share/man/man1/;
|
||||||
@@ -23,118 +23,127 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
B5E66EB92407FDE000E89D17 /* Blockchain */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Blockchain; sourceTree = BUILT_PRODUCTS_DIR; };
|
57BA29802CF778F5009E4448 /* SwiftChain */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SwiftChain; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B5E66EBC2407FDE000E89D17 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
57BA29822CF778F5009E4448 /* SwiftChain */ = {
|
||||||
|
isa = PBXFileSystemSynchronizedRootGroup;
|
||||||
|
path = SwiftChain;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
B5E66EB62407FDE000E89D17 /* Frameworks */ = {
|
57BA297D2CF778F5009E4448 /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
57BA298C2CF77907009E4448 /* CryptoSwift in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
B5E66EB02407FDE000E89D17 = {
|
57BA29772CF778F5009E4448 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
B5E66EBB2407FDE000E89D17 /* Blockchain */,
|
57BA29822CF778F5009E4448 /* SwiftChain */,
|
||||||
B5E66EBA2407FDE000E89D17 /* Products */,
|
57BA29812CF778F5009E4448 /* Products */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
B5E66EBA2407FDE000E89D17 /* Products */ = {
|
57BA29812CF778F5009E4448 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
B5E66EB92407FDE000E89D17 /* Blockchain */,
|
57BA29802CF778F5009E4448 /* SwiftChain */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
B5E66EBB2407FDE000E89D17 /* Blockchain */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
B5E66EBC2407FDE000E89D17 /* main.swift */,
|
|
||||||
);
|
|
||||||
path = Blockchain;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
B5E66EB82407FDE000E89D17 /* Blockchain */ = {
|
57BA297F2CF778F5009E4448 /* SwiftChain */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = B5E66EC02407FDE000E89D17 /* Build configuration list for PBXNativeTarget "Blockchain" */;
|
buildConfigurationList = 57BA29872CF778F5009E4448 /* Build configuration list for PBXNativeTarget "SwiftChain" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
B5E66EB52407FDE000E89D17 /* Sources */,
|
57BA297C2CF778F5009E4448 /* Sources */,
|
||||||
B5E66EB62407FDE000E89D17 /* Frameworks */,
|
57BA297D2CF778F5009E4448 /* Frameworks */,
|
||||||
B5E66EB72407FDE000E89D17 /* CopyFiles */,
|
57BA297E2CF778F5009E4448 /* CopyFiles */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = Blockchain;
|
fileSystemSynchronizedGroups = (
|
||||||
productName = Blockchain;
|
57BA29822CF778F5009E4448 /* SwiftChain */,
|
||||||
productReference = B5E66EB92407FDE000E89D17 /* Blockchain */;
|
);
|
||||||
|
name = SwiftChain;
|
||||||
|
packageProductDependencies = (
|
||||||
|
57BA298B2CF77907009E4448 /* CryptoSwift */,
|
||||||
|
);
|
||||||
|
productName = SwiftChain;
|
||||||
|
productReference = 57BA29802CF778F5009E4448 /* SwiftChain */;
|
||||||
productType = "com.apple.product-type.tool";
|
productType = "com.apple.product-type.tool";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
/* Begin PBXProject section */
|
/* Begin PBXProject section */
|
||||||
B5E66EB12407FDE000E89D17 /* Project object */ = {
|
57BA29782CF778F5009E4448 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftUpdateCheck = 1130;
|
BuildIndependentTargetsInParallel = 1;
|
||||||
LastUpgradeCheck = 1130;
|
LastSwiftUpdateCheck = 1610;
|
||||||
ORGANIZATIONNAME = "Victor BODINAUD";
|
LastUpgradeCheck = 1610;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
B5E66EB82407FDE000E89D17 = {
|
57BA297F2CF778F5009E4448 = {
|
||||||
CreatedOnToolsVersion = 11.3.1;
|
CreatedOnToolsVersion = 16.1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = B5E66EB42407FDE000E89D17 /* Build configuration list for PBXProject "Blockchain" */;
|
buildConfigurationList = 57BA297B2CF778F5009E4448 /* Build configuration list for PBXProject "SwiftChain" */;
|
||||||
compatibilityVersion = "Xcode 9.3";
|
|
||||||
developmentRegion = en;
|
developmentRegion = en;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
en,
|
en,
|
||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
mainGroup = B5E66EB02407FDE000E89D17;
|
mainGroup = 57BA29772CF778F5009E4448;
|
||||||
productRefGroup = B5E66EBA2407FDE000E89D17 /* Products */;
|
minimizedProjectReferenceProxies = 1;
|
||||||
|
packageReferences = (
|
||||||
|
57BA298A2CF77907009E4448 /* XCRemoteSwiftPackageReference "CryptoSwift" */,
|
||||||
|
);
|
||||||
|
preferredProjectObjectVersion = 77;
|
||||||
|
productRefGroup = 57BA29812CF778F5009E4448 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
B5E66EB82407FDE000E89D17 /* Blockchain */,
|
57BA297F2CF778F5009E4448 /* SwiftChain */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
B5E66EB52407FDE000E89D17 /* Sources */ = {
|
57BA297C2CF778F5009E4448 /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
B5E66EBD2407FDE000E89D17 /* main.swift in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
/* Begin XCBuildConfiguration section */
|
||||||
B5E66EBE2407FDE000E89D17 /* Debug */ = {
|
57BA29852CF778F5009E4448 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
@@ -153,6 +162,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
@@ -163,7 +173,8 @@
|
|||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
@@ -177,24 +188,25 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 15.1;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
B5E66EBF2407FDE000E89D17 /* Release */ = {
|
57BA29862CF778F5009E4448 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
@@ -213,6 +225,7 @@
|
|||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
@@ -223,7 +236,8 @@
|
|||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
@@ -231,16 +245,16 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 15.1;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
B5E66EC12407FDE000E89D17 /* Debug */ = {
|
57BA29882CF778F5009E4448 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
@@ -251,7 +265,7 @@
|
|||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
B5E66EC22407FDE000E89D17 /* Release */ = {
|
57BA29892CF778F5009E4448 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
@@ -265,25 +279,44 @@
|
|||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
B5E66EB42407FDE000E89D17 /* Build configuration list for PBXProject "Blockchain" */ = {
|
57BA297B2CF778F5009E4448 /* Build configuration list for PBXProject "SwiftChain" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
B5E66EBE2407FDE000E89D17 /* Debug */,
|
57BA29852CF778F5009E4448 /* Debug */,
|
||||||
B5E66EBF2407FDE000E89D17 /* Release */,
|
57BA29862CF778F5009E4448 /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
B5E66EC02407FDE000E89D17 /* Build configuration list for PBXNativeTarget "Blockchain" */ = {
|
57BA29872CF778F5009E4448 /* Build configuration list for PBXNativeTarget "SwiftChain" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
B5E66EC12407FDE000E89D17 /* Debug */,
|
57BA29882CF778F5009E4448 /* Debug */,
|
||||||
B5E66EC22407FDE000E89D17 /* Release */,
|
57BA29892CF778F5009E4448 /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
|
57BA298A2CF77907009E4448 /* XCRemoteSwiftPackageReference "CryptoSwift" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/krzyzanowskim/CryptoSwift.git";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 1.8.3;
|
||||||
};
|
};
|
||||||
rootObject = B5E66EB12407FDE000E89D17 /* Project object */;
|
};
|
||||||
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
57BA298B2CF77907009E4448 /* CryptoSwift */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 57BA298A2CF77907009E4448 /* XCRemoteSwiftPackageReference "CryptoSwift" */;
|
||||||
|
productName = CryptoSwift;
|
||||||
|
};
|
||||||
|
/* End XCSwiftPackageProductDependency section */
|
||||||
|
};
|
||||||
|
rootObject = 57BA29782CF778F5009E4448 /* Project object */;
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "self:Blockchain.xcodeproj">
|
location = "self:">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"originHash" : "72c2bbc73844ab67fc7d9913c0750200cb8c2703ae8ac776acd11affc367875c",
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "cryptoswift",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "678d442c6f7828def400a70ae15968aef67ef52d",
|
||||||
|
"version" : "1.8.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 3
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>SchemeUserState</key>
|
<key>SchemeUserState</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Blockchain.xcscheme_^#shared#^_</key>
|
<key>SwiftChain.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
18
SwiftChain/Models/Account.swift
Normal file
18
SwiftChain/Models/Account.swift
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// File.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Victor BODINAUD on 31/03/2021.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class Account {
|
||||||
|
var id: String
|
||||||
|
var balance: Int
|
||||||
|
|
||||||
|
init(id: String, balance: Int) {
|
||||||
|
self.id = id
|
||||||
|
self.balance = balance
|
||||||
|
}
|
||||||
|
}
|
||||||
59
SwiftChain/Models/Block.swift
Normal file
59
SwiftChain/Models/Block.swift
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
//
|
||||||
|
// Block.swift
|
||||||
|
// Blockchain
|
||||||
|
//
|
||||||
|
// Created by Victor BODINAUD on 27/02/2020.
|
||||||
|
// Copyright © 2020 Victor BODINAUD. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import CryptoSwift
|
||||||
|
|
||||||
|
class Block {
|
||||||
|
var hash: String
|
||||||
|
var data: String
|
||||||
|
var previousHash: String
|
||||||
|
var index: Int
|
||||||
|
var nonce: Int
|
||||||
|
var timestamp: Int
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize a block with the provided parts and specifications.
|
||||||
|
|
||||||
|
- parameters:
|
||||||
|
- hash: The hash of the block
|
||||||
|
- data: The data of the block
|
||||||
|
- previousHash: The hash of the previous block
|
||||||
|
- index: The index of the block
|
||||||
|
- nonce: The nonce of the block
|
||||||
|
- timestamp: The timestamp of the block
|
||||||
|
|
||||||
|
- returns: A beautiful new block for the blockchain.
|
||||||
|
*/
|
||||||
|
init(hash: String = "", data: String = "", previousHash: String = "", index: Int = 0, nonce: Int = 0, timestamp: Int = 0) {
|
||||||
|
self.data = data
|
||||||
|
self.previousHash = previousHash
|
||||||
|
self.index = index
|
||||||
|
self.nonce = nonce
|
||||||
|
self.timestamp = timestamp
|
||||||
|
self.hash = hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Generate the hash of the block.
|
||||||
|
|
||||||
|
- returns: The hash of the block
|
||||||
|
*/
|
||||||
|
func generateHash() -> String {
|
||||||
|
return data.sha256()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Generate the timestamp of the block
|
||||||
|
|
||||||
|
- returns: The timestamp of the block
|
||||||
|
*/
|
||||||
|
func generateTimestamp() -> Int {
|
||||||
|
return Int(Date().timeIntervalSince1970)
|
||||||
|
}
|
||||||
|
}
|
||||||
88
SwiftChain/Models/Blockchain.swift
Normal file
88
SwiftChain/Models/Blockchain.swift
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
//
|
||||||
|
// Blockchain.swift
|
||||||
|
// Blockchain
|
||||||
|
//
|
||||||
|
// Created by Victor BODINAUD on 27/02/2020.
|
||||||
|
// Copyright © 2020 Victor BODINAUD. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class Blockchain {
|
||||||
|
var chain = [Block]()
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize the first block of the blockchain.
|
||||||
|
|
||||||
|
- Parameters:
|
||||||
|
- data: The datas of the block
|
||||||
|
*/
|
||||||
|
func createGenesisBlock(data: String) {
|
||||||
|
let genesisBlock = Block()
|
||||||
|
genesisBlock.data = data
|
||||||
|
genesisBlock.previousHash = "0000"
|
||||||
|
genesisBlock.index = 0
|
||||||
|
genesisBlock.nonce = 0
|
||||||
|
genesisBlock.timestamp = genesisBlock.generateTimestamp()
|
||||||
|
genesisBlock.hash = genesisBlock.generateHash()
|
||||||
|
chain.append(genesisBlock)
|
||||||
|
print("Genesis block created -- hash: \(genesisBlock.hash)")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize a new block of the blockchain.
|
||||||
|
|
||||||
|
- Parameters:
|
||||||
|
- data: The datas of the block
|
||||||
|
*/
|
||||||
|
func createBlock(data: String) {
|
||||||
|
let newBlock = Block()
|
||||||
|
newBlock.data = data
|
||||||
|
newBlock.previousHash = chain.last!.hash
|
||||||
|
newBlock.index = chain.count
|
||||||
|
newBlock.nonce = 0
|
||||||
|
newBlock.timestamp = newBlock.generateTimestamp()
|
||||||
|
newBlock.hash = newBlock.generateHash()
|
||||||
|
chain.append(newBlock)
|
||||||
|
|
||||||
|
print("-- Block \(newBlock.index) created --\n hash: \(newBlock.hash)\n previous hash: \(newBlock.previousHash)\n data: \(newBlock.data)")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Insert a corrupted block in the blockhain.
|
||||||
|
(for testing purpose)
|
||||||
|
*/
|
||||||
|
func insertCorruptedBlock() {
|
||||||
|
let newCorruptedBlock = Block()
|
||||||
|
newCorruptedBlock.data = "Corrupted block"
|
||||||
|
newCorruptedBlock.previousHash = "1234567890"
|
||||||
|
newCorruptedBlock.index = chain.count
|
||||||
|
newCorruptedBlock.nonce = 0
|
||||||
|
newCorruptedBlock.timestamp = newCorruptedBlock.generateTimestamp()
|
||||||
|
newCorruptedBlock.hash = newCorruptedBlock.generateHash()
|
||||||
|
chain.append(newCorruptedBlock)
|
||||||
|
|
||||||
|
print("-- Corrupted block \(newCorruptedBlock.index) created --\n hash: \(newCorruptedBlock.hash)\n previous hash: \(newCorruptedBlock.previousHash)\n data: \(newCorruptedBlock.data)")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check validity of the blockchain.
|
||||||
|
*/
|
||||||
|
func chainValidity() {
|
||||||
|
var isChainValid = true
|
||||||
|
var corruptedBlock = Block()
|
||||||
|
|
||||||
|
for i in 1...chain.count-1 {
|
||||||
|
if chain[i].previousHash != chain[i-1].hash {
|
||||||
|
isChainValid = false
|
||||||
|
corruptedBlock = chain[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print("Chain is valid : \(isChainValid)")
|
||||||
|
|
||||||
|
if !isChainValid {
|
||||||
|
print("Corrupted block is : \(corruptedBlock.index)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
SwiftChain/Models/Transaction.swift
Normal file
22
SwiftChain/Models/Transaction.swift
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// File.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Victor BODINAUD on 31/03/2021.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class Transaction {
|
||||||
|
var sender: String
|
||||||
|
var receiver: String
|
||||||
|
var amount: Int
|
||||||
|
var type: String
|
||||||
|
|
||||||
|
init(sender: String, receiver: String, amount: Int, type: String) {
|
||||||
|
self.sender = sender
|
||||||
|
self.receiver = receiver
|
||||||
|
self.amount = amount
|
||||||
|
self.type = type
|
||||||
|
}
|
||||||
|
}
|
||||||
44
SwiftChain/main.swift
Normal file
44
SwiftChain/main.swift
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
//
|
||||||
|
// main.swift
|
||||||
|
// Blockchain
|
||||||
|
//
|
||||||
|
// Created by Victor BODINAUD on 27/02/2020.
|
||||||
|
// Copyright © 2020 Victor BODINAUD. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
let blockchain = Blockchain()
|
||||||
|
var command: String?
|
||||||
|
|
||||||
|
blockchain.createGenesisBlock(data: "")
|
||||||
|
|
||||||
|
repeat {
|
||||||
|
print("Enter command:")
|
||||||
|
command = readLine()
|
||||||
|
|
||||||
|
// Create a new block
|
||||||
|
if command == "create" {
|
||||||
|
print("data for the new block:")
|
||||||
|
let data = readLine()
|
||||||
|
blockchain.createBlock(data: data ?? "")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a lot of blocks
|
||||||
|
if command == "spam" {
|
||||||
|
for _ in 1...1000 {
|
||||||
|
blockchain.createBlock(data: "\((blockchain.chain.last?.index ?? 0)+1)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check validity of the blockchain
|
||||||
|
if command == "validity" {
|
||||||
|
blockchain.chainValidity()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert a corrupted block
|
||||||
|
if command == "corrupt" {
|
||||||
|
blockchain.insertCorruptedBlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
} while command != "exit"
|
||||||
Reference in New Issue
Block a user