I’m proposing an improvement to the way we distinguish between production and test environments. The spec identifies currency id 2 as Test MSC. Some transactions (e.g. for creating smart properties) also have an ecosystem field (1 for tradable within Mastercoin ecosystem, 2 for Test MSC).
The values in the currency id and ecosystem fields can conflict with each other, such that the intention is not clear, e.g. currency id 2 (Test MSC) with ecosystem 1 (MSC ecosystem) and vice versa.
I propose that we simplify this and eliminate the potential for conflict by making the following changes:
- do away with Test MSC as currency id 2 in new transactions
- remove the ecosystem field from transaction messages
- apply a flag to the transaction message to indicate that it applies to the production environment or another environment (e.g. test)
- this can be done with the high order bit in the version field (0 = production, 1 = test), or if we want to support more than 2 environments, we could use the whole high order byte of the version field or just 2 or 3 high order bits)
This change makes sense because it will associate the environment with the transaction as opposed to being implied by the data in the transaction. It separates the transaction data from environment identification. The client will process transactions and maintain a transaction history and balance for each (environment, address, currency id) tuple. Transactions in each environment will be isolated from transactions in other environments.
To maintain backward compatibility, Test MSC used in existing transactions will be processed into the new test environment data structure. New test transactions will not use TMSC as such (because they won’t exist), but rather MSC in transactions in the test environment. These will be called TMSC.
Applications will let the user select the environment, on a transaction-by-transaction basis if desired. Users do this now by choosing the particular currency (MSC/TMSC) to transact with. Presentation of MSC in the production and test environments can remain as it is now.
This change also makes it easy for new currency id's to be processed in a test environment - without having to create a shadow test currency.
This new approach will work in any bitcoin network (mainnet, testnet, regtest). And, it's now easy for a client to have separate transaction definitions for test and production. I expect this will be particularly useful when bug fixes are being implemented. The existing, production, version of a transaction can remain untouched, while the candidate transaction code can be included and tested without disrupting production. The developer/tester just has to set the application to use the test environment when exercising the candidate transaction code. Everything else will function as it did.
We should make this change ASAP to eliminate any design/development involving the ecosystem field and to reduce the amount of rework to accommodate this upgrade.