Interacting with AE in Erlang

I’m working on a prototype of a system that’s going to be written in Erlang.

A part of the system needs to interact with AE. What is the best way to do this from Erlang?


You can build and run aeternity “like any other” erlang application and call functions inside its modules. A good hint would be looking at the commands being ran when starting the node, in the corresponding script. Using that, you can just start an aeternity node inside your erlang shell like any other Erlang/OTP app.


Hi @zkvonsnarkenstein.chain

I am happy to hear your plans to build on top of the node itself. For that there is support for somewhat hacky plugin system: it allows you to run the node as an application. It needs more care and it is not that trivial to use, so I summon @uwigeroferlang.chain to elaborate here.

The MDW already uses it, so it is totally doable, the devil is in the details.


Hi, @zkvonsnarkenstein.chain ! Can you tell me a little about what your system is intended to do? I’m working on a node launcher and activity reporter application myself, also in Erlang, and have similar needs in terms of communicating with the core Aeternity applications from within the same node. I intend to simplify a few things about the startup procedure to make this easier (and make it easier to document), so I’d like to know a little about your project because I might give me more ideas or clarify my own thinking about exactly how the startup could be more usefully structured (for example, make it easier to bring in as a dependency, or start with additional/alternative tooling to make interoperation more accessible).


What the system will do is, in short, to hold and replicate files among nodes. The AE blockchain will be used for pointers to files and integrety checks. So the app needs to be able to deploy and interact with smart comtracts.


For that kind of basic interaction with the protocol, I would recommend to stick to APIs and SDKs still. Of course it would make sense to talk directly in erlang, the issue is though that some data needs some formatting, which is done by the SDK(s). Or to put it in more detail: While reading operations (getting data from chain) can theoretically be done, writing data certainly needs signing and so on.

So the way to go would be: The call data for performing reads or sending transactions is being generated by the compiler, whose API takes fairly simple requests. Passing that along to the node to perform a read operation (local contract call ) shouldn’t be too big of a deal.

For sending transactions though, they need to have the right format and signed. The SDKs take care of that, normally. And there is documentation on the specs for this of course, but maybe @hanssv.chain can point to tests, where such a transaction is constructed and signed using purely erlang ?