Ola Developer Documents
  • Introduction
    • What is Ola
    • Advanced Features
    • Roadmap & Release Notes
  • Quick Start
    • Setup Environment
    • Setting up an Account
    • Deploying a Smart Contract
    • Interacting with a Smart Contract
    • Running smart contract locally
  • Ola Language
  • OlaVM
    • Concepts
      • Accounts
      • Contracts
      • Notes
      • Transaction
      • Transition
      • Blocks
    • OlaVM Architecture
      • VM
      • Circuits
    • GPU acceleration
  • OlaOS
    • Installation Guide
    • Run an OlaOS Node
    • Command Line Interface
    • OlaOS Architecture
    • System Contracts
  • API/SDK
    • APIs
    • Javascript SDK
  • Developer Tools and Resources
Powered by GitBook
On this page
  • Prerequisites
  • Interacting with a smart contract locally
  1. Quick Start

Running smart contract locally

PreviousInteracting with a Smart ContractNextOla Language

Last updated 1 year ago

Prerequisites

Ensure mini-ola is installed correctly:

mini-ola --version

If this command fails, see

Interacting with a smart contract locally

You can write Ola smart contracts using and compile them with olatte, Taking the contract as an example:

olatte compile path/to/vote_simple.ola path/of/output/dir

This command will generate a bin file and an abi file; the bin file is used for the deployment of the contract:

olatte deploy --address 0xabcd --db path/to/local/storage path/to/vote_simple_bin.json.json
  • address: The address where you want the smart contract to be deployed. When not specified, an address will be generated randomly.

  • db: Path of your local storage. When not specified, a "db" folder will be created in current working directory.

The contract has been deployed. You can send transactions using invoke:

mini-ola invoke vote_simple_abi.json 0xabcd contract_init "[1,2,3,4,5,6,7]"
mini-ola invoke vote_simple_abi.json 0xabcd vote_proposal 4

These two transactions initialized the proposal number and cast a vote for the fourth proposal.

When using invoke, you can specify parameters: db, caller, nonce, block, timestamp. For detailed explanations of these parameters, you can check the following command:

mini-ola invoke -h

Finally, you can use the call command to check the contract state:

mini-ola call vote_simple_abi.json 0xabcd winningProposal

Similarly, you can view specific parameters through the command:

mini-ola call -h
Setting up your environment.
Ola-lang
vote_simple.ola