user5303: Running cardano-cli query ledger-state --mainnet --out-file out produces a binary file.
What format is it in?
How can I decode it?
I cannot use the command without --out-file out because of memory limitations.
UPDATE
I tried:
pip install cbor2
cat ledger-state.cbor | python -m cbor2.tool --pretty > ledger-state.json

which gave me:
[
    320,
    {
        "\u0000\u0000\u00006\\xd5\u0015\\xe1.\u0018\\xcd<\\x88\\xc7O\t\\xa6y\\x84\\xc2\\xc2y\\xa5)j\\xa9n\\xfe\\x89": 58,
        "\u0000\u0000\u0000\\xf6n(\\xb0\\xf1\\x8a\\xef U_LIT#N2p߻\\xdc\\xc1?T\\xe7\\x99": 57,
[...]
    }
]

which does not seem to be decoded properly.

user5926: Pretty sure the binary format is CBOR and yes, the ledger state is HUGE.
I think that if you drop the --out-file command line option the output goes to stdout in JSON format but again the output on mainnet is so huge that for me cardano-cli is killed by the OOM killer on a machine with 16G of RAM.
Using the command you use, the output file is 1.4 Gigabytes (much more compact than the in-memory representation).
There is already a Github issue about that which is almost a year old.

user4651: If you're looking to create a readable snapshot of the Cardano ledger as of a given slot, might I suggest using ogmios.dev as a simpler solution.  Ogmios allows one to read the entire state of the ledger via the chain sync mini-protocol.  The ledger is exposed as a websocket api, reducing integration complexity.

5303: <p>Running <code>cardano-cli query ledger-state --mainnet --out-file out</code> produces a binary file.
What format is it in?
How can I decode it?
I cannot use the command without <code>--out-file out</code> because of memory limitations.</p>
<p>UPDATE</p>
<p>I tried:</p>
<pre><code>pip install cbor2
cat ledger-state.cbor | python -m cbor2.tool --pretty &gt; ledger-state.json
</code></pre>
<p>which gave me:</p>
<pre><code>[
    320,
    {
        &quot;\u0000\u0000\u00006\\xd5\u0015\\xe1.\u0018\\xcd&lt;\\x88\\xc7O\t\\xa6y\\x84\\xc2\\xc2y\\xa5)j\\xa9n\\xfe\\x89&quot;: 58,
        &quot;\u0000\u0000\u0000\\xf6n(\\xb0\\xf1\\x8a\\xef U_LIT#N2p߻\\xdc\\xc1?T\\xe7\\x99&quot;: 57,
[...]
    }
]
</code></pre>
<p>which does not seem to be decoded properly.</p>
 5926: <p>Pretty sure the binary format is <a href="https://cbor.io/" rel="nofollow noreferrer">CBOR</a> and yes, the ledger state is <strong>HUGE</strong>.</p>
<p>I think that if you drop the <code>--out-file</code> command line option the output goes to stdout in JSON format but again the output on <code>mainnet</code> is so huge that for me <code>cardano-cli</code> is killed by the OOM killer on a machine with 16G of RAM.</p>
<p>Using the command you use, the output file is 1.4 Gigabytes (much more compact than the in-memory representation).</p>
<p>There is already a <a href="https://github.com/input-output-hk/cardano-node/issues/2461" rel="nofollow noreferrer">Github issue</a> about that which is almost a year old.</p>
 4651: <p>If you're looking to create a readable snapshot of the Cardano ledger as of a given slot, might I suggest using ogmios.dev as a simpler solution.  Ogmios allows one to read the entire state of the ledger via the chain sync mini-protocol.  The ledger is exposed as a websocket api, reducing integration complexity.</p>
