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?

1 Answer 1


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 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.