https://github.com/devxoul/blockchain
A blockchain simulator written in Swift
https://github.com/devxoul/blockchain
blockchain swift
Last synced: 3 months ago
JSON representation
A blockchain simulator written in Swift
- Host: GitHub
- URL: https://github.com/devxoul/blockchain
- Owner: devxoul
- License: mit
- Created: 2018-01-14T18:59:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-14T19:19:33.000Z (over 7 years ago)
- Last Synced: 2025-03-18T08:53:34.004Z (3 months ago)
- Topics: blockchain, swift
- Language: Swift
- Homepage:
- Size: 19.5 KB
- Stars: 67
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Blockchain
A blockchain simulator written in Swift. It simulates full nodes in a virtual network. The nodes mine blocks for about every 10 seconds and verify randomly created transactions.
⚠️ This project is not an actual blockchain implementation. I am very new to the blockchain and the purpose of this repository is to share what I've learned. Note that there might be a lot of wrong implementations.
## Getting Started
```console
$ git clone https://github.com/devxoul/Blockchain.git
$ cd Blockchain
$ swift run
```Then you'll see:
```
Run server: Blockchain.Node on address 1.1.1.1
Run server: Blockchain.Node on address 2.2.2.2
Run server: Blockchain.Node on address 3.3.3.3
[[email protected]] Connect node 1.1.1.1
[[email protected]] Connect node 1.1.1.1
[[email protected]] Connect node 2.2.2.2
[[email protected]] Connect node 2.2.2.2
[[email protected]] Connect node 3.3.3.3
[[email protected]] Connect node 3.3.3.3
[[email protected]] Create transaction: ed99e0099751256d>
[[email protected]] Create transaction: ed99e0099751256d>
[[email protected]] Create transaction: ed99e0099751256d>
[[email protected]] Create transaction: 715e3b2f5d0dea50>
[[email protected]] Create transaction: 715e3b2f5d0dea50>
[[email protected]] Create transaction: 715e3b2f5d0dea50>
[[email protected]] Submit block:
[[email protected]] Submit block:
[[email protected]] Submit block:
[[email protected]] Submit block:
[[email protected]] Create transaction: e341e6db66aff49d>
[[email protected]] Create transaction: e341e6db66aff49d>
[[email protected]] Create transaction: e341e6db66aff49d>
[[email protected]] Submit block:
[[email protected]] Submit block:
[[email protected]] Submit block:
[[email protected]] Submit block:
```## Development
```console
$ swift package generate-xcodeproj
```## License
Blockchain is under MIT license. See the [LICENSE](LICENSE) file for more info.