Skip to content

Commit fd1803c

Browse files
committed
chore(repo): upload completed code
1 parent 0f5a26b commit fd1803c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+16223
-2
lines changed

Cargo.lock

Lines changed: 10605 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[profile.release]
2+
panic = "unwind"
3+
4+
[workspace]
5+
members = [
6+
"node",
7+
"runtime",
8+
"multi-pow",
9+
]
10+
resolver = "2"
11+
12+
[workspace.dependencies]
13+
14+
# Crates.io dependencies
15+
async-trait = { version = "0.1.53" }
16+
clap = { version = "4.5.3" }
17+
futures = { version = "0.3.30" }
18+
hex = "0.4"
19+
hex-literal = "0.4.1"
20+
jsonrpsee = { version = "0.23.2" }
21+
log = "0.4.25"
22+
md5 = "0.7.0"
23+
parity-scale-codec = { version = "3.1.2", features = [ "derive" ], default-features = false }
24+
rand = { version = "0.8.5", features = [ "small_rng" ] }
25+
scale-info = { version = "2.11.1", default-features = false }
26+
serde = "1.0.137"
27+
serde_json = { version = "1.0.114", default-features = false }
28+
sha3 = "0.10.1"
29+
30+
# Local Dependencies
31+
academy-pow-runtime = { path = "../runtime" }
32+
multi-pow = { default-features = false, path = "../multi-pow" }
33+
34+
# Polkadot SDK Dependencies
35+
frame-executive = { version = "37.0.0", default-features = false }
36+
frame-support = { version = "37.0.0", default-features = false }
37+
frame-system = { version = "37.0.0", default-features = false }
38+
frame-system-rpc-runtime-api = { version = "34.0.0", default-features = false }
39+
pallet-balances = { version = "38.0.0", default-features = false }
40+
pallet-timestamp = { version = "36.0.0", default-features = false }
41+
pallet-transaction-payment = { version = "37.0.0", default-features = false }
42+
pallet-transaction-payment-rpc = { version = "40.0.0" }
43+
pallet-transaction-payment-rpc-runtime-api = { version = "37.0.0", default-features = false }
44+
sc-basic-authorship = { version = "0.44.0" }
45+
sc-chain-spec = { version = "37.0.0" }
46+
sc-cli = { version = "0.46.0", default-features = false }
47+
sc-client-api = { version = "37.0.0" }
48+
sc-consensus = { version = "0.43.0" }
49+
sc-consensus-manual-seal = { version = "0.45.0" }
50+
sc-consensus-pow = { version = "0.43.0" }
51+
sc-executor = { version = "0.40.0" }
52+
sc-network = { version = "0.44.0" }
53+
sc-rpc-api = { version = "0.43.0" }
54+
sc-service = { version = "0.45.0", default-features = false }
55+
sc-telemetry = { version = "24.0.0" }
56+
sc-transaction-pool = { version = "37.0.0" }
57+
sc-transaction-pool-api = { version = "37.0.0" }
58+
sp-api = { version = "34.0.0", default-features = false }
59+
sp-block-builder = { version = "34.0.0", default-features = false }
60+
sp-blockchain = { version = "37.0.0" }
61+
sp-consensus = { version = "0.40.0" }
62+
sp-consensus-pow = { version = "0.40.0", default-features = false }
63+
sp-core = { version = "34.0.0", default-features = false }
64+
sp-genesis-builder = { version = "0.15.0", default-features = false }
65+
sp-inherents = { version = "34.0.0", default-features = false }
66+
sp-io = { version = "38.0.0", default-features = false }
67+
sp-keyring = { version = "39.0.0" }
68+
sp-keystore = { version = "0.40.0" }
69+
sp-offchain = { version = "34.0.0", default-features = false }
70+
sp-runtime = { version = "39.0.0", default-features = false }
71+
sp-session = { version = "35.0.0", default-features = false }
72+
sp-std = { version = "14.0.0", default-features = false }
73+
sp-timestamp = { version = "34.0.0" }
74+
sp-transaction-pool = { version = "34.0.0", default-features = false }
75+
sp-version = { version = "37.0.0", default-features = false }
76+
substrate-build-script-utils = { version = "11.0.0", default-features = false }
77+
substrate-frame-rpc-system = { version = "38.0.0" }
78+
substrate-wasm-builder = { version = "24.0.0", default-features = false }

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org>

