API Documentation

ArkEcosystem.Crypto.Configuration.Configuration

get_value()

1def get_value(key, bucket \\ :ark_config)

Get the value of the given configuration key.

Parameters

Type Name Required Description
string key Yes Configuration key
string bucket No

Return Value

?

set_value()

1def set_value(key, value, bucket \\ :ark_config)

Set the value of the given configuration key.

Parameters

Type Name Required Description
string key Yes Configuration key
string value Yes New value
string bucket No

Return Value

?

ArkEcosystem.Crypto.Configuration.Fee

get()

1def get(type) when is_integer(type)
2def get(type) when is_atom(type)

Get a fee for a given transaction type

Parameters

Type Name Required Description
Type.t() type Yes Transaction type for which we wish to get a fee

Return Value

?

set()

1def set(type, fee)

Set a fee

Parameters

Type Name Required Description
Type.t() type Yes Transaction_type for which we wish to set a fee
integer fee Yes Fee for a given transaction type

Return Value

?

ArkEcosystem.Crypto.Configuration.Network

version()

1def version()

Get the version of the network.

Return Value

?

set()

1def set(network)

Set what network you want to use in the crypto library.

Parameters

Type Name Required Description
? network Yes Testnet, Devnet, Mainnet

Return Value

?

get()

1def get()

Get settings for a selected network, default network is mainnet.

Return Value

?

ArkEcosystem.Crypto.Identities.Address

from_public_key()

1def from_public_key(public_key, network \\ nil)

Derive the address from the given public key.

Parameters

Type Name Required Description
? public_key Yes Public key
? network No Version of the network

Return Value

string

from_private_key()

1def from_private_key(private_key, network \\ nil)

Derive the address from the given private key.

Parameters

Type Name Required Description
? private_key Yes Private key
? network No Version of the network

Return Value

?

from_passphrase()

1def from_passphrase(passphrase, network \\ nil)

Derive the address from the given passphrase.

Parameters

Type Name Required Description
? passphrase Yes Passphrase
? network No Version of the network

Return Value

string

validate()

1def validate(address, network \\ nil)

Validate the given address.

Parameters

Type Name Required Description
? address Yes Address
? network No Version of the network

Return Value

bool

ArkEcosystem.Crypto.Identities.PrivateKey

from_passphrase()

1def from_passphrase(passphrase)

Derive the private key for the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

?

from_hex()

1def from_hex(private_key)

Create a private key instance from a hex string.

Parameters

Type Name Required Description
string private_key Yes Private key

Return Value

EcPrivateKey

sign()

1def sign(message, passphrase)

Sign the private key.

Parameters

Type Name Required Description
string message Yes Message
string passphrase No Passphrase

Return Value

?

ArkEcosystem.Crypto.Identities.PublicKey

from_passphrase()

1def from_passphrase(passphrase)

Derive the public from the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

?

from_hex()

1def from_hex(public_key)

Create a public key instance from a hex string.

Parameters

Type Name Required Description
string public_key Yes Public key

Return Value

EcPublicKey

from_private_key()

1def from_private_key(private_key)

Create a public key instance from a private key.

Parameters

Type Name Required Description
string private_key Yes Private key

Return Value

?

verify()

1def verify(message, signature, public_key)

Verify the given public key.

Parameters

Type Name Required Description
string message Yes Message
string signature Yes Signature
string public key Yes Public key

Return Value

?

ArkEcosystem.Crypto.Identities.WIF

from_passphrase()

1def from_passphrase(passphrase, network \\ nil) do

Derive the WIF from the given passphrase.

Parameters

Type Name Required Description
str passphrase Yes Passphrase
? network No Network WIF

Return Value

?

ArkEcosystem.Crypto.Transactions.Builder

build_transfer()

1def build_transfer(recipient_id, amount, vendor_field, passphrase, second_passphrase \\ nil)

Builds a transaction for a transfer.

Parameters

Type Name Required Description
string recipient_id Yes Recipient identifier
integer amount Yes Transaction amount
string vendor_field Yes Transaction vendorfield
string passphrase Yes Passphrase
string second_passphrase No Second passphrase

Return Value

?

build_vote()

1def build_vote(votes, passphrase, second_passphrase \\ nil)

Builds a transaction for a vote registration.

Parameters

