Closed mwherman2000 closed 5 years ago
I don't think there will ever be a case to run a smart contract off-chain, can you give examples?
Onchain is limiting very much what can be executed so why limit yourself for offchain execution. Also is there a need to have determinisem in offchian scenarious?
Basically off chain IMO just means typical programs we normally use C# for.
My specific goal isn't to be able to run an "as is" SC offchain but rather have significant data management components (e.g. entity serialization) be able to be used on-chain and off-chain supporting different persistence providers (e.g. Stratis SC on-chain storage, NEO SC on-chain storage, #DIYDLT on-chain storage, SQL Server or mysql off-chain storage, JSON files, SharePoint lists, Salesforce custom objects, etc.)
My enterprise distributed applications model looks like this (conceptual architecture)....
That being said, the test harness for the SSC Visual Studio template is pretty interesting. I've already created a version of it that persists all of the SSC storage operations to JSON ...why not also support a SQL Server back end? ...or Salesforce?
Smart Data = Entities wrapped in code ....on-chain or off-chain.
Here's another use case: To remove support for selected SSC-specific blacklisted data types from my cross-platform data management code.
Closing as we're of the view that preprocessor directives would add unnecessary complexity to contract development and we have no plans to support them.
That said, it's easy for anyone to modify the CSharpParseOptions
passed to the syntax tree parser and add their own preprocessor directives if they desire.
Add the ability to conditionally compile code (e.g. fields and/or methods) based on whether the C# code is targeting the onchain Stratis SmartContract framework or the code is to be used offchain.
...for example, structs/fields/methods for onchain and offchain data management to support an onchain-offchain symmetric programming and data management model.
Reference: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-if#examples
CC: @codingupastorm