README.md

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,89 @@
1-
# substrate-bitcoin
2-
Tutorial to create a bitcoin-like blockchain using Substrate
1+
# Substrate Bitcoin-like Blockchain with UTXO account model
2+
3+
## Academy-PoW
4+
5+
This repository is generated from [Academy-PoW](https://github.com/Polkadot-Blockchain-Academy/Academy-PoW) repository.
6+
7+
8+
However, during implement Bitcoin-like blockchain, I've to update and fix a lot to make sure to code run smoothly.
9+
10+
11+
Significantly, I've bumped Polkadot-SDK to stable-2407. That's quite complected but I've made it thanks to comprehensive document of OpenGuild's Polkadot SDK course.
12+
- [Bump Polkadot SDK versions lesson doc.](https://bootcamp.openguild.wtf/building-a-blockchain-with-polkadot-sdk/polkadot-sdk/substrate/bump-polkadot-sdk-versions)
13+
- [Bump Polkadot SDK versions lesson video.](https://www.youtube.com/watch?v=6nhIZmE1Nck&list=PLnhzaKpksqOKiqu9DDjGnmZWB0hYTaOUC&index=15)
14+
- My commit: [be5c66](https://github.com/danielbui12/substrate-bitcoin-like-blockchain/commit/be5c665779dc23e2ac2c710ce5ada95975b4d5d2)
15+
16+
## Substrate UTXO Workshop
17+
18+
This version builds upon the work of giants from [Building a UTXO Chain from Scratch | Substrate Seminar](https://www.youtube.com/watch?v=XuJmxMMHvDw), with even more inspiration (I believe! 😃).
19+
20+
## Proof of Work
21+
22+
- Discover [Proof-of-Work (PoW)](docs/pow/pow.md)
23+
- Understanding overview of PoW in Substrate by reading [code breakdown](docs/pow/code-breakdown.md).
24+
25+
26+
## UTXO
27+
28+
- Discover [What is UTXO account model?](docs/utxo/utxo.md)
29+
- Understanding overview of UTXO in Substrate by reading [code breakdown](docs/utxo/code-breakdown.md).
30+
31+
32+
## Prerequisites
33+
34+
Before proceeding with this interactive tutorial, make sure you complete the initial tutorials on Substrate development from the official documentation. If you haven't gone through them yet, please review them first to build a solid foundation.
35+
36+
- [Substrate develop environment: Select your environment and complete `Install required packages and Rust`)](https://docs.substrate.io/install/)
37+
- [Substrate Tutorial](https://polkadot.study/tutorials/interactive-substrate-tutorials-rusty-crewmates/)
38+
- [Polkadot SDK doc](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/index.html)
39+
- [Substrate simulate a network](https://docs.substrate.io/tutorials/build-a-blockchain/simulate-network/)
40+
41+
Overview of Bitcoin-like Blockchain in Substrate
42+
43+
```mermaid
44+
graph TD;
45+
subgraph UTXO_Runtime
46+
Timestamp -->|Time trait| Difficulty
47+
Block_Author -->|BlockAuthor| UTXO
48+
Bitcoin_Halving --> |Issuance| UTXO
49+
FRAME_System
50+
51+
subgraph Difficulty
52+
Sha3_Difficulty
53+
Keccak_Difficulty
54+
Md5_Difficulty
55+
end
56+
end
57+
58+
subgraph UTXO_Node
59+
subgraph Multi_PoW_Consensus
60+
Sha3_Algorithm
61+
Keccak_Algorithm
62+
Md5_Algorithm
63+
end
64+
65+
Tx_Pool
66+
end
67+
68+
Difficulty --> Difficulty_API{{Difficulty API}}
69+
Difficulty_API --> Multi_PoW_Consensus
70+
UTXO --> Tx_Pool_API{{Tx Pool API}}
71+
Tx_Pool_API --> Tx_Pool
72+
```
73+
74+
## How to run the node
75+
76+
- Refer to [How to run the node](docs/how-to-run-the-node.md) to choose development environment and boost up your first local blockchain node.
77+
78+
## Demo usage
79+
80+
- Please follow exactly these [instructions](docs/demo-usage.md) to get best experience.
81+
82+
83+
## Build your own UTXO account model
84+
85+
Follow this [book](https://danielbui12.github.io/substrate-bitcoin-like-blockchain/) to build your own Bitcoin-like blockchain with UTXO account model.
86+
87+
## FAQ
88+
89+
- Read the [Frequently Asked Questions - FAQ](docs/faq.md)

docs/assets/1_check_balance.png

463 KB
Loading

docs/assets/1_input.png

413 KB
Loading

docs/assets/2_check_balance.png

480 KB
Loading

docs/assets/2_event.png

515 KB
Loading

docs/assets/2_input.png

491 KB
Loading

docs/assets/example_tips.png

358 KB
Loading

0 commit comments

Comments
 (0)