From 8de7532f84deca1ed2d88b48f9574618f238c151 Mon Sep 17 00:00:00 2001 From: master3000 Date: Wed, 16 Feb 2022 21:23:24 +0100 Subject: [PATCH 01/33] Create MsgCreateDataSource.py Python script to create a Data Source. --- pyband/msg/MsgCreateDataSource.py | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 pyband/msg/MsgCreateDataSource.py diff --git a/pyband/msg/MsgCreateDataSource.py b/pyband/msg/MsgCreateDataSource.py new file mode 100644 index 0000000..b854673 --- /dev/null +++ b/pyband/msg/MsgCreateDataSource.py @@ -0,0 +1,64 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin +from pyband.proto.oracle.v1.tx_pb2 import MsgCreateDataSource +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi1.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgCreateDataSource( + sender=sender, + owner="Band Address of the Owner", + treasury="Band Address of the Treasury", + name="Name of the Data Source", + description="Description of the Data Source", + fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band + executable= b'Paste your Code (Executable) in here\n', #the b'\n' converts your code into Byte + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From 92802ec68c508f1d8bbf4687e1701d14ba871d02 Mon Sep 17 00:00:00 2001 From: master3000 Date: Wed, 16 Feb 2022 22:27:35 +0100 Subject: [PATCH 02/33] Create MsgEditDataSource.py --- pyband/msg/MsgEditDataSource.py | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 pyband/msg/MsgEditDataSource.py diff --git a/pyband/msg/MsgEditDataSource.py b/pyband/msg/MsgEditDataSource.py new file mode 100644 index 0000000..cf3101d --- /dev/null +++ b/pyband/msg/MsgEditDataSource.py @@ -0,0 +1,68 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin +from pyband.proto.oracle.v1.tx_pb2 import MsgEditDataSource +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgEditDataSource( + data_source_id="Data Source ID from your existing Data Source without Brackets", + sender=sender, + #now you can change your existingData Source completely + owner="Band Address of the Owner", + treasury="Band Address of the Treasury", + name="Name of the Data Source", + description="Description of the Data Source", + fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band + executable= b'Paste your Code (Executable) in here\n', #the b'\n' converts your code into Byte + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + fee = [Coin(amount="10000", denom="uband")] + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_fee(fee) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From a6bb3cdb3fc4b95c8258bd806bf0393d0bd6b55d Mon Sep 17 00:00:00 2001 From: master3000 Date: Wed, 16 Feb 2022 22:37:20 +0100 Subject: [PATCH 03/33] MsgCreateDataSource.py --- pyband/msg/MsgCreateDataSource.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyband/msg/MsgCreateDataSource.py b/pyband/msg/MsgCreateDataSource.py index b854673..bde4f45 100644 --- a/pyband/msg/MsgCreateDataSource.py +++ b/pyband/msg/MsgCreateDataSource.py @@ -26,12 +26,12 @@ def main(): # Step 3 send_msg = MsgCreateDataSource( sender=sender, - owner="Band Address of the Owner", - treasury="Band Address of the Treasury", - name="Name of the Data Source", - description="Description of the Data Source", + owner = "Band Address of the Owner", + treasury = "Band Address of the Treasury", + name = "Name of the Data Source", + description = "Description of the Data Source", fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band - executable= b'Paste your Code (Executable) in here\n', #the b'\n' converts your code into Byte + executable = b' Paste your Code (Executable) in here \n', #the b'\n' converts your code into []Byte ) account = c.get_account(sender) From e7074cd2ad10e0c54985a18bac93eb1a87d6aa96 Mon Sep 17 00:00:00 2001 From: master3000 Date: Wed, 16 Feb 2022 22:37:39 +0100 Subject: [PATCH 04/33] MsgEditDataSource.py --- pyband/msg/MsgEditDataSource.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyband/msg/MsgEditDataSource.py b/pyband/msg/MsgEditDataSource.py index cf3101d..7a0e54f 100644 --- a/pyband/msg/MsgEditDataSource.py +++ b/pyband/msg/MsgEditDataSource.py @@ -25,15 +25,15 @@ def main(): # Step 3 send_msg = MsgEditDataSource( - data_source_id="Data Source ID from your existing Data Source without Brackets", + data_source_id="Data Source ID from your existing Data Source without Brackets (int)", sender=sender, #now you can change your existingData Source completely - owner="Band Address of the Owner", - treasury="Band Address of the Treasury", - name="Name of the Data Source", - description="Description of the Data Source", + owner = "Band Address of the Owner", + treasury = "Band Address of the Treasury", + name = "Name of the Data Source", + description = "Description of the Data Source", fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band - executable= b'Paste your Code (Executable) in here\n', #the b'\n' converts your code into Byte + executable = b' Paste your Code (Executable) in here \n', #the b'\n' converts your code into Byte ) account = c.get_account(sender) From b02626ae9a17f1602b87e72bc5bc3e26a0ecfd19 Mon Sep 17 00:00:00 2001 From: master3000 Date: Wed, 16 Feb 2022 22:49:54 +0100 Subject: [PATCH 05/33] MsgCreateOracleScript.py --- pyband/msg/MsgCreateOracleScript.py | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pyband/msg/MsgCreateOracleScript.py diff --git a/pyband/msg/MsgCreateOracleScript.py b/pyband/msg/MsgCreateOracleScript.py new file mode 100644 index 0000000..b82e153 --- /dev/null +++ b/pyband/msg/MsgCreateOracleScript.py @@ -0,0 +1,63 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.oracle.v1.tx_pb2 import MsgCreateOracleScript +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgCreateOracleScript( + sender=sender, + owner = "Band Address of the Owner", + name = "Name of the Oracle Script", + description = "Description of the Oracle Script", + code = b' The Owasm-compiled binary attached to this Oracle Script \n', #the b'\n' converts your code into Byte + schema= "The schema detailing the inputs and outputs of this Oracle Script, as well as the corresponding types", + source_code_url="Url of the Source Code", + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From 789ab5d9adbbe5a15d90a40be43592f13df2a438 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 21:43:38 +0100 Subject: [PATCH 06/33] .\MsgEditOracleScript.py --- pyband/msg/MsgEditOracleScript.py | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 pyband/msg/MsgEditOracleScript.py diff --git a/pyband/msg/MsgEditOracleScript.py b/pyband/msg/MsgEditOracleScript.py new file mode 100644 index 0000000..09102c1 --- /dev/null +++ b/pyband/msg/MsgEditOracleScript.py @@ -0,0 +1,64 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.oracle.v1.tx_pb2 import MsgEditOracleScript +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgEditOracleScript( + oracle_script_id="Oracle Script ID from your existing Data Source without Brackets (int)", + sender=sender, + owner = "Band Address of the Owner", + name = "Name of the Oracle Script", + description = "Description of the Oracle Script", + code = b' The Owasm-compiled binary attached to this Oracle Script \n', #the b'\n' converts your code into Byte + schema= "The schema detailing the inputs and outputs of this Oracle Script, as well as the corresponding types", + source_code_url="Url of the Source Code", + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From 40fd0b0334db6dc7f77438452ac5db3c152eb643 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 21:46:33 +0100 Subject: [PATCH 07/33] MsgEditOracleScript.py --- pyband/msg/MsgEditOracleScript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg/MsgEditOracleScript.py b/pyband/msg/MsgEditOracleScript.py index 09102c1..e5c433a 100644 --- a/pyband/msg/MsgEditOracleScript.py +++ b/pyband/msg/MsgEditOracleScript.py @@ -20,7 +20,7 @@ def main(): private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") public_key = private_key.to_public_key() sender_addr = public_key.to_address() - sender = sender_addr.to_acc_bech32() + sender = sender_addr.to_acc_bech32( # Step 3 send_msg = MsgEditOracleScript( From d9c71478da874517a30c1d5afb5c459ad9820c38 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 21:47:20 +0100 Subject: [PATCH 08/33] MsgEditOracleScript.py --- pyband/msg/MsgEditOracleScript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg/MsgEditOracleScript.py b/pyband/msg/MsgEditOracleScript.py index e5c433a..09102c1 100644 --- a/pyband/msg/MsgEditOracleScript.py +++ b/pyband/msg/MsgEditOracleScript.py @@ -20,7 +20,7 @@ def main(): private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") public_key = private_key.to_public_key() sender_addr = public_key.to_address() - sender = sender_addr.to_acc_bech32( + sender = sender_addr.to_acc_bech32() # Step 3 send_msg = MsgEditOracleScript( From 1592a31d969894d0e2f1c1915ae57cba73de5375 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:05:01 +0100 Subject: [PATCH 09/33] MsgRequestData.py --- pyband/msg/MsgRequestData.py | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pyband/msg/MsgRequestData.py diff --git a/pyband/msg/MsgRequestData.py b/pyband/msg/MsgRequestData.py new file mode 100644 index 0000000..ffff006 --- /dev/null +++ b/pyband/msg/MsgRequestData.py @@ -0,0 +1,65 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin +from pyband.proto.oracle.v1.tx_pb2 import MsgRequestData +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgRequestData( + oracle_script_id = "Oracle Script ID from any existing Oracle you wish to get Data from without Brackets (int)", + sender = sender, + calldata = "The data passed over to the oracle script for the script to use during its execution (string)", + ask_count = "Number of validators requested to answer the request without Brackets (int)", + min_count = "The minimum number of validators necessary for the request to proceed to the execution phase without Brackets (int)", + client_id = "The unique identifier of this oracle request, as specified by the client. This same unique ID will be sent back to the requester with the oracle response (string)", + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + fee = [Coin(amount="10000", denom="uband")] + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_fee(fee) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From 63b730ebed203bde1abd7dd08eb5dcad92de5fba Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:10:18 +0100 Subject: [PATCH 10/33] Msg Readme.md --- pyband/msg/Readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 pyband/msg/Readme.md diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md new file mode 100644 index 0000000..f14e850 --- /dev/null +++ b/pyband/msg/Readme.md @@ -0,0 +1,9 @@ +Band Protocol pyband MSG Scripts + +1. MsgRequestData.py to Request Data + +2. MsgCreateDataSource.py to create a new Data Source +3. MsgEditDataSource.py to edit a existing Data Source + +4. MsgCreateOracleScript.py to create a new Oracle Script +5. MsgEditOracleScript.py to edit a existing Oracle Script \ No newline at end of file From 6b7db020dffa62305bf3d0771673de46b55c5d56 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:13:49 +0100 Subject: [PATCH 11/33] Msg Readme.md --- pyband/msg/Readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index f14e850..0e34ca0 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -6,4 +6,7 @@ Band Protocol pyband MSG Scripts 3. MsgEditDataSource.py to edit a existing Data Source 4. MsgCreateOracleScript.py to create a new Oracle Script -5. MsgEditOracleScript.py to edit a existing Oracle Script \ No newline at end of file +5. MsgEditOracleScript.py to edit a existing Oracle Script + +If you have any questions: https://docs.bandchain.org/whitepaper/protocol-messages.html + https://docs.bandchain.org/ \ No newline at end of file From 7a11373d36714b026f3b7ebf05592f4c5ce60954 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:14:38 +0100 Subject: [PATCH 12/33] Msg Readme.md --- pyband/msg/Readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index 0e34ca0..02f5e24 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -8,5 +8,4 @@ Band Protocol pyband MSG Scripts 4. MsgCreateOracleScript.py to create a new Oracle Script 5. MsgEditOracleScript.py to edit a existing Oracle Script -If you have any questions: https://docs.bandchain.org/whitepaper/protocol-messages.html - https://docs.bandchain.org/ \ No newline at end of file +If you have any questions: https://docs.bandchain.org/whitepaper/protocol-messages.html and https://docs.bandchain.org/ \ No newline at end of file From 4ce5dcda27ea21587cd2f512fa1d07b29c124465 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:15:15 +0100 Subject: [PATCH 13/33] Msg Readme.md --- pyband/msg/Readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index 02f5e24..c7cc3fc 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -8,4 +8,7 @@ Band Protocol pyband MSG Scripts 4. MsgCreateOracleScript.py to create a new Oracle Script 5. MsgEditOracleScript.py to edit a existing Oracle Script -If you have any questions: https://docs.bandchain.org/whitepaper/protocol-messages.html and https://docs.bandchain.org/ \ No newline at end of file + +If you have any questions: +https://docs.bandchain.org/whitepaper/protocol-messages.html +https://docs.bandchain.org/ \ No newline at end of file From d60081ca5e0850d2750029aaee37deb082672db3 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:15:38 +0100 Subject: [PATCH 14/33] Msg Readme.md --- pyband/msg/Readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index c7cc3fc..7b1d768 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -10,5 +10,7 @@ Band Protocol pyband MSG Scripts If you have any questions: + https://docs.bandchain.org/whitepaper/protocol-messages.html + https://docs.bandchain.org/ \ No newline at end of file From 22b0499ddbcf9fe953579271f98350e091e8a6a7 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:16:34 +0100 Subject: [PATCH 15/33] Msg Readme.md --- pyband/msg/Readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index 7b1d768..be4bd0c 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -9,6 +9,7 @@ Band Protocol pyband MSG Scripts 5. MsgEditOracleScript.py to edit a existing Oracle Script + If you have any questions: https://docs.bandchain.org/whitepaper/protocol-messages.html From 20b5233429f3c9922e98c5ef449e295a0a5bb0aa Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:17:14 +0100 Subject: [PATCH 16/33] Msg Readme.md --- pyband/msg/Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index be4bd0c..6f5b18f 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -12,6 +12,6 @@ Band Protocol pyband MSG Scripts If you have any questions: -https://docs.bandchain.org/whitepaper/protocol-messages.html +https://docs.bandchain.org/ -https://docs.bandchain.org/ \ No newline at end of file +https://docs.bandchain.org/whitepaper/protocol-messages.html \ No newline at end of file From f407226efd968203426f96cea41812622874bcc7 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:17:45 +0100 Subject: [PATCH 17/33] Msg Readme.md --- pyband/msg/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index 6f5b18f..a542be6 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -10,7 +10,7 @@ Band Protocol pyband MSG Scripts -If you have any questions: +For questions: https://docs.bandchain.org/ From 7ba22f5a2e82071ff6db7a4a7ec5fc1433439699 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:18:02 +0100 Subject: [PATCH 18/33] Msg Readme.md --- pyband/msg/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index a542be6..6f5b18f 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -10,7 +10,7 @@ Band Protocol pyband MSG Scripts -For questions: +If you have any questions: https://docs.bandchain.org/ From 5cdd854cbd732fa17d408c19999692868de56fc9 Mon Sep 17 00:00:00 2001 From: SurpriseMF3000 <99681009+SurpriseMF3000@users.noreply.github.com> Date: Thu, 17 Feb 2022 22:19:58 +0100 Subject: [PATCH 19/33] Delete Readme.md --- pyband/msg/Readme.md | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 pyband/msg/Readme.md diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md deleted file mode 100644 index 6f5b18f..0000000 --- a/pyband/msg/Readme.md +++ /dev/null @@ -1,17 +0,0 @@ -Band Protocol pyband MSG Scripts - -1. MsgRequestData.py to Request Data - -2. MsgCreateDataSource.py to create a new Data Source -3. MsgEditDataSource.py to edit a existing Data Source - -4. MsgCreateOracleScript.py to create a new Oracle Script -5. MsgEditOracleScript.py to edit a existing Oracle Script - - - -If you have any questions: - -https://docs.bandchain.org/ - -https://docs.bandchain.org/whitepaper/protocol-messages.html \ No newline at end of file From 91562551050355e2aa126c9835edac97d91c813f Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:34:00 +0100 Subject: [PATCH 20/33] Update Readme.md --- pyband/msg/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg/Readme.md b/pyband/msg/Readme.md index 6f5b18f..750cc02 100644 --- a/pyband/msg/Readme.md +++ b/pyband/msg/Readme.md @@ -14,4 +14,4 @@ If you have any questions: https://docs.bandchain.org/ -https://docs.bandchain.org/whitepaper/protocol-messages.html \ No newline at end of file +https://docs.bandchain.org/whitepaper/protocol-messages.htm \ No newline at end of file From 65c5f5028cc92efc7f656fc9b73a8d6d75bb1640 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:36:30 +0100 Subject: [PATCH 21/33] Msg README.md --- pyband/msg/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pyband/msg/README.md diff --git a/pyband/msg/README.md b/pyband/msg/README.md new file mode 100644 index 0000000..6f5b18f --- /dev/null +++ b/pyband/msg/README.md @@ -0,0 +1,17 @@ +Band Protocol pyband MSG Scripts + +1. MsgRequestData.py to Request Data + +2. MsgCreateDataSource.py to create a new Data Source +3. MsgEditDataSource.py to edit a existing Data Source + +4. MsgCreateOracleScript.py to create a new Oracle Script +5. MsgEditOracleScript.py to edit a existing Oracle Script + + + +If you have any questions: + +https://docs.bandchain.org/ + +https://docs.bandchain.org/whitepaper/protocol-messages.html \ No newline at end of file From f3a3c389df644035998d37b1b0ea649a1bef2d72 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:39:20 +0100 Subject: [PATCH 22/33] MsgEditDataSource.py --- pyband/msg/MsgEditDataSource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg/MsgEditDataSource.py b/pyband/msg/MsgEditDataSource.py index 7a0e54f..27f7642 100644 --- a/pyband/msg/MsgEditDataSource.py +++ b/pyband/msg/MsgEditDataSource.py @@ -25,7 +25,7 @@ def main(): # Step 3 send_msg = MsgEditDataSource( - data_source_id="Data Source ID from your existing Data Source without Brackets (int)", + data_source_id="Data Source ID from your existing Data Source without Quotation Marks (int)", sender=sender, #now you can change your existingData Source completely owner = "Band Address of the Owner", From 26f97ca6a8e3264bc795064184960b5ef630a9a9 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:40:43 +0100 Subject: [PATCH 23/33] MsgEditOracleScript.py --- pyband/msg/MsgEditOracleScript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg/MsgEditOracleScript.py b/pyband/msg/MsgEditOracleScript.py index 09102c1..11ae7ce 100644 --- a/pyband/msg/MsgEditOracleScript.py +++ b/pyband/msg/MsgEditOracleScript.py @@ -24,7 +24,7 @@ def main(): # Step 3 send_msg = MsgEditOracleScript( - oracle_script_id="Oracle Script ID from your existing Data Source without Brackets (int)", + oracle_script_id="Oracle Script ID from your existing Data Source without Quotation Marks (int)", sender=sender, owner = "Band Address of the Owner", name = "Name of the Oracle Script", From 975a4d35904633edd656facded07674c51ae4ae1 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:41:21 +0100 Subject: [PATCH 24/33] MsgRequestData.py --- pyband/msg/MsgRequestData.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyband/msg/MsgRequestData.py b/pyband/msg/MsgRequestData.py index ffff006..cdba954 100644 --- a/pyband/msg/MsgRequestData.py +++ b/pyband/msg/MsgRequestData.py @@ -25,11 +25,11 @@ def main(): # Step 3 send_msg = MsgRequestData( - oracle_script_id = "Oracle Script ID from any existing Oracle you wish to get Data from without Brackets (int)", + oracle_script_id = "Oracle Script ID from any existing Oracle you wish to get Data from without Quotation Marks (int)", sender = sender, calldata = "The data passed over to the oracle script for the script to use during its execution (string)", - ask_count = "Number of validators requested to answer the request without Brackets (int)", - min_count = "The minimum number of validators necessary for the request to proceed to the execution phase without Brackets (int)", + ask_count = "Number of validators requested to answer the request without Quotation Marks (int)", + min_count = "The minimum number of validators necessary for the request to proceed to the execution phase without Quotation Marks (int)", client_id = "The unique identifier of this oracle request, as specified by the client. This same unique ID will be sent back to the requester with the oracle response (string)", ) From e7fee959467326212eb1ab1aec05f3b2c46be1e3 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:46:11 +0100 Subject: [PATCH 25/33] Delete old scripts --- pyband/msg/MsgCreateDataSource.py | 64 --------------------------- pyband/msg/MsgCreateOracleScript.py | 63 -------------------------- pyband/msg/MsgEditDataSource.py | 68 ----------------------------- pyband/msg/MsgEditOracleScript.py | 64 --------------------------- pyband/msg/MsgRequestData.py | 65 --------------------------- pyband/msg/README.md | 17 -------- 6 files changed, 341 deletions(-) delete mode 100644 pyband/msg/MsgCreateDataSource.py delete mode 100644 pyband/msg/MsgCreateOracleScript.py delete mode 100644 pyband/msg/MsgEditDataSource.py delete mode 100644 pyband/msg/MsgEditOracleScript.py delete mode 100644 pyband/msg/MsgRequestData.py delete mode 100644 pyband/msg/README.md diff --git a/pyband/msg/MsgCreateDataSource.py b/pyband/msg/MsgCreateDataSource.py deleted file mode 100644 index bde4f45..0000000 --- a/pyband/msg/MsgCreateDataSource.py +++ /dev/null @@ -1,64 +0,0 @@ -import os - -from pyband.client import Client -from pyband.transaction import Transaction -from pyband.wallet import PrivateKey - -from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin -from pyband.proto.oracle.v1.tx_pb2 import MsgCreateDataSource -from google.protobuf.json_format import MessageToJson - -def main(): - # Step 1 - #Choose GRPC - #Laozi Mainnet: laozi1.bandchain.org - #Laozi Testnet: laozi-testnet4.bandchain.org - grpc_url = "laozi1.bandchain.org" - c = Client(grpc_url) - - # Step 2 - #DO NOT SHARE YOUR mnemonic!!! - private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") - public_key = private_key.to_public_key() - sender_addr = public_key.to_address() - sender = sender_addr.to_acc_bech32() - - # Step 3 - send_msg = MsgCreateDataSource( - sender=sender, - owner = "Band Address of the Owner", - treasury = "Band Address of the Treasury", - name = "Name of the Data Source", - description = "Description of the Data Source", - fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band - executable = b' Paste your Code (Executable) in here \n', #the b'\n' converts your code into []Byte - ) - - account = c.get_account(sender) - account_num = account.account_number - sequence = account.sequence - - chain_id = c.get_chain_id() - - # Step 4 - txn = ( - Transaction() - .with_messages(send_msg) - .with_sequence(sequence) - .with_account_num(account_num) - .with_chain_id(chain_id) - .with_gas(2000000) - .with_memo("") - ) - - # Step 5 - sign_doc = txn.get_sign_doc(public_key) - signature = private_key.sign(sign_doc.SerializeToString()) - tx_raw_bytes = txn.get_tx_data(signature, public_key) - - # Step 6 - tx_block = c.send_tx_block_mode(tx_raw_bytes) - print(MessageToJson(tx_block)) - -if __name__ == "__main__": - main() diff --git a/pyband/msg/MsgCreateOracleScript.py b/pyband/msg/MsgCreateOracleScript.py deleted file mode 100644 index b82e153..0000000 --- a/pyband/msg/MsgCreateOracleScript.py +++ /dev/null @@ -1,63 +0,0 @@ -import os - -from pyband.client import Client -from pyband.transaction import Transaction -from pyband.wallet import PrivateKey - -from pyband.proto.oracle.v1.tx_pb2 import MsgCreateOracleScript -from google.protobuf.json_format import MessageToJson - -def main(): - # Step 1 - #Choose GRPC - #Laozi Mainnet: laozi1.bandchain.org - #Laozi Testnet: laozi-testnet4.bandchain.org - grpc_url = "laozi-testnet4.bandchain.org" - c = Client(grpc_url) - - # Step 2 - #DO NOT SHARE YOUR mnemonic!!! - private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") - public_key = private_key.to_public_key() - sender_addr = public_key.to_address() - sender = sender_addr.to_acc_bech32() - - # Step 3 - send_msg = MsgCreateOracleScript( - sender=sender, - owner = "Band Address of the Owner", - name = "Name of the Oracle Script", - description = "Description of the Oracle Script", - code = b' The Owasm-compiled binary attached to this Oracle Script \n', #the b'\n' converts your code into Byte - schema= "The schema detailing the inputs and outputs of this Oracle Script, as well as the corresponding types", - source_code_url="Url of the Source Code", - ) - - account = c.get_account(sender) - account_num = account.account_number - sequence = account.sequence - - chain_id = c.get_chain_id() - - # Step 4 - txn = ( - Transaction() - .with_messages(send_msg) - .with_sequence(sequence) - .with_account_num(account_num) - .with_chain_id(chain_id) - .with_gas(2000000) - .with_memo("") - ) - - # Step 5 - sign_doc = txn.get_sign_doc(public_key) - signature = private_key.sign(sign_doc.SerializeToString()) - tx_raw_bytes = txn.get_tx_data(signature, public_key) - - # Step 6 - tx_block = c.send_tx_block_mode(tx_raw_bytes) - print(MessageToJson(tx_block)) - -if __name__ == "__main__": - main() diff --git a/pyband/msg/MsgEditDataSource.py b/pyband/msg/MsgEditDataSource.py deleted file mode 100644 index 27f7642..0000000 --- a/pyband/msg/MsgEditDataSource.py +++ /dev/null @@ -1,68 +0,0 @@ -import os - -from pyband.client import Client -from pyband.transaction import Transaction -from pyband.wallet import PrivateKey - -from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin -from pyband.proto.oracle.v1.tx_pb2 import MsgEditDataSource -from google.protobuf.json_format import MessageToJson - -def main(): - # Step 1 - #Choose GRPC - #Laozi Mainnet: laozi1.bandchain.org - #Laozi Testnet: laozi-testnet4.bandchain.org - grpc_url = "laozi-testnet4.bandchain.org" - c = Client(grpc_url) - - # Step 2 - #DO NOT SHARE YOUR mnemonic!!! - private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") - public_key = private_key.to_public_key() - sender_addr = public_key.to_address() - sender = sender_addr.to_acc_bech32() - - # Step 3 - send_msg = MsgEditDataSource( - data_source_id="Data Source ID from your existing Data Source without Quotation Marks (int)", - sender=sender, - #now you can change your existingData Source completely - owner = "Band Address of the Owner", - treasury = "Band Address of the Treasury", - name = "Name of the Data Source", - description = "Description of the Data Source", - fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band - executable = b' Paste your Code (Executable) in here \n', #the b'\n' converts your code into Byte - ) - - account = c.get_account(sender) - account_num = account.account_number - sequence = account.sequence - - fee = [Coin(amount="10000", denom="uband")] - chain_id = c.get_chain_id() - - # Step 4 - txn = ( - Transaction() - .with_messages(send_msg) - .with_sequence(sequence) - .with_account_num(account_num) - .with_chain_id(chain_id) - .with_gas(2000000) - .with_fee(fee) - .with_memo("") - ) - - # Step 5 - sign_doc = txn.get_sign_doc(public_key) - signature = private_key.sign(sign_doc.SerializeToString()) - tx_raw_bytes = txn.get_tx_data(signature, public_key) - - # Step 6 - tx_block = c.send_tx_block_mode(tx_raw_bytes) - print(MessageToJson(tx_block)) - -if __name__ == "__main__": - main() diff --git a/pyband/msg/MsgEditOracleScript.py b/pyband/msg/MsgEditOracleScript.py deleted file mode 100644 index 11ae7ce..0000000 --- a/pyband/msg/MsgEditOracleScript.py +++ /dev/null @@ -1,64 +0,0 @@ -import os - -from pyband.client import Client -from pyband.transaction import Transaction -from pyband.wallet import PrivateKey - -from pyband.proto.oracle.v1.tx_pb2 import MsgEditOracleScript -from google.protobuf.json_format import MessageToJson - -def main(): - # Step 1 - #Choose GRPC - #Laozi Mainnet: laozi1.bandchain.org - #Laozi Testnet: laozi-testnet4.bandchain.org - grpc_url = "laozi-testnet4.bandchain.org" - c = Client(grpc_url) - - # Step 2 - #DO NOT SHARE YOUR mnemonic!!! - private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") - public_key = private_key.to_public_key() - sender_addr = public_key.to_address() - sender = sender_addr.to_acc_bech32() - - # Step 3 - send_msg = MsgEditOracleScript( - oracle_script_id="Oracle Script ID from your existing Data Source without Quotation Marks (int)", - sender=sender, - owner = "Band Address of the Owner", - name = "Name of the Oracle Script", - description = "Description of the Oracle Script", - code = b' The Owasm-compiled binary attached to this Oracle Script \n', #the b'\n' converts your code into Byte - schema= "The schema detailing the inputs and outputs of this Oracle Script, as well as the corresponding types", - source_code_url="Url of the Source Code", - ) - - account = c.get_account(sender) - account_num = account.account_number - sequence = account.sequence - - chain_id = c.get_chain_id() - - # Step 4 - txn = ( - Transaction() - .with_messages(send_msg) - .with_sequence(sequence) - .with_account_num(account_num) - .with_chain_id(chain_id) - .with_gas(2000000) - .with_memo("") - ) - - # Step 5 - sign_doc = txn.get_sign_doc(public_key) - signature = private_key.sign(sign_doc.SerializeToString()) - tx_raw_bytes = txn.get_tx_data(signature, public_key) - - # Step 6 - tx_block = c.send_tx_block_mode(tx_raw_bytes) - print(MessageToJson(tx_block)) - -if __name__ == "__main__": - main() diff --git a/pyband/msg/MsgRequestData.py b/pyband/msg/MsgRequestData.py deleted file mode 100644 index cdba954..0000000 --- a/pyband/msg/MsgRequestData.py +++ /dev/null @@ -1,65 +0,0 @@ -import os - -from pyband.client import Client -from pyband.transaction import Transaction -from pyband.wallet import PrivateKey - -from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin -from pyband.proto.oracle.v1.tx_pb2 import MsgRequestData -from google.protobuf.json_format import MessageToJson - -def main(): - # Step 1 - #Choose GRPC - #Laozi Mainnet: laozi1.bandchain.org - #Laozi Testnet: laozi-testnet4.bandchain.org - grpc_url = "laozi-testnet4.bandchain.org" - c = Client(grpc_url) - - # Step 2 - #DO NOT SHARE YOUR mnemonic!!! - private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") - public_key = private_key.to_public_key() - sender_addr = public_key.to_address() - sender = sender_addr.to_acc_bech32() - - # Step 3 - send_msg = MsgRequestData( - oracle_script_id = "Oracle Script ID from any existing Oracle you wish to get Data from without Quotation Marks (int)", - sender = sender, - calldata = "The data passed over to the oracle script for the script to use during its execution (string)", - ask_count = "Number of validators requested to answer the request without Quotation Marks (int)", - min_count = "The minimum number of validators necessary for the request to proceed to the execution phase without Quotation Marks (int)", - client_id = "The unique identifier of this oracle request, as specified by the client. This same unique ID will be sent back to the requester with the oracle response (string)", - ) - - account = c.get_account(sender) - account_num = account.account_number - sequence = account.sequence - - fee = [Coin(amount="10000", denom="uband")] - chain_id = c.get_chain_id() - - # Step 4 - txn = ( - Transaction() - .with_messages(send_msg) - .with_sequence(sequence) - .with_account_num(account_num) - .with_chain_id(chain_id) - .with_gas(2000000) - .with_fee(fee) - .with_memo("") - ) - - # Step 5 - sign_doc = txn.get_sign_doc(public_key) - signature = private_key.sign(sign_doc.SerializeToString()) - tx_raw_bytes = txn.get_tx_data(signature, public_key) - - # Step 6 - tx_block = c.send_tx_block_mode(tx_raw_bytes) - print(MessageToJson(tx_block)) - -if __name__ == "__main__": - main() diff --git a/pyband/msg/README.md b/pyband/msg/README.md deleted file mode 100644 index 6f5b18f..0000000 --- a/pyband/msg/README.md +++ /dev/null @@ -1,17 +0,0 @@ -Band Protocol pyband MSG Scripts - -1. MsgRequestData.py to Request Data - -2. MsgCreateDataSource.py to create a new Data Source -3. MsgEditDataSource.py to edit a existing Data Source - -4. MsgCreateOracleScript.py to create a new Oracle Script -5. MsgEditOracleScript.py to edit a existing Oracle Script - - - -If you have any questions: - -https://docs.bandchain.org/ - -https://docs.bandchain.org/whitepaper/protocol-messages.html \ No newline at end of file From 53412bdbc897486a37b152d116d965ee1cb3ba80 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:47:27 +0100 Subject: [PATCH 26/33] MsgCreateDataSource,py --- pyband/msg scripts/MsgCreateDataSource.py | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 pyband/msg scripts/MsgCreateDataSource.py diff --git a/pyband/msg scripts/MsgCreateDataSource.py b/pyband/msg scripts/MsgCreateDataSource.py new file mode 100644 index 0000000..bde4f45 --- /dev/null +++ b/pyband/msg scripts/MsgCreateDataSource.py @@ -0,0 +1,64 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin +from pyband.proto.oracle.v1.tx_pb2 import MsgCreateDataSource +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi1.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgCreateDataSource( + sender=sender, + owner = "Band Address of the Owner", + treasury = "Band Address of the Treasury", + name = "Name of the Data Source", + description = "Description of the Data Source", + fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band + executable = b' Paste your Code (Executable) in here \n', #the b'\n' converts your code into []Byte + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From 1d954e4149120db7fbb6a05644e7b5fd79255e07 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:47:49 +0100 Subject: [PATCH 27/33] MsgCreateOracleScript.py --- pyband/msg scripts/MsgCreateOracleScript.py | 63 +++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pyband/msg scripts/MsgCreateOracleScript.py diff --git a/pyband/msg scripts/MsgCreateOracleScript.py b/pyband/msg scripts/MsgCreateOracleScript.py new file mode 100644 index 0000000..b82e153 --- /dev/null +++ b/pyband/msg scripts/MsgCreateOracleScript.py @@ -0,0 +1,63 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.oracle.v1.tx_pb2 import MsgCreateOracleScript +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgCreateOracleScript( + sender=sender, + owner = "Band Address of the Owner", + name = "Name of the Oracle Script", + description = "Description of the Oracle Script", + code = b' The Owasm-compiled binary attached to this Oracle Script \n', #the b'\n' converts your code into Byte + schema= "The schema detailing the inputs and outputs of this Oracle Script, as well as the corresponding types", + source_code_url="Url of the Source Code", + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From ff25383e97778111af17bd2b43af0866e4da9691 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:48:08 +0100 Subject: [PATCH 28/33] MsgEditDataSource.py --- pyband/msg scripts/MsgEditDataSource.py | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 pyband/msg scripts/MsgEditDataSource.py diff --git a/pyband/msg scripts/MsgEditDataSource.py b/pyband/msg scripts/MsgEditDataSource.py new file mode 100644 index 0000000..27f7642 --- /dev/null +++ b/pyband/msg scripts/MsgEditDataSource.py @@ -0,0 +1,68 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin +from pyband.proto.oracle.v1.tx_pb2 import MsgEditDataSource +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgEditDataSource( + data_source_id="Data Source ID from your existing Data Source without Quotation Marks (int)", + sender=sender, + #now you can change your existingData Source completely + owner = "Band Address of the Owner", + treasury = "Band Address of the Treasury", + name = "Name of the Data Source", + description = "Description of the Data Source", + fee = [Coin(amount="Fee per single request", denom="uband")], #1000000 Uband is one Band + executable = b' Paste your Code (Executable) in here \n', #the b'\n' converts your code into Byte + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + fee = [Coin(amount="10000", denom="uband")] + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_fee(fee) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From 2960b54082ca3946adf1b92f964f6f54ca35ca04 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:48:24 +0100 Subject: [PATCH 29/33] MsgEditOracleScript.py --- pyband/msg scripts/MsgEditOracleScript.py | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 pyband/msg scripts/MsgEditOracleScript.py diff --git a/pyband/msg scripts/MsgEditOracleScript.py b/pyband/msg scripts/MsgEditOracleScript.py new file mode 100644 index 0000000..11ae7ce --- /dev/null +++ b/pyband/msg scripts/MsgEditOracleScript.py @@ -0,0 +1,64 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.oracle.v1.tx_pb2 import MsgEditOracleScript +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgEditOracleScript( + oracle_script_id="Oracle Script ID from your existing Data Source without Quotation Marks (int)", + sender=sender, + owner = "Band Address of the Owner", + name = "Name of the Oracle Script", + description = "Description of the Oracle Script", + code = b' The Owasm-compiled binary attached to this Oracle Script \n', #the b'\n' converts your code into Byte + schema= "The schema detailing the inputs and outputs of this Oracle Script, as well as the corresponding types", + source_code_url="Url of the Source Code", + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From fbdbd85ac9d860c946bf74e02cffad84f1634aaf Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:48:36 +0100 Subject: [PATCH 30/33] MsgRequestData.py --- pyband/msg scripts/MsgRequestData.py | 65 ++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pyband/msg scripts/MsgRequestData.py diff --git a/pyband/msg scripts/MsgRequestData.py b/pyband/msg scripts/MsgRequestData.py new file mode 100644 index 0000000..cdba954 --- /dev/null +++ b/pyband/msg scripts/MsgRequestData.py @@ -0,0 +1,65 @@ +import os + +from pyband.client import Client +from pyband.transaction import Transaction +from pyband.wallet import PrivateKey + +from pyband.proto.cosmos.base.v1beta1.coin_pb2 import Coin +from pyband.proto.oracle.v1.tx_pb2 import MsgRequestData +from google.protobuf.json_format import MessageToJson + +def main(): + # Step 1 + #Choose GRPC + #Laozi Mainnet: laozi1.bandchain.org + #Laozi Testnet: laozi-testnet4.bandchain.org + grpc_url = "laozi-testnet4.bandchain.org" + c = Client(grpc_url) + + # Step 2 + #DO NOT SHARE YOUR mnemonic!!! + private_key = PrivateKey.from_mnemonic("Enter your mnemonic (Seed Phrases)") + public_key = private_key.to_public_key() + sender_addr = public_key.to_address() + sender = sender_addr.to_acc_bech32() + + # Step 3 + send_msg = MsgRequestData( + oracle_script_id = "Oracle Script ID from any existing Oracle you wish to get Data from without Quotation Marks (int)", + sender = sender, + calldata = "The data passed over to the oracle script for the script to use during its execution (string)", + ask_count = "Number of validators requested to answer the request without Quotation Marks (int)", + min_count = "The minimum number of validators necessary for the request to proceed to the execution phase without Quotation Marks (int)", + client_id = "The unique identifier of this oracle request, as specified by the client. This same unique ID will be sent back to the requester with the oracle response (string)", + ) + + account = c.get_account(sender) + account_num = account.account_number + sequence = account.sequence + + fee = [Coin(amount="10000", denom="uband")] + chain_id = c.get_chain_id() + + # Step 4 + txn = ( + Transaction() + .with_messages(send_msg) + .with_sequence(sequence) + .with_account_num(account_num) + .with_chain_id(chain_id) + .with_gas(2000000) + .with_fee(fee) + .with_memo("") + ) + + # Step 5 + sign_doc = txn.get_sign_doc(public_key) + signature = private_key.sign(sign_doc.SerializeToString()) + tx_raw_bytes = txn.get_tx_data(signature, public_key) + + # Step 6 + tx_block = c.send_tx_block_mode(tx_raw_bytes) + print(MessageToJson(tx_block)) + +if __name__ == "__main__": + main() From 06acc17e98d3dc764b620e0de9be3f5d6ca6cb7f Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:48:47 +0100 Subject: [PATCH 31/33] README.md --- pyband/msg scripts/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pyband/msg scripts/README.md diff --git a/pyband/msg scripts/README.md b/pyband/msg scripts/README.md new file mode 100644 index 0000000..6f5b18f --- /dev/null +++ b/pyband/msg scripts/README.md @@ -0,0 +1,17 @@ +Band Protocol pyband MSG Scripts + +1. MsgRequestData.py to Request Data + +2. MsgCreateDataSource.py to create a new Data Source +3. MsgEditDataSource.py to edit a existing Data Source + +4. MsgCreateOracleScript.py to create a new Oracle Script +5. MsgEditOracleScript.py to edit a existing Oracle Script + + + +If you have any questions: + +https://docs.bandchain.org/ + +https://docs.bandchain.org/whitepaper/protocol-messages.html \ No newline at end of file From 8ce5a65270e4b276afceaffcc25bfba83a67031f Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 22:57:46 +0100 Subject: [PATCH 32/33] README.md --- pyband/msg scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyband/msg scripts/README.md b/pyband/msg scripts/README.md index 6f5b18f..9866e07 100644 --- a/pyband/msg scripts/README.md +++ b/pyband/msg scripts/README.md @@ -1,4 +1,4 @@ -Band Protocol pyband MSG Scripts +Band Protocol pyband Msg Scripts 1. MsgRequestData.py to Request Data From 4138ddb18054bd0f4890161cb09e50329b7f0362 Mon Sep 17 00:00:00 2001 From: master3000 Date: Thu, 17 Feb 2022 23:01:05 +0100 Subject: [PATCH 33/33] README.md --- pyband/msg scripts/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyband/msg scripts/README.md b/pyband/msg scripts/README.md index 9866e07..4565e89 100644 --- a/pyband/msg scripts/README.md +++ b/pyband/msg scripts/README.md @@ -3,10 +3,10 @@ Band Protocol pyband Msg Scripts 1. MsgRequestData.py to Request Data 2. MsgCreateDataSource.py to create a new Data Source -3. MsgEditDataSource.py to edit a existing Data Source +3. MsgEditDataSource.py to edit an existing Data Source 4. MsgCreateOracleScript.py to create a new Oracle Script -5. MsgEditOracleScript.py to edit a existing Oracle Script +5. MsgEditOracleScript.py to edit an existing Oracle Script