Certainly it is part of the same transaction. Let us adapt the example from the
Smart Property thread:
Definitionsprevious-txout 0: "smartcoin", standard send-to-pubkeyhash, nvalue==1
b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c,0
previous txout 1: normal transaction, standard send-to-pubkeyhash, nvalue==100000
7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730,0
smartcoin seller
pubkey for to-be-sent smartcoin (CK)
pubkey destination for smartcoin payment (SK)
smartcoin required price (P): 100000
smartcoin buyer
pubkey for to-be-spent payment (PK)
pubkey destination for smartcoin (BK)
Round 1, smartcoin buyer and seller agree on a transactionPresumably the smartcoin seller has <somehow> advertised for sale smartcoin b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c,0 at price P.
Presumably, the buyer knows how to create a standard 2 txin, 2 txout format transaction that the seller expects.
The buyer and seller communicating this basic information is outside the scope of this discussion.
Round 2, smartcoin buyer creates incomplete TX, sends to sellertxin 0 (smartcoin transfer)
prevout (b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c, 0)
scriptSig = zero-length (null)
txin 1 (payment transfer)
prevout (7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730, 0)
scriptSig = <PK-derived signature> <PK>, SIGHASH_ALL
txout 0
nValue = 1
scriptPubKey = OP_DUP OP_HASH160 hash<BK> OP_EQUALVERIFY OP_CHECKSIG
txout 1
nValue = 100000
scriptPubKey = OP_DUP OP_HASH160 hash<SK> OP_EQUALVERIFY OP_CHECKSIG
Round 3, smartcoin seller signs TX, and broadcasts completed TX to networktxin 0 (smartcoin transfer)
prevout (b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c, 0)
scriptSig = <CK-derived signature> <CK>, SIGHASH_ALL
txin 1 (payment transfer)
prevout (7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730, 0)
scriptSig = <PK-derived signature> <PK>, SIGHASH_ALL
txout 0
nValue = 1
scriptPubKey = OP_DUP OP_HASH160 hash<BK> OP_EQUALVERIFY OP_CHECKSIG
txout 1
nValue = 100000
scriptPubKey = OP_DUP OP_HASH160 hash<SK> OP_EQUALVERIFY OP_CHECKSIG
DiscussionPotential attacks, neither resulting in a direct loss of value:
- Buyer may stall or refuse to send incomplete transaction (wasting seller's time and DoS'ing an issue, if the seller prevents other buyers from attempting purchases in parallel)
- Seller may stall or refuse to send completed transaction (wasting a buyer's time and leaving the fate of their coins unknown)