Packages

A simple Cryptography Implementation in Elixir for the Ark Blockchain.

Current section

Files

Jump to
arkecosystem_crypto lib arkecosystem crypto transactions serialisers transfer.ex
Raw

lib/arkecosystem/crypto/transactions/serialisers/transfer.ex

defmodule ArkEcosystem.Crypto.Transactions.Serializers.Transfer do
alias ArkEcosystem.Crypto.Helpers.Base58Check
def serialize(bytes, transaction) do
amount = <<transaction.amount::little-unsigned-integer-size(64)>>
expiration =
if Map.has_key?(transaction, :expiration) do
<<transaction.expiration::little-unsigned-integer-size(32)>>
else
<<0::little-unsigned-integer-size(32)>>
end
recipient_id =
transaction.recipient_id
|> Base58Check.decode58check()
bytes <> amount <> expiration <> recipient_id
end
end