You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wouter den Bakker edited this page Nov 29, 2019
·
1 revision
A smart contract is executed by creating a transaction and giving it to the processor. Each transaction must be signed by its creator to be valid. The easiest way to do so is using the Validana Client. Alternately you can directly insert the transaction into the database of the processor.
Validana Client
When using the Validana Client you can use Client.processTx(type, data, privateKey) to execute a smart contract. The type is the type/name of the smart contract to execute, the data should be an object that matches the template of the contract and the private key is the private key of the creator. See the Validana Client for more info.
Database insertion
First create a signed transaction. The Validana Core contains a method Transaction.sign(). Alternately see the Transaction format on how to sign a transaction. Insert this into the 'basics.transactions' table. You need to fill in the columns: version, transaction_id, contract_hash, valid_till, payload, signature, public_key and optionally create_ts.
Once processed the status, message (what the contract returns), processed_ts, block_id, position_in_block, sender, contract_type and receiver (if any) will be filled in.