Module agora.flash.Scripts

Contains all the Flash-layer scripting support.

Functions

NameDescription
createClosingTx(utxo, outputs) Create a closing transaction which spends directly from the funding transactions. Collaborative nodes should prefer using a closing transaction when closing the channel, as it reduces the number of transactions they have to publish to the blockchain to just two: the funding and the closing transaction.
createFlashLock(age, first_utxo, pair_pk, seq_id, num_peers) Create a Flash lock script.
createFundingTx(utxo, utxo_hash, capacity, pair_pk, fee) Create a simple funding transaction which spends from the given UTXO and outputs it to a multisig key address from which either the trigger transaction or the closing transaction will spend from.
createLockHTLC(hash, lock_height, sender_pk, receiver_pk) Creates an HTLC with the given hash of the secret, the expected lock height, the sender public key, and the receiver public key.
createSettleTx(prev_utxo_hash, settle_age, outputs) Create a settlement transaction spending from a previous trigger / update transaction.
createUnlockHTLC(sig, secret, sig_hash) Creates an unlock for the HTLC generated with createLockHTLC.
createUnlockSettle(sig, seq_id, sig_hash) Create an unlock script for the settlement branch.
createUnlockUpdate(sig, seq_id) Create an unlock script for the update branch.
createUpdateTx(chan_conf, seq_id, prev_utxo_hash) Create an update / trigger transaction which spends from a previous trigger / update transaction. The output of the transaction can only be spent by either another update transaction, or a relative time-locked settlement transaction, based on the branching used when spending this update transaction.
genPrivateNonce() Generate a random pair of private nonces to be used for the settlement & update transactions.
getPublicNonce(priv_nonce) Derive the pair of public nonces from the given pair of privaten onces.
getSettlePk(origin, utxo, seq_id, num_peers) Derive the public key to be used for validating the settlement transaction. This routine is similar to getSettleScalar except it only works on public data - such as the counter-parties public keys.
getSettleScalar(origin, utxo, seq_id) Create the scalar to be used for signing the settlement transaction. The key is derived from the combination of the node's own private key and the funding transaction's UTXO, as well as the sequence ID.
getUpdatePk(origin, utxo, num_peers) Derive the public key to be used for validating the update transaction. This routine is similar to getUpdateScalar except it only works on public data - such as the counter-parties public keys.
getUpdateScalar(origin, utxo) Create the scalar to be used for signing the update transaction. The key is derived from the combination of the node's own private key and the funding transaction's UTXO.