Transaction

Signing

LGCY’s transaction signing process follows a standard ECDSA cryptographic algorithm, with a SECP256K1 selection curve. A private key is a random number, and the public key is a point on the elliptic curve. The public key generation process consists of first generating a random number as a private key, and then multiplying the base point of the elliptic curve by the private key to obtain the public key. When a transaction occurs, the transaction raw data is first converted into byte format. The raw data then undergoes SIN-256 hashing. The private key corresponding to the contract address then signs the result of the SIN256 hash. The signature result is then added to the transaction.

BANDWIDTH MODEL

Ordinary transactions only consume bandwidth points, but smart contract operations consume both energy and bandwidth points. There are two types of bandwidth points available. Users can gain bandwidth points from freezing LGCY, while 5000 free bandwidth points are also available daily.

When a LGCY transaction is broadcast, it is transmitted and stored in the form of a byte array over the network. Bandwidth Points consumed by one transaction = number of transaction bytes multiplied by bandwidth points rate. For example, if the byte array length of a transaction is 200, then the transaction consumes 200 bandwidth points. However, if a LGCY or token transfer results in the target account being created, then only the bandwidth points consumed to create the account will be deducted, and additional bandwidth points will not be deducted. In an account creation scenario, the network will first consume the bandwidth points that the transaction initiator gained from freezing LGCY. If this amount is insufficient, then the network consumes the transaction initiator’s LGCY.

In standard LGCY transfer scenarios from one LGCY account to another, the network first consumes the bandwidth points gained by the transaction initiator for freezing LGCY. If that is insufficient, it then consumes from the free 5000 daily bandwidth points. If that is still not enough, then the network consumes the LGCY of the transaction initiator. The amount is calculated by the number of bytes in the transaction multiplied by 10 DRIPS. Thus, for most LGCY holders who may not necessarily freeze their LGCY to participate in GB voting, the first step is automatically skipped (since LGCY balance frozen = 0) and the 5000 daily free bandwidth powers the transaction.

For LRC-10 token transfers, the network first verifies whether the total free bandwidth points of the issued token asset are sufficient. If not, the bandwidth points obtained from freezing LGCY are consumed. If there are still not enough bandwidth points, then it consumes the LGCY of the transaction initiator.

FEE

LGCY Network generally does not charge fees for most transactions, however, due to system restrictions and fairness, bandwidth usage and transactions do take in certain fees.

Fee charges are broken down into the following categories:

  1. Normal transactions cost bandwidth points. Users can use the free daily bandwidth points (5000) or freeze LGCY to obtain more. When bandwidth points are not enough, LGCY will be used directly from the sending account. The LGCY needed is the number of bytes * 10 DRIPS.

  2. Smart contracts cost energy but will also need bandwidth points for the transaction to be broadcasted and confirmed. The bandwidth cost is the same as above.

  3. All query transactions are free. It doesn’t cost energy or bandwidth.

LGCY Network also defines a set of fixed fees for the following transactions:

  1. Creating a witness node: 9999 LGCY

  2. Issuing a TRC-10 token: 1024 LGCY

  3. Creating a new account: 0.1 LGCY

  4. Creating an exchange pair: 1024 LGCY

TRANSACTION AS PROOF OF STAKE (TAPOS)

LGCY uses TaPoS to ensure the transactions all confirm the main blockchain, while making it difficult to forge counterfeit chains. In TaPoS, the networks require each transaction include part of the hash of a recent block header. This requirement prevents transactions from being replayed on forks not including the referenced block, and also signals the network that a particular user and their stake are on a specific fork. This consensus mechanism protects the network against Denial of Service, 51%, selfish mining, and double spend attacks.

TRANSACTION CONFIRMATION

A transaction is included in a future block after being broadcast to the network. After 19 blocks are mined on LGCY (including its own block), the transaction is confirmed. Each block is produced by one of the top 27 Governing Branches in a round robin fashion. Each block takes ~3 seconds to be mined on the blockchain. Time may slightly vary for each Governing Branch due to network conditions and machine configurations. In general, a transaction is considered fully confirmed after ~1 minute.

STRUCTURE

Transaction APIs consist of the following functions:

message Transaction {

message Contract {

enum ContractType {

AccountCreateContract = 0; // Create account/wallet

TransferContract = 1; // Transfer LGCY

TransferAssetContract = 2; // Transfer LRC10 token

VoteWitnessContract = 4; // Vote for Governing Branch (GB)

WitnessCreateContract = 5; // Create a new GB account

AssetIssueContract = 6; // Create a new LRC10 token

WitnessUpdateContract = 8; // Update GB information

ParticipateAssetIssueContract = 9; // Purchase LRC10 token

AccountUpdateContract = 10; // Update account/wallet information

FreezeBalanceContract = 11; // Freeze LGCY for bandwidth or energy

UnfreezeBalanceContract = 12; // Unfreeze LGCY

WithdrawBalanceContract = 13; // Withdraw GB rewards, once per day

UnfreezeAssetContract = 14; // Unfreeze LRC10 token

UpdateAssetContract = 15; // Update a LRC10 token’s information

ProposalCreateContract = 16; // Create a new network proposal by any GB

ProposalApproveContract = 17; // GB votes yes for a network proposal

ProposalDeleteContract = 18; // Delete a network proposal by owner

CreateSmartContract = 30; // Deploy a new smart contract

TriggerSmartContract = 31; // Call a function on a smart contract

GetContract = 32; // Get an existing smart contract

UpdateSettingContract = 33; // Update a smart contract’s parameters

ExchangeCreateContract = 41; // Create a token trading pair on DEX

ExchangeInjectContract = 42; // Inject funding into a trading pair

ExchangeWithdrawContract = 43; // Withdraw funding from a trading pair

ExchangeTransactionContract = 44; // Perform token trading

UpdateEnergyLimitContract = 45; // Update origin_energy_limit on a smart contract

}

}

}

Last updated