the channel, running here
this is payment-channel's c compiled to webassembly: channel.c, txcheck.c, envelope.c and koinu's crypto, linked against libsecp256k1. the keys are generated in your tab, the signatures are real ecdsa, and the transactions are serialized by the code that produces the ones the daemon broadcasts. the javascript decides what to call and computes nothing.
loading the wasm module…
pay bob as many times as you like. each one is a complete transaction alice signs and bob verifies and countersigns, and none of them go anywhere. only the last one needs to be broadcast, which is what settle does, so a thousand payments still cost one transaction and one fee.
the three refusals are the reason bob can accept a payment without trusting
alice. a replayed payment is caught by claimed <= paid_to_bob in
pc_payment_accept, which is the whole of the ratchet: bob keeps the
highest payment he has seen and nothing earlier displaces it. a transaction that
pays five while claiming thirty is caught by pc_tx_verify_payment,
which reads the outputs out of the raw bytes rather than believing the message
that carried them. and a payment past the capacity cannot be built at all,
because the capacity came out of the funding transaction bob parsed himself.
what the page cannot do is reach a chain, and that is the point. the funding
transaction is built locally the way test/mkfunding builds it, a
real serialization over a dummy input, so the txid and the sighash are computed
over real bytes. whether it was ever mined is exactly what
--confirm-cmd exists to ask, and no amount of browser code answers
it. a merchant needs a peer that will tell him an output is buried and unspent
inside three seconds, without handing him the whole chain, and
no node on dogecoin mainnet serves the filters that make that
cheap.
the same calls run outside any browser, if you would rather not take the page's word for it:
git clone https://github.com/xanimo/blockfilters cd blockfilters && node build/smoke.js
it prints the channel address, the funding outpoint, three countersigned
transactions with their byte lengths, a replayed payment being refused and the
refund. build.sh rebuilds the wasm from a payment-channel checkout
if you would rather not trust the committed binary.