Skip to main content
A transaction is sent to the network as a single byte string: the unsigned body followed by its signature.
Lenarchain currently runs as a mainnet alpha, so transactions move real funds. Keep your private key secret and never publish it.

Unsigned body

The body is the plain concatenation of the fields below, in this exact order. All integers are big-endian and have a fixed width. A transfer is therefore 179 bytes unsigned, plus a 64-byte signature.

Packet

The current chain is lightweight and supports transfers only, so a transfer carries no packet data. Its packet is the single default byte b"\x00". In future versions with more features, this field will hold the transaction data of the action, encoded as bytes.

Power

Power measures the work needed to execute a transaction. It works like gas on Ethereum.
  • power is the power for the transaction. For a transfer it is a constant: 1200.
  • power_limit is the maximum power the sender allows, a tolerance so the transaction does not fail. When power estimation is available, set it to the estimate plus about 10%. Because a transfer always costs 1200, both fields are 1200 today.
  • power_used is the power actually used when a node executes the transaction. It is returned by the Get transaction endpoint. If it exceeds power_limit, the transaction fails.
Lenarchain currently runs as a lightweight, single-node chain, so power, power_limit, and power_used have the same value. Other networks can configure them differently.

Hashing and signing libraries

The examples use two Python libraries:
  • Keccak-256 is the original Keccak used by Ethereum, not NIST SHA3-256.
  • Ed25519 private keys are 32-byte seeds. Signatures are 64 bytes.
To generate a new private key:

Signing

The signature is an Ed25519 signature over the Keccak-256 hash of a domain prefix followed by the unsigned body. The domain prefix is one byte that separates the kinds of signed message: Sign the 32 raw hash bytes, not the hex string.
tx_body is what you send to the node through the Send transaction endpoint.

Transaction hash

The RPC returns the hash when you send a transaction. You can also compute it yourself. The hash is the Keccak-256 of the signed body (unsigned_body + signature), with no domain prefix:

Fees

The fee is calculated after the transaction is executed:
price_per_power is the value the sender signed in the transaction. For example, 1200 x 100000000000 = 120000000000000. The fee is only known once the transaction has been executed. What the network does with the fee is configured per network. The tip signed by the sender goes entirely to the node that executes the transaction. Use the Traffic endpoint for tip recommendations. You can use a higher tip if you want. Use the Power price endpoint for the current price per power.