Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
magic.chen
authored and
magic.chen
committed
Jul 9, 2018
1 parent
ff65af4
commit 8d5feb9
Showing
8 changed files
with
138 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env python | ||
# -*- coding:utf-8 -*- | ||
|
||
""" | ||
This Document is Created by At 2018/7/9 | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env python | ||
# -*- coding:utf-8 -*- | ||
|
||
""" | ||
This Document is Created by At 2018/7/9 | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env python | ||
# -*- coding:utf-8 -*- | ||
|
||
""" | ||
This Document is Created by At 2018/7/9 | ||
""" | ||
|
||
from consensus.proof_of_work import ProofOfWork | ||
from core.blockchain.block import Block | ||
|
||
|
||
if __name__ == '__main__': | ||
b = Block() | ||
|
||
genesis_block = b.new_block("Magic test", "") | ||
|
||
pow = ProofOfWork(genesis_block) | ||
pow.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python | ||
# -*- coding:utf-8 -*- | ||
|
||
""" | ||
This Document is Created by At 2018/7/9 | ||
""" | ||
|
||
from core.blockchain.block import Block | ||
|
||
if __name__ == '__main__': | ||
b = Block() | ||
|
||
b.new_block("Magic", "") | ||
|
||
block = b.block | ||
|
||
new_block = b.new_block("This is a test block", b.block["Hash"]) | ||
|
||
assert new_block["PrevBlockHash"] == block["Hash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
""" | ||
|
||
maxNonce = 1 << 63 - 1 | ||
targetBits = 16 |