[Solved] Building and signing raw transactions

We are trying to make an offline “wallet” for our Æepp where we would sign transactions received from raw data.

It would be immensely useful if we could get an example of how to build a raw transaction with all parameters and their respectful encodings.

We wanted to use libsodium for signing and are wondering which curve is used for signing.

Hey Mislav,

You can use the js-sdk to do this. You can use the TxBuilder to build the transaction and after that Account for signing the transaction. I also think that Universal has the above options.

Hope that helps,

1 Like

Hey Martin,

It’s useful, but we are more interested in how the transaction data itself looks and which curves are used for signing. We’d like to do the signing ourselves without importing the SDK or communicating with the node.

What we need specifically is:

  • What data is needed for an aeternity transaction (to:, from:, nonce:, data:, etc… all the params basically)
  • How is this data formatted (.json?)
  • How is this data converted to a raw transaction
  • How is the raw transaction signed

Again, SDKs aren’t useful for us there since we need to develop it ourselves. I’ll give it a look at the SDKs how they did it, but I’d appreciate an answer still.


Something like this https://github.com/aeternity/protocol/blob/master/serializations.md

But if we could be given concrete examples. These are a little bit difficult to follow

We use curve25519 for signatures.

The chain contains quite a number of examples :wink: The swagger definitions for the HTTP API could also give some hints.

1 Like

So would it be correct to assume that I use this:

"tx": { "amount": "14328000000000000000000", "fee": 20260, "nonce": 2, "payload": "", "recipientId": "ak_2tNbVhpU6Bo3xGBJYATnqc62uXjR8yBv9e63TeYCpa6ASgEz94", "senderId": "ak_RMi1xMFStLUvXamNCTXwkBS5RvYGdpXhBfirdcZqSzQAfk3ox", "ttl": 40152, "type": "SpendTx", "version": 1 }

and sign it with curve25519?

Also these are all spend transactions, I can’t find any exmples of contract calls in the block explorer. If you could provide an example of a contract call, that would be awesome! :slight_smile:


I’ve found some contract call transactions


What I’m wondering primarily now is how the callData parameter is encoded?

The callData is aevm bytecode encoded as base64 + added header + added checksum, this means for replicating sophia types as strings to respective encoded calldata needs a sophia compiler.

The standalone compiler (or deprecated node enpoint) provide this functionality using /encode-calldata.

This encoded calldata can then be used to assemble your raw transactions as defined in the contract call serialization protocol. This RLP encoded output binary can then be signed using curve25519.

To post your signed transaction to the blockchain it needs to be assembled and encoded using RLP as well.

The output will have to be encoded using base64 and and double-sha256 checksum to be added, and prefixed with tx_.

Then posted to the /transactions endpoint of a node.


Thank you @piwo ! This answers our question.