Type Name Required Description
Enum.List votes Yes Votes
string passphrase Yes passphrase
string second_passphrase No second passphrase

Return Value

?

build_second_signature_registration()

1def build_second_signature_registration(passphrase, second_passphrase \\ nil)

Builds a transaction for a second signature registration.

Parameters

Type Name Required Description
string passphrase Yes Passphrase
string second_passphrase No Second passphrase

Return Value

?

build_delegate_registration()

1def build_delegate_registration(username, passphrase, second_passphrase \\ nil)

Builds a transaction for a delegate registration.

Parameters

Type Name Required Description
string username Yes Delegate username
string passphrase Yes Passphrase
string second_passphrase No Second passphrase

Return Value

?

build_multi_signature_registration()

1def build_multi_signature_registration(min, lifetime, keysgroup, passphrase, second_passphrase \\ nil)

Builds a transaction for a multi signature registration.

Parameters

Type Name Required Description
integer min Yes Transaction minimum required signatures
integer lifetime Yes Transaction lifetime
? keysgroup Yes Transaction keysgroup
string passphrase Yes Passphrase
string second_passphrase No Second passphrase

Return Value

?

build_ipfs()

1def build_ipfs()

To Implement.

build_timelock_transfer()

1def build_timelock_transfer()

To Implement.

build_multi_payment()

1def build_multi_payment()

To Implement.

build_delegate_resignation()

1def build_delegate_resignation()

To Implement.

ArkEcosystem.Crypto.Transactions.Deserializers.DelegateRegistration

deserialize()

1def deserialize(data)

Handle the deserialization of “delegate registration” data.

Parameters

Type Name Required Description
? data Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.DelegateResignation

deserialize()

1def deserialize(data)

Handle the deserialization of “delegate resignation” data.

Parameters

Type Name Required Description
? data Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.IPFS

deserialize()

1def deserialize(data)

Handle the deserialization of “ipfs” data

Parameters

Type Name Required Description
? data Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.MultiPayment

deserialize()

1def deserialize(data)

Handle the deserialization of “multi payment” data

Parameters

Type Name Required Description
? data Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.MultiSignatureRegistration

deserialize()

1def deserialize(data)

Handle the deserialization of “multi signature registration” data

Parameters

Type Name Required Description
? data Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.SecondSignatureRegistration

deserialize()

1def deserialize(data)

Handle the deserialization of “second signature” data.

Parameters

Type Name Required Description
? data Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.TimelockTransfer

deserialize()

1def deserialize(data)

Handle the deserialization of “timelock transfer” data.

Parameters

Type Name Required Description
? data Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.Transfer

deserialize()

1def deserialize(data)

Handle the deserialization of “transfer” data.

Parameters

v

Return Value

?

ArkEcosystem.Crypto.Transactions.Deserializers.Vote

deserialize()

1def deserialize(data)

Handle the deserialization of “vote” data.

Parameters

Type Name Required Description
? data Yes

Return Value

object

ArkEcosystem.Crypto.Transactions.Serializers.DelegateRegistration

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “delegate registration” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializers.DelegateResignation

serialize()

1def serialize(bytes, _transaction)

Handle the serialization of “delegate resignation” data.

Parameters

Type Name Required Description
? bytes Yes
? _transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializers.IPFS

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “IPFS” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.MultiPayment

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “multi payment” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializers.MultiSignatureRegistration

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “multi signature registration” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializers.SecondSignatureRegistration

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “second signature registration” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializers.TimelockTransfer

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “timelock transfer” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializers.Transfer

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “transfer” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializers.Vote

serialize()

1def serialize(bytes, transaction)

Handle the serialization of “vote” data.

Parameters

Type Name Required Description
? bytes Yes
? transaction Yes Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Deserializer

deserialize()

1def deserialize(%{serialized: serialized}) when is_bitstring(serialized)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
Map serialized Yes Serialized

Return Value

?

parse_signatures()

1def parse_signatures(data)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
? data Yes

Return Value

?

ArkEcosystem.Crypto.Transactions.Serializer

serialize() (transaction, object)

1def serialize(transaction, %{underscore: underscore}) when is_map(transaction)

Perform AIP11 compliant serialization.

Parameters

Type Name Required Description
? transaction Yes Transaction
Map underscore Yes

Return Value

