Skip to content

SolidVM 3.0

SolidVM 3.0 enables X.509 Identity Integration within smart contracts. This allows you to associate a signed identity certificate with a STRATO user account.

There are no syntactical differences or feature additions from core SolidVM to 3.0.

3.0 Features

The following SolidVM features are only available in versions ^3.0:

  • X.509 Certificate Registration.
  • Built-in Transaction properties related to a user's identity.
  • Default values for unset storage variables.

Version Pragma

SolidVM 3.0 requires the following pragma at the top of all contracts:

pragma solidvm 3.0;

X.509 Integration

Several built-in functions have been added which allow you to directly interface with an X.509 certificate associated with a given address.

Built-in Functions:

  • registerCert(address addr, string certificate);
    • registers a PEM/DER encoded X.509 certificate with a given address.
  • getUserCert(address addr) returns (mapping(string => string));
    • Gets the X.509 certificate registered to this address
    • The returned data type is a solidity mapping(string => string) where each key-value pair in the mapping is the respective key-value pair of the certificate.
  • parseCert(string certificate) returns (mapping(string => string));
    • Takes a PEM/DER encoded certificate and parses it as a mapping(string => string). Does not register the certificate with any address or require that the certificate be registered with an address.

For the full details about using X.509 certificates in smart contracts, see the X.509 Documentation.

Additional Transaction Properties

If the account creating a transaction has a certificate registered to its address, than the global tx variable will have 3 additional properties corresponding to the tx.origin certificate's properties.

  • tx.username : string
    • The tx.origin's registered Common Name
  • tx.organization : string
    • The tx.origin's registered Organization
  • tx.group : string
    • The tx.origin's registered Organizatinal Unit

Default Storage Values

When a state variable is declared without an initial value and is unset in the contract constructor, its value will be automatically set to a default value for its type:

Type Default Value
int 0
bool false
string ""
bytes ""
address 0x0
account 0x0
contract 0x0
enum 0
array []
mapping Empty mapping
struct Each field has the default value of its type
---------- --------------