GithubHelp home page GithubHelp logo

ndizazzo / swiftchain Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 151 KB

SwiftChain is a simple implementation of a blockchain, written purely in Swift.

License: MIT License

Swift 98.84% Ruby 0.53% Objective-C 0.33% Shell 0.30%

swiftchain's Introduction

What is SwiftChain?

SwiftChain is a simple implementation of a blockchain, written purely in Swift.

The goal if SwiftChain is to provide a strong foundation layer for any and all interesting applications of blockchain that you might want to build.

Installation

Manual Installation

In order to correctly compile SwiftChain (in Xcode):

  1. You must be using a workspace.
  2. Drag the SwiftChain.xcodeproj to your workspace
  3. Drag the CryptoSwift.xcodeproj to your workspace
  4. Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select SwiftChain.framework
  5. @import SwiftChain

Usage

Implementing SwiftChain in your Project

To work with SwiftChain, first import SwiftChain into the relevant files where you'd like to use it.

Then, create a new blockchain by calling the Blockchain() constructor. Optionally, you may provide data that should be included in the genesis block of your blockchain. See the documentation for details.

Once you have a Blockchain object, you can use:

let blockchain = Blockchain()
let myData = "some data object".data(using: .utf8)!
blockchain.addBlock(with: myData)

This will:

  1. Begin hashing the provided data using the algorithm the blockchain is supporting. This call is blocking, and can potentially take a long time.
  2. Append that data into a new block.
  3. Extend your blockchain object by one block.

Feature Roadmap

Feel free to open an issue to request a feature you'd like to see!

Troubleshooting

Can't compile?

  • Please note the difference between installing a compiled framework from CocoaPods or Carthage, and copying the source code
  • Search issues
  • Ask in the issues section

Other problems / Feature requests

  • Search issues
  • Ask in the issues section

Other

3rd party software

SwiftChain depends on CryptoSwift.

CryptoSwift is a collection of cryptographic algoriths and tools implemented in Swift. CryptoSwift is essential to keep SwiftChain accessible to as many platforms as possible, by not depending on pre-compiled system crypto tools.

Contributing

If you have ideas or like what you see here and want to support the project, you could:

  • Let people know this library exists (๐Ÿš€ spread the word ๐Ÿš€)
  • Contribute code, issues and pull requests

Questions & Issues

If you have questions or are having problems, you should:

  • Make sure you are using the latest version of the library. Check the release-section.
  • Search or ask questions on stackoverflow with the SwiftChain tag
  • Search known issues for your problem (open and closed)
  • Create new issues (please search known issues beforehand and avoid creating duplicate issues)

Documentation

I have written Xcode quick-help documentation for the library. Since this library is generally the key building blocks for a project, having it close to the source is the best approach. Please refer to Apple's Documentation for writing quick help documentation.

License

SwiftChain is available under the MIT license. See the LICENSE file for more information.

swiftchain's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.