Package: planetmint-driver
Planetmint Python DriverFree software: AGPLv3Check ourDocumentationTable of ContentsPlanetmint Python DriverFeaturesInstallPlanetmint DocumentationUsageCompatibility MatrixLicenseCreditsFeaturesSupport for preparing, fulfilling, and sending transactions to a Planetmint
node.Retrieval of transactions by id.InstallThe instructions below were tested on Ubuntu 16.04 LTS. They should also work on other Linux distributions and on macOS. The driver might work on Windows as well, but we do not guarantee it. We recommend to set up (e.g. via Docker on Windows) an Ubuntu VM there.We recommend you use a virtual environment to install and update to the latest stable version usingpip(orpip3):pip install -U planetmint-driverThat will install the lateststablePlanetmint Python Driver. If you want to install an Alpha, Beta or RC version of the Python Driver, use something like:pip install -U planetmint_driver==0.11.1The above command will install version 0.11.1. You can find a list of all versions inthe release history page on PyPI.More information on how to install the driver can be found in theQuickstartPlanetmint DocumentationPlanetmint Server QuickstartThe Hitchhiker’s Guide to PlanetmintHTTP API ReferenceAll Planetmint DocumentationUsageExample: Create a divisible asset for Alice who issues 10 token to Bob so that he can use her Game Boy.
Afterwards Bob spends 3 of these tokens.If you want to send a transaction you need toDetermine the Planetmint Root URL.# import Planetmint and create an objectfromplanetmint_driverimportPlanetmintbdb_root_url='https://example.com:9984'bdb=Planetmint(bdb_root_url)# generate a keypairfromplanetmint_driver.cryptoimportgenerate_keypairalice,bob=generate_keypair(),generate_keypair()# create a digital asset for Alicegame_boy_token={'data':{'token_for':{'game_boy':{'serial_number':'LR35902'}},'description':'Time share token. Each token equals one hour of usage.',},}# prepare the transaction with the digital asset and issue 10 tokens for Bobprepared_token_tx=bdb.transactions.prepare(operation='CREATE',signers=alice.public_key,recipients=[([bob.public_key],10)],asset=game_boy_token)# fulfill and send the transactionfulfilled_token_tx=bdb.transactions.fulfill(prepared_token_tx,private_keys=alice.private_key)bdb.transactions.send_commit(fulfilled_token_tx)# Use the tokens# create the output and inout for the transactiontransfer_asset={'id':fulfilled_token_tx['id']}output_index=0output=fulfilled_token_tx['outputs'][output_index]transfer_input={'fulfillment':output['condition']['details'],'fulfills':{'output_index':output_index,'transaction_id':transfer_asset['id']},'owners_before':output['public_keys']}# prepare the transaction and use 3 tokensprepared_transfer_tx=bdb.transactions.prepare(operation='TRANSFER',asset=transfer_asset,inputs=transfer_input,recipients=[([alice.public_key],3),([bob.public_key],7)])# fulfill and send the transactionfulfilled_transfer_tx=bdb.transactions.fulfill(prepared_transfer_tx,private_keys=bob.private_key)sent_transfer_tx=bdb.transactions.send_commit(fulfilled_transfer_tx)Compatibility MatrixPlanetmint ServerPlanetmint Driver>= 2.0.0b70.6.2>= 2.0.0b70.6.1>= 2.0.0b70.6.0>= 2.0.0b50.5.3>= 2.0.0b50.5.2>= 2.0.0b50.5.1>= 2.0.0b10.5.0>= 2.0.0a30.5.0a4>= 2.0.0a20.5.0a2>= 2.0.0a10.5.0a1>= 1.0.00.4.x== 1.0.0rc10.3.x>= 0.9.10.2.x>= 0.8.2>= 0.1.3Although we do our best to keep the master branches in sync, there may be
occasional delays.Licenselicenses- open source & open contentCreditsThis package was initially created usingCookiecutterand theaudreyr/cookiecutter-pypackageproject template. Many Planetmint developers have contributed since then.