Update Readme and Gitignore
This commit is contained in:
parent
34198f7313
commit
11c5ff96a3
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,5 @@ build/
|
||||
dist/
|
||||
.github/
|
||||
pybtc.egg-info/
|
||||
*.pyc
|
||||
|
||||
|
||||
73
README.md
73
README.md
@ -1,26 +1,11 @@
|
||||
<img src="docs/img/pybtc.png" width="100">
|
||||
|
||||
## Python bitcoin library
|
||||
|
||||
Current version is 2.0
|
||||
|
||||
|
||||
### Feature Support
|
||||
|
||||
* Basic functions
|
||||
* Supports addresses types PUBKEY, P2PKH, P2SH, P2SH-PWPKH, P2WPKH, P2WSH.
|
||||
* Supports BIP32(Hierarchical Deterministic Wallets), BIP39(Mnemonic code generation)
|
||||
* Supports BIP141(Segregated Witness)
|
||||
* Transaction constructor
|
||||
|
||||
## Python bitcoin library modified for FLO
|
||||
|
||||
### Installation
|
||||
To install pyflo,
|
||||
|
||||
To install pybtc, simply use pip
|
||||
|
||||
$ git clone https://github.com/bitaps-com/pybtc
|
||||
$ cd pybtc
|
||||
$ python3 setup.py install
|
||||
$ git clone https://github.com/ranchimall/pyflo
|
||||
$ cd pyflo
|
||||
$ sudo python3 setup.py install
|
||||
|
||||
### Dependencies
|
||||
|
||||
@ -28,22 +13,48 @@ To install pybtc, simply use pip
|
||||
* secp256k1
|
||||
|
||||
|
||||
### Documentation
|
||||
#### Message signing and verification
|
||||
|
||||
Documentation is available at https://pybtc.readthedocs.io
|
||||
Every message sent to the Blockchain is in hash format, and not in plain string. So we convert the message we are signing into a SHA256 hash before.
|
||||
|
||||
```
|
||||
>>> import pyflo
|
||||
|
||||
### How to Contribute
|
||||
# ADDRESS GENERATION
|
||||
>>> a = pyflo.Address(address_type="P2PKH")
|
||||
>>> a.address
|
||||
'FTP7LL7QjhgKfqYX1pis18bCqEpZaGSRzZ'
|
||||
>>> a.private_key.wif
|
||||
'R8Gw2Mr3n2fY1ydB2X5gEehxHkdhboeUD6yw4wRtVKHaqAd9gdkK'
|
||||
>>> a.private_key.hex
|
||||
'16b6aca5ff6a3bf3a1332dd4edf87880b2883cb4fe16effd073e2e866aa141aa'
|
||||
>>> a.public_key.hex
|
||||
'033c30b269e2d5df229f3f0ce294b19c4f0a3a8d12280415ce41e7bd3784a619c4'
|
||||
|
||||
In order to make a clone of the GitHub repo: open the link and press the “Fork” button on the upper-right menu of the web page.
|
||||
# CONVERT MESSAGE INTO SHA-256 HASH
|
||||
>>> pyflo.sha256(b'vivek'.hex())
|
||||
b'\xa3\xdas\x97e\x01\x81,\xd7\xb8!\xa2\x0b\xfb\t\xaf\nj\x89\x1eA\x9c\xdf\xb7a\xfb\x19\xa9,\x91BB'
|
||||
>>> pyflo.sha256(b'vivek'.hex()).hex()
|
||||
'a3da73976501812cd7b821a20bfb09af0a6a891e419cdfb761fb19a92c914242'
|
||||
>>> msg = b'vivek'.hex()
|
||||
>>> msg_hash_hex = pyflo.sha256(msg).hex()
|
||||
>>> msg_hash_bytes = pyflo.sha256(msg)
|
||||
>>> msg
|
||||
'766976656b'
|
||||
>>> msg_hash_hex
|
||||
'a3da73976501812cd7b821a20bfb09af0a6a891e419cdfb761fb19a92c914242'
|
||||
>>> msg_hash_bytes
|
||||
b'\xa3\xdas\x97e\x01\x81,\xd7\xb8!\xa2\x0b\xfb\t\xaf\nj\x89\x1eA\x9c\xdf\xb7a\xfb\x19\xa9,\x91BB'
|
||||
|
||||
Workflow is pretty straightforward:
|
||||
# SIGN AND VERIFY THE MESSAGE
|
||||
>>> sig_msg_hex = pyflo.sign_message(msg_hash_hex, a.private_key.wif)
|
||||
>>> pyflo.verify_signature(sig_msg_hex, a.public_key.hex, msg_hash_hex)
|
||||
True
|
||||
|
||||
1. Clone the GitHub
|
||||
2. Make a change
|
||||
3. Make sure all tests passed
|
||||
4. Add a record into file into change.log.
|
||||
5. Commit changes to own pybtc clone
|
||||
6. Make pull request from github page for your clone against master branch
|
||||
# SIGN AND VERIFY MESSAGE IN STANDARD OPERATION
|
||||
sig_msg_hex = pyflo.sign_message_standard_ops('vivek', a.private_key.wif)
|
||||
|
||||
# To verify the above signature, run the following in the console of any Standard Ops app
|
||||
floCrypto.verifySign('vivek', sig_msg_hex, a.public_key.hex)
|
||||
|
||||
```
|
||||
@ -1,20 +0,0 @@
|
||||
import pyflo
|
||||
|
||||
# pk = pybtc.create_private_key()
|
||||
# print("pk = " + pk)
|
||||
# pk = "RCJ9Q6kH5ywdRhchVKrxPUFiJE7cGMKFEB8n9zd4VgdNVYzHNedz"
|
||||
|
||||
|
||||
# a = pybtc.sign_message_tanishk("hey", pk, hex=True)
|
||||
# print(a)
|
||||
# b = pybtc.verify_signature(a, public, "6865790D0A")
|
||||
# print(b)
|
||||
# pybtc.test_function()
|
||||
msg = "hey"
|
||||
pk = "RCJ9Q6kH5ywdRhchVKrxPUFiJE7cGMKFEB8n9zd4VgdNVYzHNedz"
|
||||
public = pyflo.private_to_public_key(pk)
|
||||
print("public = " + public)
|
||||
sig = '30460221008b30bdc5039264abb40b686b1bdb9db0900e0b6c50dea793c0c1b1bde654119a022100b51e25bc73c274a5f3cd8bcdb11143921a2b1595c3b62f1cffcbe3bc5e876b65'
|
||||
sig = pyflo.sign_message(msg, pk)
|
||||
print(sig)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user