API Documentation

Identity

Crypto / API Documentation / Identity

Get address from passphrase

func AddressFromPassphrase(passphrase string) (string, error)

Parameters

TypeNameRequiredDescription
stringpassphraseYesThe passphrase used to generate the address.

Return Value

This function returns an address derived from the provided passphrase as a string.

address, err := AddressFromPassphrase("super secret passphrase")
>> "0x2289577F3784788784226Eb41E9B0ca9705C7C37"

Validate an address

func ValidateAddress(address string) (bool, error)

Parameters

TypeNameRequiredDescription
stringaddressYesThe address to be validated.

Return Value

This function checks if the provided address is valid. Returns a boolean value indicating validity.

isValid, err := ValidateAddress("0x2289577F3784788784226Eb41E9B0ca9705C7C37")
>> true

Get BLS private key from passphrase

func BLSPrivateKeyFromPassphrase(passphrase string) (*BLSPrivateKey, error)

Parameters

TypeNameRequiredDescription
stringpassphraseYesThe passphrase used to generate the BLS private key.

Return Value

This function returns a BLSPrivateKey object derived from the provided passphrase.

blsPrivateKey, err := BLSPrivateKeyFromPassphrase("super secret passphrase")
>> &BLSPrivateKey{}

Get BLS public key from passphrase

func BLSPublicKeyFromPassphrase(passphrase string) (*BLSPublicKey, error)

Parameters

TypeNameRequiredDescription
stringpassphraseYesThe passphrase used to generate the BLS public key.

Return Value

This function returns a BLSPublicKey object derived from the provided passphrase.

blsPublicKey, err := BLSPublicKeyFromPassphrase("super secret passphrase")
>> &BLSPublicKey{}

Get private key from passphrase

func PrivateKeyFromPassphrase(passphrase string) (*PrivateKey, error)

Parameters

TypeNameRequiredDescription
stringpassphraseYesThe passphrase used to generate the private key.

Return Value

This function returns a PrivateKey object derived from the provided passphrase.

privateKey, err := PrivateKeyFromPassphrase("super secret passphrase")
>> &PrivateKey{}

Get public key from passphrase

func PublicKeyFromPassphrase(passphrase string) (*PublicKey, error)

Parameters

TypeNameRequiredDescription
stringpassphraseYesThe passphrase used to generate the public key.

Return Value

This function returns a PublicKey object derived from the provided passphrase.

publicKey, err := PublicKeyFromPassphrase("super secret passphrase")
>> &PublicKey{}

Fee

Crypto / API Documentation / Configuration / Fee

Get fee for a transaction type

func GetFee(transactionType uint16) FlexToshi

Parameters

TypeNameRequiredDescription
uint16transactionTypeYesThe transaction type for which to get the fee.

Return Value

This function returns the fee for the specified transaction type as a FlexToshi value.

fee := GetFee(TRANSACTION_TYPES.Transfer)
>> 10000000

Set fee for a transaction type

func SetFee(transactionType uint16, value FlexToshi)

Parameters

TypeNameRequiredDescription
uint16transactionTypeYesThe transaction type for which to set the fee.
FlexToshivalueYesThe fee value to set for the given transaction type.

Return Value

This function sets the fee for the specified transaction type.

SetFee(TRANSACTION_TYPES.Transfer, 5000000)
>> None

Network

Crypto / API Documentation / Configuration / Network

Set the network configuration

func SetNetwork(network *Network)

Parameters

TypeNameRequiredDescription
*NetworknetworkYesNetwork configuration object to set for the crypto library. Options: Mainnet, Devnet, Testnet.

Return Value

This function sets the network configuration (epoch, version, and WIF) based on the provided network object (Mainnet, Devnet, or Testnet).

SetNetwork(NETWORKS_MAINNET)
>> None

Get the current network configuration

func GetNetwork() *Network

Return Value

This function returns the current network configuration object.

network := GetNetwork()
>> &Network{Epoch: time.Date(2017, 3, 21, 13, 00, 0, 0, time.UTC), Version: 30, Wif: 170}

Transactions

Crypto / API Documentation / Transactions / BaseTransactionBuilder

Get the transaction ID

func (transaction *Transaction) GetId() string

Return Value

This method returns the transaction ID as a hexadecimal string.

transactionId := transaction.GetId()
>> "d2b6f58b41e8..."

