I am trying to construct a simple transaction: prepare_transfer should get as input transfers: Iterable[ProposedTransaction], and two other optional parameters.

How could one make an Iterable out of a ProposedTransaction object? Is there somewhere a simple working example of using this basic prepare_transfer function? Thanks

1 Answer 1


prepare_transfer needs an Iterable because IOTA transfers are bundles: A collection of input, output and 0-value transactions. An Iterable of ProposedTransactions is for example a ProposedBundle.


from iota import Iota, ProposedTransaction, ProposedBundle, Address, Tag, TryteString
api = Iota('http://yournode.net:14265',seed = b'SEED9GOES9HERE')

output = ProposedTransaction(
    # receiving address of the transfer
    address = Address(

    # Amount of Iota you want to send
    value = 1,

    # Optional Tag (27-trytes)
    tag = Tag(b'HELLO9WORLD'),

    # Message (2187-trytes)
    message = TryteString.from_string('Hello world!')

bundle = ProposedBundle()


prepared_bundle = api.prepare_transfer(bundle)
  • Using bundle as input to prepare_transfer indeed works, however according to the api (pyota.readthedocs.io/en/latest/api.html#prepare-transfer), I would have expected that ProposedTransaction would be ok, too.
    – Nir
    Commented Jan 15, 2018 at 15:54
  • 1
    I havent tried it, but just passing a list with ProposedTransactions like this: api.prepare_transfer([output]) will probably work as well.
    – Zauz
    Commented Jan 15, 2018 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.