Proof of work gated transactions
Purpose of this post
I want to see whether or not the community would be interested in something like this. If so, Charthouse Labs will post a more complete RFC with a proper spec.
Background
Spam transaction are an especially difficult issue to deal with on a network with low transaction fees. In particular if an app is sponsoring transactions there is always the possibility of griefing attacks draining sponsorship fees.
Proposal
Gate access to sponsored transactions via a set of capability tokens held by a predicate that requires a PoW proof to be calculated to be considered a valid transaction. A PoW proof requires that transactions have a computation cost, deters spam, but allows users to complete transactions.
Basic mechanism suggestion
POW predicate
A predicate that holds capability UTXOs. These UTXO can be released for a transaction given the following criteria.
- Accompanying any transaction a proof of work is included that uses the txId + a user selected salt that result in a hash with a difficulty level number of leading zero bits.
- That the capability coin is returned to the predicate after transaction completion
Capability minting contract
A contract that mints capability coins to the predicate.
PoW gated sponsorship
Protocols that would like to gate sponsorship behind PoW would create their own predicate that only released the sponsored funds if the capability UTXO is included as a transaction input.
Suggested predicate structure
Configurable {
uint256 difficulty
}
main(uint16 saltWitnessIndex)
The salt is included in witness data as to not modify the txId of the transaction.
The salt is then concatenated to the txId and hashed within the predicate. If the hash has difficulty
number of leading zero bits and the tx returns the same number of capability tokens as are borrowed, the predicate resolves to true.
Drawbacks
- Time sensitive transactions are not appropriate for transactions that require client side proving
- Balancing difficulty to prevent spam and still have a positive user experience requires tuning