This library is used to interface with the Aergo blockchains from different programming languages:
- C
- C++
- C#
- VB.NET
- Swift
- Ruby
Other languages can also use it via FFI.
- Linux
- Mac
- Windows
- iOS
- Android
You can download binaries for iOS and Windows in the releases
libaergo depends on secp256k1-vrf and libcurl
Use the http1 branch if you want a version that does not depend on libcurl. Subscriptions to events are not possible on that case.
It also depends on hidapi when interfacing with a Ledger Nano S
First install the tools required for compilation
On Linux:
sudo apt-get install gcc make automake libtool libcurl4-openssl-dev -y On Mac:
brew install automake libtool Compiling and installing secp256k1-vrf:
git clone --depth=1 https://github.com/aergoio/secp256k1-vrf cd secp256k1-vrf ./autogen.sh ./configure make sudo make install cd .. Compiling and installing hidapi (only required if using a Ledger device):
sudo apt-get install libudev-dev libusb-1.0-0-dev git clone --depth=1 https://github.com/libusb/hidapi cd hidapi ./bootstrap ./configure make sudo make install cd .. make sudo make install For iOS:
cd ../secp256k1-vrf ./makeios cd - ./makeios You can link your application to the external dynamic library.
On some languages you can also include the static library in your project instead of linking to the dynamic library.
- Get Account State
- Smart Contract Call
- Smart Contract Query
- Smart Contract Query State Variable
- Smart Contract Events Notification
- Transfer
- Multicall
There are many usage examples available for each supported language, for synchronous and asynchronous calls.
Compiling an example code:
gcc examples/contract_call/contract_call.c -laergo -o contract_call g++ examples/contract_call/contract_call.cpp -std=c++17 -laergo -o contract_call Open the example in a new project, include the .NET wrapper in the project, then build and execute it.
Or compile it via command line: (Windows)
PATH=c:\Windows\Microsoft.NET\Framework\v4.0.30319;%PATH% csc examples\contract_query\contract_query.cs wrappers\dotNet\AergoClient.cs /r:System.Numerics.dll Open the example in a new project, include the Swift wrapper and the bridging header on the project, then build and execute it.
Or compile it via command line:
swiftc examples/contract_query/main.swift wrappers/Swift/aergo.swift -import-objc-header wrappers/Swift/libaergo-Bridging-Header.h -L/usr/local/lib -laergo Install the ffi module:
[sudo] gem install ffi To run an example:
ruby examples/contract_call/contract_call.rb 