Skip to content

Application Design Patterns

Smart Contract Data Model

We use smart contracts to store data on the blockchain. Many projects seek to represent a physical asset as a smart contract. The following is a generic example of the smart contract architecture that might be used to model a physical asset on a STRATO blockchain network.

  1. Physical Asset: This smart contract represents a physical asset and describes the basic functionality to allow the asset to be updated.
  2. Asset Model: This smart contract represents the finite state machine that is used to model the asset states, describes valid asset state transitions, and verifies that an asset transition being requested is valid.
  3. Asset Snapshot: This smart contract stores historical asset data for easy retrieval of the historical state of the asset.
  4. Asset Manager: This smart contract encapsulates all the business logic for operating on the asset, providing a separation between data and logic. This makes future updates to the logic of the system more manageable and also provides a single point of concern to add access control mechanisms to the system at a later date.
  5. ValidationEngine: This smart contract implements a business rule engine which is used to check that the asset data is valid based on a list of validations.
  6. Compliance Manager: This smart contract handles the addition and maintenance of compliance codes.

STRATO Application Middleware

BlockApps provides a Node SDK to interact with smart contracts via the STRATO REST APIs. STRATO middleware can be used to perform the following functions:

  1. Interact with smart contracts
  2. Run unit tests to verify smart contract functionality
  3. Expose read only calls from smart contracts via a REST API so it can be accessed from a UI
  4. Expose a REST API to upload data to the network
  5. Initialize test user accounts and upload smart contracts
  6. Bootstrap decentralized applications on the STRATO blockchain

STRATO REST APIs

Using our example above, we might want an asset endpoint to return a list of all assets on our blockchain. The endpoint will pass the user's query to Cirrus and return the results.

Example Request

curl <api-host>/api/v1/assets
Returns
{
    "success": true,
    "data": [
        {
            "address": "70b310b3743d5a2d3e145076efe52ddc67d7f4c1",
            "type": "document",
            "value": 13583,
        }
    ]
}

STRATO Test Scripts

Test scripts are used to simulate user actions and verify that the system completed the expected processing. Test scripts might be used to:

  1. Upload a CSV or XML file
  2. Update 10,000 transactions
  3. Authorize 10,000 transactions
  4. Generate output information

Next Steps

To create a private network, visit:

If you don't need a private network, you can visit these topics to learn more about our REST APIs: