Package: pystratis
pystratisPython package for interacting with Stratis (STRAX) full node and Cirrus/Interflux sidechain.InstallationFrom the Python Package Index (PyPi)pip install pystratisMost recent (from GitHub)pip install git+https://github.com/stratisproject/pystratis.gitInstall from PyPi with test dependenciespip install pystratis[test]TutorialsNode and network basicsUsing Pystratis.coreWallet basicsSending a transactionSmart contract basicsSending a CrossChain TransactionColdStakingBasic examplesCreate a walletfrompystratis.nodesimportStraxNodenode=StraxNode()# Back up the mnemonic phrase, that's the only thing that could restore your wallet.mnemonic=node.wallet.create(name='MyWallet',password='qwerty12345',passphrase='')Send fundsfrompystratis.nodesimportStraxNodefrompystratis.core.networksimportStraxMainfrompystratis.core.typesimportuint256,Money,Addressfrompystratis.coreimportOutpoint,Recipientnode=StraxNode()# Get first spendable transaction.s_tx=node.wallet.spendable_transactions(wallet_name='MyWallet').transactions[0]# Set our own address as recipient of change, use Money arithmetic for amount calculations.recipient_self=Recipient(destinationAddress=s_tx.address,amount=s_tx.amount-Money(1.0),subtraction_fee_from_amount=True)recipient_another=Recipient(destinationAddress=Address('<another address>',network=StraxMain()),amount=Money(1.0),subtractFeeFromAmount=False)# Spend utxo from our transaction.outpoint=Outpoint(transaction_id=s_tx.transaction_id,index=s_tx.index)built_transaction=node.wallet.build_transaction(wallet_name='MyWallet',password='qwerty12345',outpoints=[outpoint],recipients=[recipient_self,recipient_another],fee_type='high')node.wallet.send_transaction(built_transaction.hex)Testing guideUnit tests:pytest -m "not integration_test"Strax integration tests:pytest -m "strax_integration_test"Cirrus integration tests:pytest -m "cirrus_integration_test"Interflux integration tests:pytest -m "interflux_integration_test"Mainnet integration tests:pytest -m "mainnet_test"Integration tests:pytest -m "integration_test"Everything:pytestCoverage:coverage run -m pytestCoverage report:coverage report -mReadTheDocs documentationReadTheDocs API documentation can be found athttp://pystratis.readthedocs.io.Documentation can be build locally with the following commands:cd doc_build
make htmlOther output options:make helpAfter building, documentation formake htmlcan be found indocs/html/index.html, open with your favorite browser.CreditThanks goes to@TjadenFroydafor his contributions in kickstarting this repository.ChangeLogVersion 1.1.2.1Fixed dependenciesVersion 1.1.2.0Adopted new declarative configuration script (pyproject.toml)Version 1.1.1.0 (StratisFullNode release/1.1.1.0)Added voting/polls/expired/whitelist and voting/polls/expired/members endpointsUpdated voting/polls/tip response modelFixes for calling RPC through apiVersion 1.1.0.1 (StratisFullNode release/1.1.0.13)Added externalapi route and endpointsAdded blockstore/getutxosetforaddress endpointAdded voting/schedulevote-kickmember and voting/polls/tip endpointsAdded node/rewind and node/datafolder/chain endpointsAdded federationgateway/transfer and federationgateway/transfers/deletesuspended endpointsAdded multiple interop endpoints, removed interop/status endpointAdded federation/federationatheight and federation/mineratheight endpointsVersion 1.0.6.0 (StratisFullNode release/1.0.9.6)SignalR added to cirrusminernodeVersion 1.0.5.0 (StratisFullNode release/1.0.9.5)Added 'retrieve-filtered-utxos' endpoint for coldstakingVersion 1.0.4.0 (StratisFullNode release/1.0.9.4)No API updates for SFN release/1.0.9.4Version 1.0.3.0 (StratisFullNode release/1.0.9.3)No API updates for SFN release/1.0.9.3Version 1.0.2.0 (StratisFullNode release/1.0.9.2)Add optional block_height to LocalCallContractTransactionRequestAdded new node definition (cirrusunity3dnode) with unity3d endpointsVersion 1.0.1.0 (StratisFullNode release/1.0.9.1)Updates for SFN release/1.0.9.1Note: wallet.history strax integration test fails due to negative fee returned when address specified.Added contract_swagger and dynamic_contract endpointsVersion 1.0.0.7 (StratisFullNode release/1.0.9.0)Initial pystratis release