February 2019
Intermediate to advanced
450 pages
9h 59m
English
Let's create our models file in decentralized_videos/videos/models.py. Most logic and heavy operations happen here. Calling a smart contract's methods and storing files into IPFS also happen here. Refer to the code file at the following GitLab link for the full code: https://gitlab.com/arjunaskykok/hands-on-blockchain-for-python-developers/blob/master/chapter_12/decentralized_videos/videos/models.py:
import os.path, jsonimport ipfsapiimport cv2from web3 import Web3, IPCProviderfrom populus.utils.wait import wait_for_transaction_receiptfrom decentralized_videos.settings import STATICFILES_DIRS, STATIC_URL, BASE_DIR, MEDIA_ROOTclass VideosSharing:...... txn_hash = self.w3.personal.sendTransaction(txn, password) wait_for_transaction_receipt(self.w3, ...
Read now
Unlock full access