Public layer
The PHP client library can be used to create, sign and broadcast transactions to an LTO public node.
Transaction types
Transfer
Send LTO tokens from your account to another account.
Optionally you can set an attachment message for the transfer.
Mass Transfer
The Mass Transfer transaction is used to send LTO tokens from one account to multiple recipients. Recipients are added with the addTransfer()
method.
Optionally you can set an attachment for the mass transfer. The message applies to all recipients. It's not possible to specify a message per recipient.
Mass transfer transactions have a base fee + a fee per recipient.
Lease
Start leasing LTO to a node. This increased the chance for a node to mine a block and thus will increase mining rewards. Community nodes typically share this reward among the leasers. The leased tokens do not leave your wallet.
Cancel Lease
A lease can be canceled at any time through a Cancel Lease transaction. To cancel a lease, you need the id of the transaction that created the lease.
Alternatively, create a Cancel Lease transaction from an existing Lease transaction using $leaseTx->cancel()
. Note that the new Cancel Lease transaction needs to be signed and broadcasted.
Sponsor
Sponsor an account, offering to pay for all transaction fees for that account.
You should only sponsor an account you trust, and/or have a legally binding agreement with. A sponsored account holder can easily drain your account through spam transactions. If the account holder is running a node, he/she can claim part of the spend tokens as mining reward. Limit the amount of tokens on the sponsoring account, adding funds when necessary.
Cancel Sponsor
The sponsorship can be canceled at any time through a Cancel Sponsor transaction.
Anchor
Write a hash of a document or data to the blockchain. This makes it possible to prove the timestamp and show the document hasn't been modified or tampered with.
The hash can be given as hexadecimal (hex
) value, which is the default, as binary (raw
) or encoded with base58
or base64
.
A single anchor transaction can anchor up to 100 hashes to the blockchain. Multiple anchors should be added through the addHash()
method.
Anchor transactions have a base fee + a fee per hash.
Use the getHash()
or getHashes()
method to get the hash values with a specific encoding (hex
, raw
, base58
, or base64
).
Association
An association is a uni-directional relationship between two accounts. It can be used for setting up a trust network or as a graph for constructed DID identities.
Type
Associations have a numeric type. This type is context-specific and interpreted by the client applications that index associations.
If you're creating a new protocol or specification that uses associations, please contact LTO Network to request assigning you a numeric range. This prevents choosing values that overlap the range of an existing protocol.
Hash
Optionally the association can have a hash. The meaning of the hash should be specified by the protocol that describes the meaning of the association.
An association with the same sender, recipient, type, and hash overwrites the existing association.
Expiration
An association can expire at a specific date and time.
To prevent the association from expiring, it must be reissued before the expiry date. Calling expiresOn()
on an existing Association transaction creates a new transaction that can be signed and broadcasted.
Revoke Association
Associations can be revoked at any time using a Revoke Association transaction. To revoke an association, the same recipient, type, and hash must be used as when the association was created.
Alternatively, the revoke()
method can be used on an existing association transaction. Note that this transaction needs to be signed and broadcasted.
Set Script
Smart accounts have a custom script that defines how transactions should be validated. The script needs to be compiled by the node before it's broadcasted as a transaction.
Scripts are written in the Ride programming language.
Clearing a script
To clear a script, use the Set Script transaction with a NULL script.
Sponsored fee
By default the account that signs the transaction has to pay the transaction fee. It's possible for another account to pay the fee instead through the sponsored fee feature.
In this example, a zero-anchor transaction is done by a new account to register it as an implicit identity.
Multiple signatures
For smart accounts, a transaction might need multiple signatures. This can be done by calling signWith()
multiple times.
It's unlikely that you'll have the private keys of all accounts at the same time because typically with multisig each key is controlled by a different individual. Instead, should store the signed transaction or share it (over the private layer) to have the second account add a signature and broadcast it.
Last updated