Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit 5b16f2b

Browse files
authored
Merge pull request #58 from johngrantuk/issue31
Attempt at Issue #31.
2 parents 46d6725 + e1cc21d commit 5b16f2b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

examples/send_transfer.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# coding=utf-8
2+
"""
3+
Example script that shows how to use PyOTA to send a transfer to an address.
4+
"""
5+
from iota import *
6+
7+
8+
# Create the API instance.
9+
api =\
10+
Iota(
11+
# URI of a locally running node.
12+
'http://localhost:14265/',
13+
14+
# Seed used for cryptographic functions.
15+
seed = b'SEED9GOES9HERE'
16+
)
17+
18+
# For more information, see :py:meth:`Iota.send_transfer`.
19+
api.send_transfer(
20+
depth = 100,
21+
22+
# One or more :py:class:`ProposedTransaction` objects to add to the
23+
# bundle.
24+
transfers = [
25+
ProposedTransaction(
26+
# Recipient of the transfer.
27+
address =
28+
Address(
29+
b'TESTVALUE9DONTUSEINPRODUCTION99999FBFFTG'
30+
b'QFWEHEL9KCAFXBJBXGE9HID9XCOHFIDABHDG9AHDR'
31+
),
32+
33+
# Amount of IOTA to transfer.
34+
# This value may be zero.
35+
value = 1,
36+
37+
# Optional tag to attach to the transfer.
38+
tag = Tag(b'EXAMPLE'),
39+
40+
# Optional message to include with the transfer.
41+
message = TryteString.from_string('Hello!'),
42+
),
43+
],
44+
)

0 commit comments

Comments
 (0)