The Initial Funding Transaction happens in Bitcoin and is linked to the Lightning Network.
Can an adversary figure out the initial channel balances by identifying the according Bitcoin Funding Transaction?
A funding transaction is one where some money is paid into a P2WSH transaction output, where the
redeeemScript is a 2-of-2 multisig between the two participants. No other information is provided.
Technically, even the
redeemScript for the funding is not revealed until the funding transaction output is spent (channel closed), which makes it less obvious that the unspent output is even a channel. Private channels are not known to be channels, and even when closed, are indistinguishable from any other kind of 2-of-2 multisig transaction.
For public channels, however, the
redeemScript can be recreated from information published over Lightning's gossip network, making it possible for network participants to discover which transactions are public channel funding transactions.
There is no information regarding balances. The single funding transaction output has an amount representing the entire channel capacity. This is all that is known to anybody but the two channel participants.
The way channel opening works is that both parties create asymmetric initial commitment transactions, which spend the funding transaction with their previously agreed upon balances. This happens before the initiator reveals or broadcasts the funding transaction. The initiator creates (but doesn't broadcast) the funding transaction and only transmits its transaction id and output index to the other party. This information is sufficient for both parties to create their initial commitments which spend it, and to sign those commitments, but not sufficient for the other party to broadcast the transaction and lock up the funds before the commitments have been agreed. Once both parties have signed, the initiator then broadcasts the funding transaction and the channel is considered opened after it reaches the minimum confirmation depth.
It may be possible to determine channel closing balances based on the transaction which spends the funding output.
How would the adversary know that your transaction is linked to the lightning network ? it can be toward a friend, an exchange or even stolen
When a Lightning channel is created or closed, it leaves a footprint on the Bitcoin blockchain. (Note that this footprint tells a third party very little about how you routed your payments while on the Lightning Network). These blockchain transactions can be analyzed just like a normal Bitcoin transaction can. Although by just looking at the Bitcoin blockchain it is not apparent which transactions are related to the Lightning Network, and which ones are not. Someone who wants to piece together spending patterns might have to combine multiple data points from different sets of information.
from https://medium.com/suredbits/lightning-network-101-privacy-245d98210ab which goes more in depth
Though not possible by the funding transaction, it could get figured out with 'multiple non-finalized payments' as described in the following paper: https://eprint.iacr.org/2019/328