1

I have a small seed for testing using the Python API, linking to a local CarrIOTA node. The seed has only one used address.

If I run get_account_data(), the balance shows as 0 since I haven't reattached any transactions yet.

With get_inputs(start=0, stop=1,threshold=0), I can see the Address and totalBalance that I want to reattach, but how can I find the transaction info so I can use attach_to_tangle?

get_balances(address) gives me the address, balance, a reference (which seems to be the same for all addresses), the current milestoneIndex, and 'milestone'=None. and find_transactions(address) returns an empty hash.

Helmar
  • 1,293
  • 1
  • 15
  • 28

2 Answers2

1

Following from the light wallet:

https://github.com/iotaledger/wallet/blob/4a50e49c15c76ec57793614eafaa2edf54352927/ui/js/ui.addresses.js#L55 https://github.com/iotaledger/wallet/blob/4a50e49c15c76ec57793614eafaa2edf54352927/ui/js/ui.addresses.js#L77

and the cli-wallet (line 41): https://github.com/iotaledger/cli-app/blob/master/lib/commands/address.js

it seems that when you press generate address, get_new_addresses is called, and then a 0 value transfer is sent from the address to itself while you are waiting for "attaching to tangle"

I ran:

print(api.get_account_data()['balance'])
adds = api.get_new_addresses(0,1)['addresses']

print(api.send_transfer(
  depth = 3,
  transfers = [
    ProposedTransaction(
      address = Address(adds[0],),
      value = 0,
    ),
  ],
)
print(api.get_account_data()['balance'])

which returned:

0
{u'bundle': <iota.transaction.base.Bundle object at 0xXXXXX>}
1

Additionally, get_transfers(0,1) now shows a bundle!

0

If your transaction confirmed, there is no need to reattach it after the snapshot.

If it did not confirm, you'd have to create a new transaction.

Anyway all transactions are "gone" now, so if you did not store the trytes before the snapshot, there is no way to reattach them now via API.

mihi
  • 7,324
  • 2
  • 15
  • 34
  • Is there an API equivalent to the generate address/attach process that you have to do manually using a light wallet? How does the light wallet grab the pre-snapshot balances?

    The transaction confirmed and was available well before the snapshot.

    – topological-donut Jan 30 '18 at 21:04
  • In: https://github.com/iotaledger/wallet/blob/4a50e49c15c76ec57793614eafaa2edf54352927/ui/js/ui.addresses.js#L55

    https://github.com/iotaledger/wallet/blob/4a50e49c15c76ec57793614eafaa2edf54352927/ui/js/ui.addresses.js#L77

    It seems that the wallet sends a 0 value transaction to itself and then shows "attaching to tangle". I wander whether this would work, but I would rather not lose the balance completely

    – topological-donut Jan 30 '18 at 21:17
  • yes, that works. Just send 0 value transactions to all your addresses and the wallet will see the balance again. The balance is still there for other tools to use even without reattaching. – mihi Jan 30 '18 at 22:02