Sign a transaction with a passphrase

func (transaction *Transaction) Sign(passphrase string)

Parameters

TypeNameRequiredDescription
stringpassphraseYesThe passphrase associated with the account sending this transaction.

Return Value

This method signs the transaction using the provided passphrase.

transaction.Sign("your passphrase")
>> None

Sign a multi-signature transaction with a passphrase

func (transaction *Transaction) SignMulti(signerIndex int, passphrase string)

Parameters

TypeNameRequiredDescription
intsignerIndexYesIndex of the signer in the multi-signature group.
stringpassphraseYesThe passphrase of the signer.

Return Value

This method signs a multi-signature transaction with the given signer index and passphrase.

transaction.SignMulti(0, "your passphrase")
>> None

Add a second signature to a transaction

func (transaction *Transaction) SecondSign(passphrase string)

Parameters

TypeNameRequiredDescription
stringpassphraseYesThe second passphrase associated with the account sending this transaction.

Return Value

This method adds a second signature to the transaction using the provided second passphrase.

transaction.SecondSign("your second passphrase")
>> None

Verify the transaction signature

func (transaction *Transaction) Verify(multiSignatureAsset ...*MultiSignatureRegistrationAsset) (bool, error)

Parameters

TypeNameRequiredDescription
[]*MultiSignatureRegistrationAssetmultiSignatureAssetNoOptional multi-signature asset to verify the multi-signature transaction.

Return Value

This method verifies the transaction signature. Returns true if the signature is valid, otherwise false.

isValid, err := transaction.Verify()
>> true, nil

Verify the second signature of the transaction

func (transaction *Transaction) SecondVerify(secondPublicKey *PublicKey) (bool, error)

Parameters

TypeNameRequiredDescription
*PublicKeysecondPublicKeyYesThe public key to verify the second signature against.

Return Value

This method verifies the second signature of the transaction. Returns true if the second signature is valid, otherwise false.

isValid, err := transaction.SecondVerify(secondPublicKey)
>> true, nil

Convert the transaction to a dictionary

func (transaction *Transaction) ToMap() map[string]interface{}

Return Value

This method returns a dictionary representation of the transaction.

transactionMap := transaction.ToMap()
>> map[string]interface{}{"id": "d2b6f58b41e8...", "amount": 100000000, ...}

Convert the transaction to a JSON string

func (transaction *Transaction) ToJson() (string, error)

Return Value

This method returns a JSON string representation of the transaction.

transactionJson, err := transaction.ToJson()
>> '{"id": "d2b6f58b41e8...", "amount": 100000000, ...}', nil
Crypto / API Documentation / Transactions / TransferBuilder

Create a transfer transaction

func BuildTransfer(transaction *Transaction, passphrase string, secondPassphrase string) *Transaction

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to be populated and signed.
stringpassphraseYesPassphrase associated with the account sending this transaction.
stringsecondPassphraseNoSecond passphrase for the account, if available.

Return Value

This function sets all fields and signs a transfer transaction.

transferTransaction := BuildTransfer(transaction, "your passphrase", "")
>> &Transaction{Type: 0, ...}
Crypto / API Documentation / Transactions / VoteBuilder

Create a vote transaction

func BuildVote(transaction *Transaction, passphrase string, secondPassphrase string) *Transaction

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to be populated and signed.
stringpassphraseYesPassphrase associated with the account sending this transaction.
stringsecondPassphraseNoSecond passphrase for the account, if available.

Return Value

This function sets all fields and signs a vote transaction.

voteTransaction := BuildVote(transaction, "your passphrase", "")
>> &Transaction{Type: 3, ...}
Crypto / API Documentation / Transactions / ValidatorRegistrationBuilder

Create a validator registration transaction

func BuildValidatorRegistration(transaction *Transaction, passphrase string, secondPassphrase string) *Transaction

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to be populated and signed.
stringpassphraseYesPassphrase associated with the account sending this transaction.
stringsecondPassphraseNoSecond passphrase for the account, if available.

Return Value

This function sets all fields and signs a validator registration transaction.

validatorRegistrationTransaction := BuildValidatorRegistration(transaction, "your passphrase", "")
>> &Transaction{Type: 2, ...}
Crypto / API Documentation / Transactions / MultiSignatureRegistrationBuilder

Create a multi-signature registration transaction

func BuildMultiSignatureRegistration(transaction *Transaction, passphrase string, secondPassphrase string) *Transaction

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to be populated and signed.
stringpassphraseYesPassphrase associated with the account sending this transaction.
stringsecondPassphraseNoSecond passphrase for the account, if available.

Return Value

This function sets all fields and signs a multi-signature registration transaction.

multiSignatureTransaction := BuildMultiSignatureRegistration(transaction, "your passphrase", "")
>> &Transaction{Type: 4, ...}
Crypto / API Documentation / Transactions / MultiPaymentBuilder

Create a multi-payment transaction

func BuildMultiPayment(transaction *Transaction, passphrase string, secondPassphrase string) *Transaction

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to be populated and signed.
stringpassphraseYesPassphrase associated with the account sending this transaction.
stringsecondPassphraseNoSecond passphrase for the account, if available.

Return Value

This function sets all fields and signs a multi-payment transaction.

multiPaymentTransaction := BuildMultiPayment(transaction, "your passphrase", "")
>> &Transaction{Type: 6, ...}
Crypto / API Documentation / Transactions / ValidatorResignationBuilder

Create a validator resignation transaction

func BuildValidatorResignation(transaction *Transaction, passphrase string, secondPassphrase string) *Transaction

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to be populated and signed.
stringpassphraseYesPassphrase associated with the account sending this transaction.
stringsecondPassphraseNoSecond passphrase for the account, if available.

Return Value

This function sets all fields and signs a validator resignation transaction.

validatorResignationTransaction := BuildValidatorResignation(transaction, "your passphrase", "")
>> &Transaction{Type: 7, ...}

Serializer

Crypto / API Documentation / Transactions / Serializer

Serialize a transaction

func (transaction *Transaction) serialize(includeSignature bool, includeSecondSignature bool, includeMultiSignatures bool) []byte

Parameters

TypeNameRequiredDescription
boolincludeSignatureYesWhether to include the transaction signature in the serialized data.
boolincludeSecondSignatureYesWhether to include the second signature in the serialized data.
boolincludeMultiSignaturesYesWhether to include all multi-signatures in the serialized data.

Return Value

This method serializes the transaction according to the provided parameters.

serializedTransaction := transaction.Serialize(true, true, true)
>> []byte{0xff, 0x01, 0x1e, ...}

Serialize transaction header

func (transaction *Transaction) serializeHeader(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized header will be written.

Return Value

This method serializes the transaction header into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeHeader(ser)
>> None

Serialize transaction vendor field

func (transaction *Transaction) serializeVendorField(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized vendor field will be written.

Return Value

This method serializes the transaction vendor field into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeVendorField(ser)
>> None

Serialize transaction type-specific data

func (transaction *Transaction) serializeTypeSpecific(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized type-specific data will be written.

Return Value

This method serializes the transaction type-specific data into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeTypeSpecific(ser)
>> None

Serialize transaction signatures

func (transaction *Transaction) serializeSignatures(ser *bytes.Buffer, includeSignature bool, includeSecondSignature bool, includeMultiSignatures bool)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized signatures will be written.
boolincludeSignatureYesWhether to include the transaction signature in the serialized data.
boolincludeSecondSignatureYesWhether to include the second signature in the serialized data.
boolincludeMultiSignaturesYesWhether to include all multi-signatures in the serialized data.

Return Value

This method serializes the transaction signatures into the provided buffer based on the provided flags.

ser := new(bytes.Buffer)
transaction.serializeSignatures(ser, true, false, true)
>> None

Serialize a transfer transaction

func (transaction *Transaction) serializeTransfer(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized transfer transaction will be written.

Return Value

This method serializes the transfer transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeTransfer(ser)
>> None

Serialize a vote transaction

func (transaction *Transaction) serializeVote(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized vote transaction will be written.

Return Value

This method serializes the vote transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeVote(ser)
>> None

Serialize a validator registration transaction

func (transaction *Transaction) serializeValidatorRegistration(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized validator registration transaction will be written.

Return Value

This method serializes the validator registration transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeValidatorRegistration(ser)
>> None

Serialize a multi-signature registration transaction

func (transaction *Transaction) serializeMultiSignatureRegistration(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized multi-signature registration transaction will be written.

Return Value

This method serializes the multi-signature registration transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeMultiSignatureRegistration(ser)
>> None

Serialize a multi-payment transaction

func (transaction *Transaction) serializeMultiPayment(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized multi-payment transaction will be written.

Return Value

This method serializes the multi-payment transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeMultiPayment(ser)
>> None

Serialize a validator resignation transaction

func (transaction *Transaction) serializeValidatorResignation(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized validator resignation transaction will be written.

Return Value

This method serializes the validator resignation transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeValidatorResignation(ser)
>> None

Serialize a username registration transaction

func (transaction *Transaction) serializeUsernameRegistration(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized username registration transaction will be written.

Return Value

This method serializes the username registration transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeUsernameRegistration(ser)
>> None

Serialize a username resignation transaction

func (transaction *Transaction) serializeUsernameResignation(ser *bytes.Buffer)

Parameters

TypeNameRequiredDescription
*bytes.BufferserYesBuffer to which the serialized username resignation transaction will be written.

Return Value

This method serializes the username resignation transaction into the provided buffer.

ser := new(bytes.Buffer)
transaction.serializeUsernameResignation(ser)
>> None

Deserializer

Crypto / API Documentation / Transactions / Deserializer

Deserialize a transaction

func DeserializeTransaction(serialized string) *Transaction

Parameters

TypeNameRequiredDescription
stringserializedYesHex-encoded serialized transaction string.

Return Value

This function deserializes a hex-encoded serialized transaction string into a `Transaction` object.

transaction := DeserializeTransaction("ff011e0300000000000000000000000000...")
>> &Transaction{
     Type:            0,
     TypeGroup:       1,
     Nonce:           1,
     SenderPublicKey: "036a16b1b5d4a7edb2e1055d3adcf13a71d380d33...",
     Fee:             10000000,
     Amount:          200000000,
     RecipientId:     "0x21a9460c9a92fe61498d7f4623c8cd7bc3831e47",
     Signature:       "3045022100df8b7e9b8a4a7b6dbf...",
   }

Deserialize transaction header

func deserializeHeader(transaction *Transaction) int

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to populate with header data.

Return Value

This method deserializes the header of the transaction and returns the offset for further deserialization.

offset := deserializeHeader(transaction)
>> 59

Deserialize transaction type-specific data

func deserializeTypeSpecific(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with type-specific data.

Return Value

This method deserializes the type-specific data of the transaction based on its type and updates the transaction object.

transaction = deserializeTypeSpecific(offset, transaction)
>> &Transaction{...}

Deserialize common transaction data

func deserializeCommon(transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
*TransactiontransactionYesTransaction object to populate with common data.

Return Value

This method deserializes the common data of the transaction and updates the transaction object.

transaction = deserializeCommon(transaction)
>> &Transaction{...}

Deserialize a transfer transaction

func deserializeTransfer(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with transfer data.

Return Value

This method deserializes a transfer transaction from the provided offset and updates the transaction object.

transaction = deserializeTransfer(offset, transaction)
>> &Transaction{
     Amount:      100000000,
     RecipientId: "0x1234567890abcdef...",
   }

Deserialize a vote transaction

func deserializeVote(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with vote data.

Return Value

This method deserializes a vote transaction from the provided offset and updates the transaction object.

transaction = deserializeVote(offset, transaction)
>> &Transaction{
     Asset: &TransactionAsset{
       Votes:   []string{"+036a16b1b5d4a7edb2e1055d3adcf13a71d380d33..."},
       Unvotes: []string{"-036a16b1b5d4a7edb2e1055d3adcf13a71d380d33..."},
     },
   }

Deserialize a validator registration transaction

func deserializeValidatorRegistration(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with validator registration data.

Return Value

This method deserializes a validator registration transaction from the provided offset and updates the transaction object.

transaction = deserializeValidatorRegistration(offset, transaction)
>> &Transaction{
     Asset: &TransactionAsset{
       Validator: &ValidatorAsset{
         ValidatorPublicKey: "abcdef1234567890abcdef1234567890...",
       },
     },
   }

Deserialize a multi-signature registration transaction

func deserializeMultiSignatureRegistration(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with multi-signature registration data.

Return Value

This method deserializes a multi-signature registration transaction from the provided offset and updates the transaction object.

transaction = deserializeMultiSignatureRegistration(offset, transaction)
>> &Transaction{
     Asset: &TransactionAsset{
       MultiSignature: &MultiSignatureRegistrationAsset{
         Min:        2,
         PublicKeys: []string{"036a16b1b5d4a7edb2e1055d3adcf13a71d380d33...", "02a123b4c5d6e7f8g9h0i1j2k3l4m5n6o7p8q9r0..."},
       },
     },
   }

Deserialize a multi-payment transaction

func deserializeMultiPayment(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with multi-payment data.

Return Value

This method deserializes a multi-payment transaction from the provided offset and updates the transaction object.

transaction = deserializeMultiPayment(offset, transaction)
>> &Transaction{
     Asset: &TransactionAsset{
       Payments: []*MultiPaymentAsset{
         {
           Amount:      50000000,
           RecipientId: "0xabcdef1234567890abcdef1234567890...",
         },
         {
           Amount:      100000000,
           RecipientId: "0x1234567890abcdef1234567890abcdef...",
         },
       },
     },
   }

Deserialize a validator resignation transaction

func deserializeValidatorResignation(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with validator resignation data.

Return Value

This method deserializes a validator resignation transaction from the provided offset and updates the transaction object.

transaction = deserializeValidatorResignation

(offset, transaction)
>> &Transaction{...}

Deserialize a username registration transaction

func deserializeUsernameRegistration(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with username registration data.

Return Value

This method deserializes a username registration transaction from the provided offset and updates the transaction object.

transaction = deserializeUsernameRegistration(offset, transaction)
>> &Transaction{
     Asset: &TransactionAsset{
       Username: &UsernameAsset{
         Username: "myUsername",
       },
     },
   }

Deserialize a username resignation transaction

func deserializeUsernameResignation(typeSpecificOffset int, transaction *Transaction) *Transaction

Parameters

TypeNameRequiredDescription
inttypeSpecificOffsetYesOffset to start reading type-specific data from.
*TransactiontransactionYesTransaction object to populate with username resignation data.

Return Value

This method deserializes a username resignation transaction from the provided offset and updates the transaction object.

transaction = deserializeUsernameResignation(offset, transaction)
>> &Transaction{...}

Message

Crypto / API Documentation / Utils / Message

Sign a message

func SignMessage(message string, passphrase string) (*Message, error)

Parameters

TypeNameRequiredDescription
stringmessageYesThe message to be signed.
stringpassphraseYesThe passphrase to sign the message with.

Return Value

This function returns a `Message` object containing the signed message, public key, and signature.

signedMessage, _ := SignMessage("Hello, Ark!", "super secret passphrase")
>> &Message{
     Message:   "Hello, Ark!",
     PublicKey: "03f35d6b51212d0bf3467f57402414f13b46c7...",
     Signature: "3045022100f0d1a7b5d10255d9b7c4...",
   }

Verify the message

func (message *Message) Verify() (bool, error)

Parameters

TypeNameRequiredDescription
*MessagemessageYesThe message object containing the message, public key, and signature.

Return Value

This method verifies the signed message. Returns `true` if the message is verified successfully, otherwise returns `false` and an error.

isVerified, _ := signedMessage.Verify()
>> true

Convert message to a map

func (message *Message) ToMap() map[string]interface{}

Return Value

This method returns a map representation of the message object, including the public key, message, and signature.

messageMap := signedMessage.ToMap()
>> map[string]interface{}{
     "message":   "Hello, Ark!",
     "publickey": "03f35d6b51212d0bf3467f57402414f13b46c7...",
     "signature": "3045022100f0d1a7b5d10255d9b7c4...",
   }

Convert message to JSON

func (message *Message) ToJson() (string, error)

Return Value

This method returns a JSON string representation of the message object, including the public key, message, and signature.

messageJson, _ := signedMessage.ToJson()
>> '{"message":"Hello, Ark!","publickey":"03f35d6b51212d0bf3467f57402414f13b46c7...","signature":"3045022100f0d1a7b5d10255d9b7c4..."}'

Slot

Crypto / API Documentation / Utils / Slot

Get the time difference between now and network start

func GetTime() int32

Return Value

This function returns the time difference in seconds between the current time and the network start time as an integer.

timeDiff := GetTime()
>> 123456789

Get the network epoch time

func GetEpoch() uint32

Return Value

This function returns the network start epoch time as a Unix timestamp.

epochTime := GetEpoch()
>> 1490101200