The blockchain does not contain yet-to-be-published transactions to publish them based on conditions. The blockchain is the structure that transactions are published to. There is no such thing as a "pre-loaded transaction" that can be "released". Either
A (Alice) or
B (Bob) has to publish it.
What Alice can do is give Bob a pre-signed transaction that spends an output from a transaction from Bob that has not been published yet. This way, when Bob publishes his transaction, he can now publish the pre-signed transaction from Alice, but can't publish it beforehand. This requires more coordination that I believe you are looking for, but it's possible. It would go like this:
- Bob creates a transaction, B1, with an output to Alice, but does not sign nor publish it.
- Bob sends Alice B1, still unsigned.
- Alice uses the output on B1 as an input on her own transaction, A1. This transaction has an output that pays to Bob.
- Alice signs A1, but can't publish it because it spends the still unpublished B1. Instead, she sends the signed A1 to Bob.
- Alice can now go offline, as her part is complete.
- Bob, now in possession of a signed A1, signs and publishes B1 to the network.
- With B1 now published, A1 is now a valid transaction, and Bob publishes it as well.
Again, I don't think this is exactly what you are looking for, but I don't think what you are looking for is possible. Smart contracts generally require sending transactions back and forth before publishing to the blockchain. You really can't have a smart contract with someone with whom you've never communicated. The up-front communication is the contract part, and publishing to the blockchain is more like resolving the contract.