?

serialize() (transaction)

1def serialize(transaction) when is_map(transaction)

Perform AIP11 compliant serialization.

Parameters

Type Name Required Description
? transaction Yes Transaction

Return Value

?

ArkEcosystem.Crypto.Transactions.Transaction

get_id()

1def get_id(transaction)

Convert the byte representation to a unique identifier.

Parameters

Type Name Required Description
? transaction Yes Transaction

Return Value

string

sign_transaction()

1def sign_transaction(transaction, passphrase, second_passphrase \\ nil) when is_map(transaction)

Sign the transaction using the given passphrase.

Parameters

Type Name Required Description
? transaction Yes Transaction
string passphrase Yes Passphrase
string second_passphrase No Second passphrase

Return Value

?

sign()

1def sign(transaction, passphrase)

Sign the transaction using the given passphrase.

Parameters

Type Name Required Description
? transaction Yes Transaction
string passphrase Yes Passphrase

Return Value

?

second_sign() (transaction, nil)

1def second_sign(transaction, nil)

Sign the transaction using the given second passphrase.

Parameters

Type Name Required Description
? transaction Yes Transaction
? nil No

Return Value

?

second_sign() (transaction, second_passphrase)

1def second_sign(transaction, second_passphrase)

Sign the transaction using the given second passphrase.

Parameters

Type Name Required Description
? transaction Yes Transaction
string second_passphrase Yes Second passphrase

Return Value

?

verify()

1def verify(transaction)

Verify the transaction.

Parameters

Type Name Required Description
? transaction Yes Transaction

Return Value

?

second_verify()

1def second_verify(transaction, second_public_key)

Verify the transaction with a second public key.

Parameters

Type Name Required Description
string transaction Yes Transaction
string second_public_key Yes Second public key

Return Value

?

to_bytes()

1def to_bytes(transaction, skip_signature \\ true, skip_second_signature \\ true)

Convert the transaction to its byte representation.

Parameters

Type Name Required Description
string transaction Yes Transaction
string skip_signature No Skip first signature
string skip_second_signature No Skip second signature

Return Value

?

to_params()

1def to_params(transaction) when is_map(transaction)

Convert the transaction to its params representation.

Parameters

Type Name Required Description
? transaction Yes Transaction

Return Value

?

to_json()

1def to_json(transaction) when is_map(transaction)

Convert the transaction to its JSON representation.

Parameters

Type Name Required Description
? transaction Yes Transaction

Return Value

?

serialize()

1def serialize(transaction) when is_map(transaction)

Perform AIP11 compliant serialization

Parameters

Type Name Required Description
? transaction Yes Transaction

Return Value

?

deserialize() (transaction)

1def serialize(transaction) when is_map(transaction)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
? transaction Yes Transaction

Return Value

?

deserialize() (serialized)

1def deserialize(serialized) when is_bitstring(serialized)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
? serialized Yes Serialized

Return Value

?

deserialize() (object)

1def deserialize(%{serialized: serialized}) when is_bitstring(serialized)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
? serialized Yes Serialized

Return Value

?

ArkEcosystem.Crypto.Utils.Message

sign()

1def sign(message, passphrase)

Sign a message using the given passphrase.

Parameters

Type Name Required Description
String.t() message Yes Message
String.t() passphrase Yes Passphrase

Return Value

Map.t()

verify()

1def verify(message, signature, public_key)

Verify the message contents

Parameters

Type Name Required Description
String.t() message Yes Message
String.t() signature Yes Signature
String.t() public_key Yes Public key

Return Value

Boolean.t()

to_params()

1def to_params(message, signature, public_key)

Convert the message to its params representation

Parameters

Type Name Required Description
String.t() message Yes Message
String.t() signature Yes Signature
String.t() public_key Yes Public key

Return Value

?

to_json()

1def to_json(message, signature, public_key)

Convert the message to its JSON representation

Parameters

Type Name Required Description
String.t() message Yes Message
String.t() signature Yes Signature
String.t() public_key Yes Public key

Return Value

?

ArkEcosystem.Crypto.Utils.Slot

get_time()

1def get_time

Get the time diff between now and network start.

Return Value

?

get_epoch()

1def get_epoch

Get the network start epoch.

Return Value

?s

Last updated 3 years ago
Edit Page
Share: