Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Latest commit

 

History

History
1369 lines (870 loc) · 25.3 KB

api-documentation.md

File metadata and controls

1369 lines (870 loc) · 25.3 KB
id title
api-documentation
API Documentation

API Documentation

{% hint style="danger" %} WARNING! This package is deprecated and is no longer maintained and supported. {% endhint %}

ArkEcosystem.Crypto.Configuration.Fee

Get()

public static UInt64 Get(int type)

Get a fee for a given transaction type

Parameters

Type Name Required Description
int type Yes Transaction type for which we wish to get a fee

Return Value

UInt64

Set()

public static void Set(int type, UInt64 value)

Set a fee

Parameters

Type Name Required Description
int type Yes Transaction type for which we wish to get a fee
UInt64 value Yes Fee for a given transaction type

Return Value

void

ArkEcosystem.Crypto.Configuration.Network

Set()

public static void Set(INetwork network)

Set what network you want to use in the crypto library

Parameters

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

Return Value

void

Get()

public static INetwork Get()

Get settings for a selected network, default network is devnet

Return Value

INetwork

ArkEcosystem.Crypto.Identities.Address

FromPassphrase()

public static string FromPassphrase(string passphrase, byte publicKeyHash = 0)

Get an address from a passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase
byte publicKeyHash No Public key hash

Return Value

string

FromPublicKey()

public static string FromPublicKey(PubKey publicKey, byte publicKeyHash = 0)

Get an address from a public key.

Parameters

Type Name Required Description
PubKey publicKey Yes Public key
byte publicKeyHash No Public key hash

Return Value

string

FromPrivateKey()

public static string FromPrivateKey(Key privateKey, byte publicKeyHash = 0)

Get an address from a private key.

Parameters

Type Name Required Description
Key privateKey Yes Private key
byte publicKeyHash No Public key hash

Return Value

string

Validate()

public static bool Validate(string address, byte publicKeyHash = 0)

Validate a given address

Parameters

Type Name Required Description
String address Yes Address to validate
byte publicKeyHash No Public key hash

Return Value

bool

ArkEcosystem.Crypto.Identities.PrivateKey

FromPassphrase()

public static Key FromPassphrase(string passphrase)

Create PrivateKey object from a given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

Key

FromHex()

public static Key FromHex(string privateKey)

Create PrivateKey object from a hex string.

Parameters

Type Name Required Description
string privateKey Yes Private key

Return Value

Key

ArkEcosystem.Crypto.Identities.PublicKey

FromPassphrase()

public static PubKey FromPassphrase(string passphrase)

Create PublicKey object from a given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

PubKey

FromHex()

public static PubKey FromHex(string publicKey)

Create PublicKey object from a given public key.

Parameters

Type Name Required Description
string publicKey Yes Public key

Return Value

PubKey

ArkEcosystem.Crypto.Identities.WIF

FromPassphrase()

public static string FromPassphrase(string passphrase)

Get wif from passphrase

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

string

ArkEcosystem.Crypto.Networks.Devnet

GetEpoch()

public DateTime GetEpoch()

Return the epoch date for devnet.

Return Value

DateTime

GetVersion()

public byte GetVersion()

Return the version for devnet.

Return Value

byte

GetWIF()

public byte GetWIF()

Return the WIF for devnet.

Return Value

byte

ArkEcosystem.Crypto.Networks.Mainnet

GetEpoch()

public DateTime GetEpoch()

Return the epoch date for main net.

Return Value

DateTime

GetVersion()

public byte GetVersion()

Return the version for main net.

Return Value

byte

GetWIF()

public byte GetWIF()

Return the WIF for main net.

Return Value

byte

Crypto.Crypto.Networks.Testnet.Testnet

GetEpoch()

public DateTime GetEpoch()

Return the epoch date for testnet.

Return Value

DateTime

GetVersion()

public byte GetVersion()

Return the version for testnet.

Return Value

byte

GetWIF()

