What libraries can be used when writing a contract in C++? What are the limitations? If I have a library I normally use and like, how do I compile it for use by contracts?
2 Answers
Contracts are in WASM which is a compiled binary language. The only currently tested and validated language for EOS smart contract development is C++, but in theory any language that compiles down to WASM can be used. There is an active community effort to support TypeScript as well.
-
3I think expaand is asking about which C++ libraries they can use, but I may be mistaken. Commented Jun 6, 2018 at 16:33
-
1Yes, that is what I was asking. And what limitations are there, if any?– expaandCommented Jun 7, 2018 at 12:45
-
2I know boost comes included and supported. STL of course. There is a library of contracts that comes included which has contracts for social media, an exchange, a token contract, etc. Then there is a library of objects as well.– NatCommented Jul 21, 2018 at 10:53
-
@Nat, aware of the system token contract, but where are the others you mention, like an exchange?– Walter KCommented Nov 7, 2018 at 8:55
-
@WalterK github.com/EOSIO/eos/tree/master/contracts looks like they've removed the exchange contract. Feel free to go back to a previous release to find it.– NatCommented Nov 7, 2018 at 13:29
The code for Boost is in https://github.com/EOSIO/eosio.cdt/tree/master/libraries/boost
The main EOS library is eosiolib, and it uses Boost in action.hpp, dispatcher, datastream, etc.