Quick Start
Last updated
Last updated
The Olac compiler is a single binary. It can be installed in different ways, listed below.
Olac is available on Brew via a private tap. This works only for MacOS systems, both Intel and Apple Silicon. To install Olac via Brew, run the following command:
There are binaries available on
Download the file and save it somewhere in your $PATH
, for example the bin directory in your home directory. If the path you use is not already in $PATH
, then you need to add it yourself.
On MacOS, remember to give execution permission to the file and remove it from quarantine by executing the following commands:
If you are using an Intel based Mac, please, exchange olac-mac-arm
by olac-mac-intel
in both of the above commands.
On Linux, permission to execute the binary is also necessary, so, please, run chmod +x olac-linux-x86-64
.
In order to build Olac from source, you will need:
Rust nightly version 1.72.0 or higher
A pre-built LLVM Libraries, version 15.0.7
Linux(Ubuntu)
Windows
After unzipping the file, add the bin directory to your path.
Mac
After you finish installing LLVM, you should try the llvm-config command to check if the output version is correct.
Once you have the correct LLVM version in your path, simply run:
If you encounter the following error message, then you need to check if llvm is installed correctly and if the llvm-config command can be executed correctly.
error: No suitable version of LLVM was found system-wide or pointed to by LLVM_SYS_150_PREFIX.
The executable will be in target/release/olac
The olac compiler is run on the command line. The ola source file names are provided as command line arguments; the output is an optimized asm file and anabi file (also known as the abi).
olac compile [OLA SOURCE FILE] ... [OPTIONS]…
Assuming there is a Fibonacci sequence contract, the command to compile this contract is:
The above command will generate the files fib_abi.json
and fib_asm.json
.
Ola supports some debug mode options. This means that the command line is olac compile
followed by any options described below, followed by one source file.
Options:
--gen phase
This option is can be used for debugging Olac itself. This is used to output early phases of compilation.
abi Ouput Ola contract's ABI information
ast Output Abstract Syntax Tree as a graphviz dot file. This can be viewed with xdot or any other tool that can visualize graphviz dot files.
llvm-ir Output llvm IR as text.
asm Output assembly text file.
Ola supports writing on vscode, we have developed an extension to vscode to support ola syntax highlighting, and we will continue to improve the plugin in the future.
After configuring the above environment, we can happily write Ola smart contracts named fib.ola on vscode with ola extension. The following is an example of a Fibonacci sequence.
Compile this contract next.
The above command will generate the files fib_abi.json
and fib_asm.json
. fib_abi.json
is the ABI file of the contract, which will be used by ola-sdk to build contract request transactions. fib_asm.json
is the assembly form of the contract source code, used for contract deployment and invocation.
If you do not have the correct version of rust installed, go to .
Ola needs a build of LLVM Libraries, You can download the pre-built libraries from After that, you need to add the bin
of your LLVM directory to your path, so that the build system of O la c can find the correct version of LLVM to use.
A pre-built version of LLVM, is available at
For Windows users, the official LLVM does not provide additional tools like llvm-config
, which causes Olac to fail to build. Therefore, we provide pre-built versions for Windows. is available at
For macOS users, you can download the llvm official build package. A pre-built version of LLVM for intel macs, is available at . After downloading, untar the file in a terminal and add it to your path like so:
arm macs there is After downloading, untar the file in a terminal and add it to your path like so:
The latest Ola release is on . Once you have the correct LLVM version in your path, ensure you have GNU make installed and simply run:
The extension can be found on the .