Call Contract Method
It is possible to write contracts with an additional set of callable methods. If a method is exposed by the Smart Contract, it can be executed when sending a transaction with an attached hexdecimal message.
Note that Smart Contracts cannot read encrypted messages.
A method call consists of at maximum four parameters with each 8 bytes.
A method call can have 0 to 3 additional arguments, which needs to be converted into hexdecimal representation respecting Big Endian Byte Order. The way how method calls are handled in the Smart Contracts is not defined. This is especially true for the method identifier
The method identifiers in SmartJ are long numbers (int64) and a hashed variant of a methods signature. On compilation the compiler shows the related method hashes in the development console.
Intuitively, publicly callable methods in SmartJ need to be public, as this reflects the expected behavior in Java.
SmartC does not implicitely define how methods can be called and it is up to the developer to define the behavior. This can be either a numeric or alphabetical identifier. A pattern to deal with "public" methods can be found here. This proposal considers compatibility to SmartJ public method calls.
Finally, time to show some code. It's actually pretty simple, as SignumJS does most of the black magic behind the scenes.
If you use SmartC and want to use alphanumeric names within your code, please consider the correct conversion for the methodHash argument
In the following example the contract uses the abbreviated command cthzth as method identifier