Python package for interacting with Stratis (STRAX) full node and Cirrus/Interflux sidechain.
pip install pystratis
pip install git+https://github.com/stratisproject/pystratis.git
pip install pystratis[test]
- Node and network basics
- Using Pystratis.core
- Wallet basics
- Sending a transaction
- Smart contract basics
- Sending a CrossChain Transaction
- ColdStaking
from pystratis.nodes import StraxNode
node = 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='')
from pystratis.nodes import StraxNode
from pystratis.core.networks import StraxMain
from pystratis.core.types import uint256, Money, Address
from pystratis.core import Outpoint, Recipient
node = 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)
- Unit 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:
pytest
- Coverage:
coverage run -m pytest
- Coverage report:
coverage report -m
ReadTheDocs API documentation can be found at http://pystratis.readthedocs.io.
Documentation can be build locally with the following commands:
cd doc_build
make html
- Other output options:
make help
- After building, documentation for
make html
can be found in docs/html/index.html, open with your favorite browser.
Thanks goes to @TjadenFroyda for his contributions in kickstarting this repository.
- Added externalapi route and endpoints
- Added blockstore/getutxosetforaddress endpoint
- Added voting/schedulevote-kickmember and voting/polls/tip endpoints
- Added node/rewind and node/datafolder/chain endpoints
- Added federationgateway/transfer and federationgateway/transfers/deletesuspended endpoints
- Added multiple interop endpoints, removed interop/status endpoint
- Added federation/federationatheight and federation/mineratheight endpoints
- SignalR added to cirrusminernode
- Added 'retrieve-filtered-utxos' endpoint for coldstaking
- Added optional block_height to LocalCallContractTransactionRequest (from 1.0.9.2 onwards)
- Added new node definition (cirrusunity3dnode) with unity3d endpoints
- No API updates for SFN release/1.0.9.3
- No API updates for SFN release/1.0.9.2
- Updates for SFN release/1.0.9.1
- Note: wallet.history strax integration test fails due to negative fee returned when address specified.
- Added contract_swagger and dynamic_contract endpoints
- Initial pystratis release