Skip to main content
Commonmark migration
Source Link

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.

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

Example

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(
        b'ADDRESS9GOES9HERE99999999999999999999999999999999999TESTVALUE9DONTUSEINPRODUCTION'
        ),

    # 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()

bundle.add_transaction(output)

prepared_bundle = api.prepare_transfer(bundle)

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.

#Example 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(
        b'ADDRESS9GOES9HERE99999999999999999999999999999999999TESTVALUE9DONTUSEINPRODUCTION'
        ),

    # 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()

bundle.add_transaction(output)

prepared_bundle = api.prepare_transfer(bundle)

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.

Example

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(
        b'ADDRESS9GOES9HERE99999999999999999999999999999999999TESTVALUE9DONTUSEINPRODUCTION'
        ),

    # 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()

bundle.add_transaction(output)

prepared_bundle = api.prepare_transfer(bundle)
Source Link
Zauz
  • 4.5k
  • 16
  • 42

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.

#Example 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(
        b'ADDRESS9GOES9HERE99999999999999999999999999999999999TESTVALUE9DONTUSEINPRODUCTION'
        ),

    # 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()

bundle.add_transaction(output)

prepared_bundle = api.prepare_transfer(bundle)