main.py 528 B

123456789101112131415161718192021
  1. from iroha import Iroha, IrohaCrypto, IrohaGrpc
  2. iroha = Iroha('alice@test')
  3. net = IrohaGrpc('127.0.0.1:50051')
  4. alice_key = IrohaCrypto.private_key()
  5. alice_tx = iroha.transaction(
  6. [iroha.command(
  7. 'TransferAsset',
  8. src_account_id='alice@test',
  9. dest_account_id='bob@test',
  10. asset_id='bitcoin#test',
  11. description='test',
  12. amount='1'
  13. )]
  14. )
  15. IrohaCrypto.sign_transaction(alice_tx, alice_key)
  16. net.send_tx(alice_tx)
  17. for status in net.tx_status_stream(alice_tx):
  18. print(status)