public byte GetWIF()

Return the WIF for testnet.

Return Value

byte

ArkEcosystem.Crypto.Transactions.Builder.Builder

Sign()

public static Transaction Sign(Transaction transaction, string passphrase, string secondPassphrase = null)

Builds a transaction for a transfer.

Parameters

Type Name Required Description
Transaction transaction Yes Transaction
string passphrase Yes Passphrase associated with the account sending this transaction
string secondPassphrase No Second passphrase associated with the account sending this transaction

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Builder.DelegateRegistration

Create()

public static Transaction Create(string username, string passphrase, string secondPassphrase = null)

Builds a transaction for a delegate registration.

Parameters

Type Name Required Description
string username Yes Username to be associated with the delegate
string passphrase Yes Passphrase associated with the account sending this transaction
string secondPassphrase No Second passphrase associated with the account sending this transaction

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Builder.MultiSignatureRegistration

Create()

public static Transaction Create(int min, int lifetime, List<string> keysgroup, string passphrase, string secondPassphrase)

Builds a transaction for a multi signature registration.

Parameters

Type Name Required Description
int min Yes Transaction minimum required signatures
int lifetime Yes Transaction lifetime
List keysgroup Yes Transaction keysgroup
string passphrase Yes Passphrase associated with the account sending this transaction
string secondPassphrase No Second passphrase associated with the account sending this transaction

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Builder.SecondSignatureRegistration

Create()

public static Transaction Create(string passphrase, string secondPassphrase)

Builds a transaction for a second signature registration.

Parameters

Type Name Required Description
string passphrase Yes Passphrase associated with the account sending this transaction
string secondPassphrase No Second passphrase associated with the account sending this transaction

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Builder.Transfer

Create()

public static Transaction Create(string recipientId, ulong amount, string vendorField, string passphrase, string secondPassphrase = null)

Builds a transaction for a transfer.

Parameters

Type Name Required Description
string recipientId Yes Recipient identifier
ulong amount Yes Transaction amount
string vendorField Yes Transaction vendorfield
string passphrase Yes Passphrase associated with the account sending this transaction
string secondPassphrase No Second passphrase associated with the account sending this transaction

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Builder.Vote

Create()

public static Transaction Create(List<string> votes, string passphrase, string secondPassphrase = null)

Builds a transaction for a vote.

Parameters

Type Name Required Description
List votes Yes Votes
string passphrase Yes Passphrase associated with the account sending this transaction
string secondPassphrase No Second passphrase associated with the account sending this transaction

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.DelegateRegistration

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "delegate registration" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.DelegateResignation

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "delegate resignation" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.IPFS

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "IPFS" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.MultiPayment

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "multi payments" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.MultiSignatureRegistration

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "multi signature registration" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.SecondSignatureRegistration

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "second signature registration" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.TimelockTransfer

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "timelock transfer" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.Transfer

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "transfer" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Deserializers.Vote

Deserialize()

public static Transaction Deserialize(
            BinaryReader reader,
            MemoryStream stream,
            Transaction transaction,
            string serialized,
            int assetOffset
        )

Handle the deserialization of "vote" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
MemoryStream stream Yes Stream
Transaction transaction No Transaction
string serialized No Serialized
int assetOffset No Offset

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Serializers.DelegateRegistration

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "delegate registration" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.DelegateResignation

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "delegate resignation" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.IPFS

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "IPFS" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.MultiPayment

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "multi payments" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.MultiSignatureRegistration

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "multi signature registration" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.SecondSignatureRegistration

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "second signature registration" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.TimelockTransfer

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "timelock transfer" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.Transfer

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "transfer" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Serializers.Vote

Serialize()

public static void Serialize(BinaryWriter writer, Transaction transaction)

Handle the serialization of "vote" data.

Parameters

Type Name Required Description
BinaryReader reader Yes Reader
Transaction transaction No Transaction

Return Value

void

ArkEcosystem.Crypto.Transactions.Deserializer

