This client allows to work with Profile Management EcoSystem (PMES):
-
set content in the blockchain
-
get content from the blockchain
-
buy and sell content
-
accept or reject propositions to sell content
-
view all content for the user or in the whole PMES
-
PMESClient
--- client module__init__
--- init class with server hosthelp
--- show all commands of the python clientgen_keys
--- generate public / private keys and write them to thekeys.json
fill_form
--- fill information about user such as email, phone number and device idcreate_account
--- create new user accountget_account_data
--- get account details about user accountget_data_from_blockchain
--- get content details from the blockchain by content identifier (cid
)post_data_to_blockchain
--- write content to the blockchainset_content_description
--- set content description (in progress)set_content_price
--- set content price (in progress)increment_balance
--- increment user balance (temporary solution. It will be done in other maner)make_offer_from_buyer_to_seller
--- make offer to buy content from the current user to sellermake_offer_from_buyer_to_seller_with_price
--- make offer to buy content with proposed price from the current user to selleraccept_offer_from_buyer
--- content owner can accept offer to buy content from buyerreject_offer_from_owner
--- content owner can reject offer to buy content from buyerreject_offer_from_buyer
--- buyer can reject his offer to buy contentnews
--- get the list of all news about offers that user received to sell his contentget_all_content
--- get all content in the whole PMESget_all_content_which_post_user
--- get all content which belongs to the user (if user sell rights to content it won't be displayed here)get_all_offers_which_made_user
--- get all active offers which made the user (if an offer will be finished with accepting or reject it won't be displayed here)get_all_offers_received_for_content_by_cid
--- get all active offers for some content identifier
-
cookies/account.json
--- contain user's data (email, phone number and device id) -
cookies/cookies.json
--- save hash and cid of stored content in PMES -
cookies/generated.json
--- set of public and private keys. Used for choosing default value for changing owner, selling content, etc. -
cookies/keys.json
--- contain user public and private keys
amount
, balance
, offer_price
, price
, buyer_price
and seller_price
represented as x * 10^8
. Where x
could be float
.
For checking status of transaction in the QTUM blockchain you could use the site https://testnet.qtum.org.
When the status of transaction changes from Unconfirmed
to Success
this means that your data was written to the blockchain.
Clone sources from git:
git clone https://github.com/Robin8Put/pmes_py_client.git
Create virtualenv and install needed libraries from the requirements.txt
:
cd balance
virtualenv --python=python3.6 venv
source venv/bin/activate
pip3 install -r requirements.txt
For running application run python3
and initialize PMESClient
. By default host is "http://127.0.0.1:8000".
from client import PMESClient
c = PMESClient()
Check commands present in this client:
c.help()
View all content descriptions:
c.get_all_content()
For posting your content to blockchain and sell it to other users create user account.
Firstly, generate public and private keys and fill account information such as email, device identificator and phone number:
c.gen_keys()
c.fill_form()
Secondly, create user account:
c.create_account()
Then, replenish the balance. Without money at your account you won't post a content.
c.increment_balance()
Check your balance:
c.get_account_data()
Now you can post data with description and price to blockchain.
Be careful the blockchain keeps your data forever and you won't have an opportunity to delete or change them.
c.post_data_to_blockchain()
For setting description or doing another staff get content identifier (cid). Data is posting to the blockchain via transaction.
When transaction will be approved (around 5-10 minutes) cid can be received by next command:
c.get_all_content_which_post_user()
For viewing details about content you could use following command:
c.get_data_from_blockchain()
So, now you and other clients could see your content after executing command:
c.get_all_content()
For buying someone's content run next command providing cid of the content:
c.make_offer_from_buyer_to_seller()
You could makes offer by specifying your price:
c.make_offer_from_buyer_to_seller_with_price()
When the seller makes a decision to accept or reject your offer you will be informed by email.
If you change your mind about making an offer you could reject it:
c.reject_offer_from_buyer()
If someone makes you offer to buy your content you'll be informed by email.
Also, you could check this by running next command:
c.news()
For accepting or rejecting offer use corresponding command:
c.accept_offer_from_buyer()
or
c.reject_offer_from_owner()
For checking all content, that you post use:
c.get_all_content_which_post_user()
For checking all offers, that you made use:
c.get_all_offers_which_made_user()
For checking all offers, that other users made for your contents use:
c.get_all_offers_received_for_content_by_cid()