Does --tx --send of AssetDefinition have to be done only after there is at least one Confirmation of the Contract Offer? Or can it be done as soon as the ContractOffer finished its build --tx --send?
After the smart contract has processed the ContractOffer it is safe, which should be about 2 seconds after the Contract Offer has been sent. You just need to ensure that the contract is created before the asset is attempted to be created.
Oh I was starting to think it did not matter in what order the ContractOffer and AssetDef were created.
So thanks for clearing that up. I may try doing it in the wrong order to see what error message I get.
But I believe sync has to run again before the AssetDef can be sent, so that will take about 15 minutes to wait for the first confirmation on BSV blockchain plus about 15 seconds or more for sync to find the new block. The only way to skip the 15 minutes I think is if spynode captured the txId of the ContractOffer and passes it on to the subsequent A1. But still there is the problem that sync will not see it and so the the Wallet balances will be stale when A1 tries to be processed.
Or will sync pull some recent tx info from spynode?
And I was also thinking there is still some confusion about the general conceptual business object model - it seems we have a .json for ContractOffer, and we have a .json for AssetDefinition, but we do not have a .json for the overall Contract and yet the Contract seems to be the root object. Instead we only have dev.env to describe the Contract. So I was thinking it would be clearer to have a contract.json which pulls out most of the fields from dev.env into contract.json except for the few env vars needed to startup up smartcontractd in a bare bones state with no contract properties established yet. And then a new command should be added to the CLI to initialize the contract properties by sending contract.json to smartcontractd to set the property values from contract.json. I don’t want business object conceptual properties in the .env files. I want them all in .json files. That is what I am thinking makes it clearer to understand what “business” objects we have in tokenized.
After sending ContractOffer, you should be able to just run
sync --nostop for a few seconds to pull in any mempool txs.
sync alone only processes confirmed txs.
You can run the
state command to get a full definition of the contract and assets. The contract.json just fills in the details you want. The actual definition is in the C2 response tx to your C1 request.