Deserializer()

public Deserializer(string serialized)

Class constructor.

Parameters

Type Name Required Description
string serialized Yes Serialized

Return Value

Deserializer

Deserialize()

public Transaction Deserialize()

Perform AIP11 compliant deserialization.

Return Value

Transaction

HandleHeader()

public Transaction HandleHeader(Transaction transaction)

Handle the deserialization of "headers" data.

Parameters

Type Name Required Description
Transaction transaction Yes Transaction

Return Value

Transaction

HandleType()

Transaction HandleType(Transaction transaction)

Handle the deserialization of "type" data

Parameters

Type Name Required Description
Transaction transaction Yes Transaction

Return Value

Transaction

HandleVersionOne()

Transaction HandleVersionOne(Transaction transaction)

Handle the deserialization of transaction data with a version of 1.0.

Parameters

Type Name Required Description
Transaction transaction Yes Transaction

Return Value

Transaction

ArkEcosystem.Crypto.Transactions.Serializer

Serializer()

public Serializer(Transaction transaction)

Class constructor.

Parameters

Type Name Required Description
Transaction transaction Yes Transaction

Return Value

Serializer

Serialize()

public byte[] Serialize()

Perform AIP11 compliant serialization.

Return Value

byte[]

HandleHeader()

public void HandleHeader()

Handle the serialization of "headers" data.

Return Value

void

ArkEcosystem.Crypto.Transactions.Transaction

GetId()

public string GetId()

Convert the byte representation to a unique identifier.

Return Value

string

Sign()

public string Sign(string passphrase)

Sign the transaction using the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

string

SecondSign()

public string SecondSign(string passphrase)

Sign the transaction using the given second passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

string

Verify()

public bool Verify()

Verify the transaction.

Return Value

bool

SecondVerify()

public bool SecondVerify(string secondPublicKey)

Verify the transaction with a second public key.

Parameters

Type Name Required Description
String secondPublicKey Yes Second public key

Return Value

bool

ParseSignatures()

public Transaction ParseSignatures(string serialized, int startOffset)

Parse the signature, second signature and multi signatures.

Parameters

Type Name Required Description
string serialized Yes Serialized
int startOffset Yes Offset

Return Value

Transaction

ToBytes()

public byte[] ToBytes(bool skipSignature = true, bool skipSecondSignature = true)

Convert the transaction to its byte representation.

Parameters

Type Name Required Description
bool skipSignature No Skip first signature
bool skipSecondSignature No Skip second signature

Return Value

byte[]

Serialize()

public byte[] Serialize()

Perform AIP11 compliant serialization.

Return Value

byte[]

Deserialize()

public static Transaction Deserialize(string serialized)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
string serialized Yes Serialized

Return Value

Transaction

ToDictionary()

public Dictionary<string, dynamic> ToDictionary()

Convert the transaction to its dict representation.

Return Value

Dictionary<string, dynamic>

ToJson()

public string ToJson()

Convert the transaction to its JSON representation.

Return Value

string

ArkEcosystem.Crypto.Message

Message()

public Message(string publicKey, string signature, string message)

Create a new message instance.

Parameters

Type Name Required Description
string publicKey Yes Public Key
string signature Yes Signature
string message Yes Lessage

Return Value

Message

Sign()

public static Message Sign(string message, string passphrase)

Sign a message using the given passphrase.

Parameters

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

Return Value

Message

Verify()

public bool Verify()

Verify the message contents.

Return Value

bool

ToDictionary()

public Dictionary<string, string> ToDictionary()

Convert the message to its dict representation.

Return Value

Dictionary<string, string>

ToJson()

public string ToJson()

Convert the message to its JSON representation.

Return Value

string

ArkEcosystem.Crypto.Slot

GetTime()

public static uint GetTime()

Get the time diff between now and network start.

Return Value

uint

GetEpoch()

public static DateTime GetEpoch()

Get the network start epoch.

Return Value

DateTime