While reading about sweeping in the official documentation:


I see these initial variables:

const addresses = [

// Address metadata
// hashes represent any unresolved sweeps
const metadata = [
    {security: 2, keyIndex: 1, user: 'Chris', hashes: []},
    {security: 3, keyIndex: 2, user: 'Dom', hashes: ['']}

But what are hashes actually? Do I obtain those from another API or do I compute it somehow? Why is one empty array while another one an array of empty string?

I assume that the empty array is a typo here, as the following code will always assume that hashes contains at least one element (either an empty string or a previous transaction hash). On the other hand it probably does not matter since both undefined and empty string are falsey in JavaScript.

The idea of the hashes variable is that you cache here the hash of the last transaction that swept that address. So when you sweep addresses and notice they have a balance, you can check the transaction hash whether it is alredy confirmed. If no, you should not sweep again (as the sweep is still pending), and if yes you should (after advising your user not to double spend to the same address) sweep the address again.

The hashes are filled in the snippet of the sending transfers section.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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