PHPackages                             mx-dec0de/minter-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mx-dec0de/minter-php-sdk

ActiveLibrary[API Development](/categories/api)

mx-dec0de/minter-php-sdk
========================

v3.0.4(5y ago)0201PHPPHP ^7.1.3

Since Nov 26Pushed 5y agoCompare

[ Source](https://github.com/mx-dec0de/minter-php-sdk)[ Packagist](https://packagist.org/packages/mx-dec0de/minter-php-sdk)[ RSS](/packages/mx-dec0de-minter-php-sdk/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (41)Used By (0)

[![](minter-logo.svg)](minter-logo.svg)

About
-----

[](#about)

This is a pure PHP SDK for working with **Minter** blockchain

- [Installation](#installing)
- [Minter Api](#using-minterapi)

    - Methods:
        - [getBalance](#getbalance)
        - [getNonce](#getnonce)
        - [send](#send)
        - [getAddresses](#getaddresses)
        - [getStatus](#getstatus)
        - [getValidators](#getvalidators)
        - [estimateCoinBuy](#estimatecoinbuy)
        - [estimateCoinSell](#estimatecoinsell)
        - [estimateCoinSellAll](#estimatecoinsellall)
        - [getCoinInfo](#getcoininfo)
        - [getBlock](#getblock)
        - [getEvents](#getevents)
        - [getTransaction](#gettransaction)
        - [getCandidate](#getcandidate)
        - [getCandidates](#getcandidates)
        - [estimateTxCommission](#estimatetxcommission)
        - [getTransactions](#gettransactions)
        - [getUnconfirmedTxs](#getunconfirmedtxs)
        - [getMaxGasPrice](#getmaxgasprice)
        - [getMinGasPrice](#getmingasprice)
        - [getMissedBlocks](#getmissedblocks)
        - [getWaitlist](#getwaitlist)
        - [getPriceCommissions](#getPriceCommissions)
        - [getPriceVotes](#getPriceCommissions)
        - [getSwapPool](#getSwapPool)
        - [getSwapPoolProvider](#getSwapPoolProvider)
    - [Error handling](#error-handling)
- [Minter SDK](#using-mintersdk)

    - [Sign transaction](#sign-transaction)
        - [SendCoin](#example-3)
        - [SellCoin](#example-4)
        - [SellAllCoin](#example-5)
        - [BuyCoin](#example-6)
        - [CreateCoin](#example-7)
        - [DeclareCandidacy](#example-8)
        - [Delegate](#example-9)
        - [SetCandidateOn](#example-10)
        - [SetCandidateOff](#example-11)
        - [RedeemCheck](#example-12)
        - [Unbond](#example-13)
        - [MultiSend](#example-14)
        - [EditCandidate](#example-15)
        - [CreateMultisig](#example-16)
        - [SetHaltBlock](#example-17)
        - [RecreateCoin](#example-18)
        - [EditCoinOwner](#example-19)
        - [EditMultisig](#example-20)
        - [PriceVote](#example-21)
        - [EditCandidatePublicKey](#example-22)
        - [AddLiquidity](#example-23)
        - [RemoveLiquidity](#example-24)
        - [SellSwapPool](#example-25)
        - [BuySwapPool](#example-26)
        - [SellAllSwapPool](#example-27)
        - [EditCandidateCommission](#example-28)
        - [MoveStake](#example-29)
        - [MintToken](#example-30)
        - [BurnToken](#example-31)
        - [CreateToken](#example-32)
        - [RecreateToken](#example-33)
        - [PriceCommission](#example-34)
        - [CreateSwapPool](#example-35)
    - [Sign transaction with multisignatures](#sign-transaction-with-multisignatures)
    - [Get fee of transaction](#get-fee-of-transaction)
    - [Decode Transaction](#decode-transaction)
    - [Minter Check](#create-minter-check)
    - [Minter Wallet](#minter-wallet)
    - [Minter Link](#minter-link)
- [Tests](#tests)

Installing
----------

[](#installing)

```
composer require minter/minter-php-sdk
```

Using MinterAPI
---------------

[](#using-minterapi)

You can get all valid responses and full documentation at [Minter Node Api](https://docs.minter.network/)

Create MinterAPI instance

```
use Minter\MinterAPI;

$nodeUrl = 'https://minter-node-1.testnet.minter.network:8843/v2/'; // example of a node url

$api = new MinterAPI($nodeUrl);
```

### getBalance

[](#getbalance)

Returns coins list, balance and transaction count (for nonce) of an address.

`getBalance(string $minterAddress, ?int $height = null): \stdClass`

###### Example

[](#example)

```
$api->getBalance('Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99')

// {"jsonrpc": "2.0", "id": "", "result": { "balance": { ... }, "transaction_count": "0"}}
```

### getNonce

[](#getnonce)

Returns next transaction number (nonce) of an address.

`getNonce(string $minterAddress): int`

###### Example

[](#example-1)

```
$api->getNonce('Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99')
```

### send

[](#send)

Returns the result of sending **signed** tx.

⚠️ **To ensure that transaction was successfully committed to the blockchain, you need to find the transaction by the hash and ensure that the status code equals to 0.**

`send(string $tx): \stdClass`

###### Example

[](#example-2)

```
$api->send('f873010101aae98a4d4e540000000000000094fe60014a6e9ac91618f5d1cab3fd58cded61ee99880de0b6b3a764000080801ca0ae0ee912484b9bf3bee785f4cbac118793799450e0de754667e2c18faa510301a04f1e4ed5fad4b489a1065dc1f5255b356ab9a2ce4b24dde35bcb9dc43aba019c')
```

### getAddresses

[](#getaddresses)

Returns addresses balances.

`getAddresses(array $addresses, ?int $height = null): \stdClass`

### getStatus

[](#getstatus)

Returns node status info.

`getStatus(): \stdClass`

### getValidators

[](#getvalidators)

Returns list of active validators.

`getValidators(?int $height = null, ?int $page = 1, ?int $perPage = null): \stdClass`

### estimateCoinBuy

[](#estimatecoinbuy)

Return estimate of buy coin transaction.

`estimateCoinBuy(string $coinToSell, string $valueToBuy, string $coinToBuy, ?int $height = null): \stdClass`

### estimateCoinSell

[](#estimatecoinsell)

Return estimate of sell coin transaction.

`estimateCoinSell(string $coinToSell, string $valueToSell, string $coinToBuy, ?int $height = null): \stdClass`

### estimateCoinSellAll

[](#estimatecoinsellall)

Return estimate of sell coin all transaction.

`estimateCoinSellAll(string $coinToSell, string $valueToSell, string $coinToBuy, ?int $height = null): \stdClass`

### getCoinInfo

[](#getcoininfo)

Returns information about coin. Note: this method does not return information about base coins (MNT and BIP).

`getCoinInfo(string $coin, ?int $height = null): \stdClass`

### getBlock

[](#getblock)

Returns block data at given height.

`getBlock(int $height): \stdClass`

### getEvents

[](#getevents)

Returns events at given height.

`getEvents(int $height): \stdClass`

### getTransaction

[](#gettransaction)

Returns transaction info.

`getTransaction(string $hash): \stdClass`

### getCandidate

[](#getcandidate)

Returns candidate’s info by provided public\_key. It will respond with 404 code if candidate is not found.

`getCandidate(string $publicKey, ?int $height = null): \stdClass`

### getCandidates

[](#getcandidates)

Returns list of candidates.

$height is optional parameter.

`getCandidates(?int $height = null, ?bool $includeStakes = false): \stdClass`

### estimateTxCommission

[](#estimatetxcommission)

Returns estimate of transaction.

`estimateTxCommission(string $tx, ?int $height = null): \stdClass`

### getTransactions

[](#gettransactions)

Returns transactions by query.

`getTransactions(string $query, ?int $page = null, ?int $perPage = null): \stdClass`

### getUnconfirmedTxs

[](#getunconfirmedtxs)

Returns unconfirmed transactions.

`getUnconfirmedTxs(?int $limit = null): \stdClass`

### getMaxGasPrice

[](#getmaxgasprice)

Returns current max gas price.

`getMaxGasPrice(?int $height = null): \stdClass`

### getMinGasPrice

[](#getmingasprice)

Returns current min gas price.

`getMinGasPrice(): \stdClass`

### getMissedBlocks

[](#getmissedblocks)

Returns missed blocks by validator public key.

`getMissedBlocks(string $pubKey, ?int $height = null): \stdClass`

### getGenesis

[](#getgenesis)

Returns network genesis.

`getGenesis(): \stdClass`

### getNetworkInfo

[](#getnetworkinfo)

Returns node network information.

`getNetworkInfo(): \stdClass`

### getWaitlist

[](#getwaitlist)

Returns waitlisted stakes by address

`getWaitlist(string $address, ?string $publicKey = null, ?int $height = null): \stdClass`

### getWaitlist

[](#getwaitlist-1)

Returns waitlisted stakes by address

`getWaitlist(string $address, ?string $publicKey = null, ?int $height = null): \stdClass`

### getPriceCommissions

[](#getpricecommissions)

Returns the list of the commissions that are set up on the Minter Network

`getPriceCommissions(?int $height = null): \stdClass`

### getPriceVotes

[](#getpricevotes)

Returns the list of validators' votes for changing commissions on the network

`getPriceVotes(int $height): \stdClass`

### getSwapPool

[](#getswappool)

Returns entire liquidity volume of the swap pool

`getSwapPool(string $coin0, string $coin1, ?int $height = null): \stdClass`

### getSwapPoolProvider

[](#getswappoolprovider)

Returns liquidity volume of the swap pool provided by specified address

`getSwapPoolProvider(string $coin0, string $coin1, string $provider, ?int $height = null): \stdClass`

### Error handling

[](#error-handling)

Example of how you can handle errors and get the response body.

```
use Minter\MinterAPI;
use GuzzleHttp\Exception\RequestException;

// create instance
$api = new MinterAPI('node url here');

try {
    // success response
    $response = $api->send('signed tx here');
} catch(RequestException $exception) {
    // short exception message
    $message = $exception->getMessage();

    // error response in json
    $content = $exception->getResponse()
                    ->getBody()
                    ->getContents();

    // error response as array
    $error = json_decode($content, true);
}
```

Using MinterSDK
---------------

[](#using-mintersdk)

### Sign transaction

[](#sign-transaction)

Returns a signed tx.

###### Example

[](#example-3)

- Sign the **SendCoin** transaction
- Constructor: `MinterSendCoinTx($coin, $to, $value)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSendCoinTx;

$data = new MinterSendCoinTx($coinID, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99', '10');
$tx = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

**At all type of transactions you can also set optional fields: gas price, gas coin, payload, serviceData, chain id**

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSendCoinTx;

$data = new MinterSendCoinTx($coinID, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99', '10');
$tx   = (new MinterTx($nonce, $data))
   ->setChainID(MinterTx::TESTNET_CHAIN_ID)
   ->setGasPrice(1)
   ->setGasCoin(MinterTx::BASE_COIN_ID)
   ->setPayload('some payload')
   ->setServiceData('some data')

$tx->sign('your private key')
```

###### Example

[](#example-4)

- Sign the **SellCoin** transaction
- Constructor: `MinterSellCoinTx($coinToSell, $valueToSell, $coinToBuy, $minimumValueToBuy)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSellCoinTx;

$data = new MinterSellCoinTx(123, '1', 321, '1');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-5)

- Sign the **SellAllCoin** transaction
- Constructor: `MinterSellAllCoinTx($coinToSell, $coinToBuy, $minimumValueToBuy)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSellAllCoinTx;

$data = new MinterSellAllCoinTx(123, 321, '1');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-6)

- Sign the **BuyCoin** transaction
- Constructor: `MinterBuyCoinTx($coinToBuy, $valueToBuy, $coinToSell, $maximumValueToSell)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterBuyCoinTx;

$data = new MinterBuyCoinTx(123, '1', 321, '1');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-7)

- Sign the **CreateCoin** transaction
- Constructor: `MinterCreateCoinTx($name, $symbol, $amount, $reserve, $crr, $maxSupply)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterCreateCoinTx;

$data = new MinterCreateCoinTx('TEST COIN', 'TEST', '10000', '10', 10, '10000');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-8)

- Sign the **DeclareCandidacy** transaction
- Constructor: `MinterDeclareCandidacyTx($address, $publicKey, $commission, $coin, $stake)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterDeclareCandidacyTx;

$data = new MinterDeclareCandidacyTx(
    'Mxa7bc33954f1ce855ed1a8c768fdd32ed927def47',
    'Mp023853f15fc1b1073ad7a1a0d4490a3b1fadfac00f36039b6651bc4c7f52ba9c02',
    10, 0, '10000'
);

$tx = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-9)

- Sign the **Delegate** transaction
- Constructor: `MinterDelegateTx($publicKey, $coin, $stake)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterDelegateTx;

$data = new MinterDelegateTx('Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43', 123, '10000');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-10)

- Sign the **SetCandidateOn** transaction
- Constructor: `MinterSetCandidateOnTx($publicKey)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSetCandidateOnTx;

$data = new MinterSetCandidateOnTx('Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-11)

- Sign the **SetCandidateOff** transaction
- Constructor: `MinterSetCandidateOffTx($publicKey)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSetCandidateOffTx;

$data = new MinterSetCandidateOffTx('Mp0eb98ea04ae466d8d38f490db3c99b3996a90e24243952ce9822c6dc1e2c1a43');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-12)

- Sign the **RedeemCheck** transaction
- Constructor: `MinterRedeemCheckTx($check, $proof)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterRedeemCheckTx;

$data = new MinterRedeemCheckTx('your check', 'created by MinterCheck proof');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-13)

- Sign the **Unbond** transaction
- Constructor: `MinterUnbondTx($publicKey, $coin, $value)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterUnbondTx;

$data = new MinterUnbondTx('Mp....', 123, '10000');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-14)

- Sign the **MultiSend** transaction
- Constructor: `MinterMultiSendTx($list)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSendCoinTx;
use Minter\SDK\MinterCoins\MinterMultiSendTx;

$data = new MinterMultiSendTx([
    new MinterSendCoinTx(0, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99', '15'),
    new MinterSendCoinTx(123, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee92', '10')
]);

$tx = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-15)

- Sign the **EditCandidate** transaction
- Constructor: `MinterEditCandidateTx($publicKey, $rewardAddress, $ownerAddress, $controlAddress)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterEditCandidateTx;

$data = new MinterEditCandidateTx('candidate public key', 'Minter address for rewards', 'Minter address of owner', 'Minter address for control');
$tx   = new MinterTx($nonce, $data);

$tx->sign('your private key')
```

###### Example

[](#example-16)

- Sign the **CreateMultisig** transaction
- Constructor: `MinterCreateMultisigTx($threshold, $weights, $addresses)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterCreateMultisigTx;

$data = new MinterCreateMultisigTx(7, [1, 3, 5], [
    'Mxee81347211c72524338f9680072af90744333143',
    'Mxee81347211c72524338f9680072af90744333145',
    'Mxee81347211c72524338f9680072af90744333144'
]);

$tx = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-17)

- Sign the **SetHaltBlock** transaction
- Constructor: `MinterSetHaltBlockTx($publicKey, $height)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSetHaltBlockTx;

$data = new MinterSetHaltBlockTx('your public key', 236503);
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-18)

- Sign the **RecreateCoin** transaction
- Constructor: `MinterRecreateCoinTx($name, $symbol, $amount, $reserve, $crr, $maxSupply)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterRecreateCoinTx;

$data = new MinterRecreateCoinTx('TEST', '10000', '10', 10000, 10, '10000');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-19)

- Sign the **EditCoinOwner** transaction
- Constructor: `MinterEditCoinOwnerTx($symbol, $newOwner)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterEditCoinOwnerTx;

$data = new MinterEditCoinOwnerTx('COINSYMBOL', 'Mxee81347211c72524338f9680072af90744333145');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-20)

- Sign the **EditMultisig** transaction
- Constructor: `MinterEditMultisigTx($threshold, $weights, $addresses)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterEditMultisigTx;

$data = new MinterEditMultisigTx(1, [1, 2], ['Mxee81347211c72524338f9680072af90744333145', 'Mxee81347211c72524338f9680072af90744333146']);
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-21)

- Sign the **PriceVote** transaction
- Constructor: `MinterPriceVoteTx($price)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterPriceVoteTx;

$data = new MinterPriceVoteTx(1000);
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-22)

- Sign the **EditCandidatePublicKey** transaction
- Constructor: `MinterEditCandidatePublicKeyTx($publicKey, $newPublicKey)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterEditCandidatePublicKeyTx;

$data = new MinterEditCandidatePublicKeyTx('public key', 'new public key....');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-23)

- Sign the **AddLiquidity** transaction
- Constructor: `MinterAddLiquidityTx($coin0, $coin1, $volume0, $maximumVolume1)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterAddLiquidityTx;

$data = new MinterAddLiquidityTx(0, 1, '1000', '2000');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-24)

- Sign the **RemoveLiquidity** transaction
- Constructor: `MinterRemoveLiquidityTx($coin0, $coin1, $liquidity, $minimumVolume0, $minimumVolume1)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterRemoveLiquidityTx;

$data = new MinterRemoveLiquidityTx(0, 1, '2000', '500', '1000');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-25)

- Sign the **SellSwapPool** transaction
- Constructor: `MinterSellSwapPoolTx($coinToSell, $valueToSell, $coinToBuy, $minimumValueToBuy)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSellSwapPoolTx;

$data = new MinterSellSwapPoolTx(0, '100', 1, '200');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-26)

- Sign the **BuySwapPool** transaction
- Constructor: `MinterBuySwapPoolTx($coinToBuy, $valueToBuy, $coinToSell, $maximumValueToSell)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterBuySwapPoolTx;

$data = new MinterBuySwapPoolTx(0, '100', 1, '200');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-27)

- Sign the **SellAllSwapPool** transaction
- Constructor: `MinterSellAllSwapPoolTx($coinToSell, $coinToBuy, $minimumValueToBuy)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSellAllSwapPoolTx;

$data = new MinterSellAllSwapPoolTx(0, 1, '100');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-28)

- Sign the **EditCandidateCommission** transaction
- Constructor: `MinterEditCandidateCommissionTx($publicKey, $commission)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterEditCandidateCommissionTx;

$data = new MinterEditCandidateCommissionTx('public key', 77);
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-29)

- Sign the **MoveStake** transaction
- Constructor: `MinterMoveStakeTx($from, $to, $coin, $stake)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterEditCandidateCommissionTx;

$data = new MinterEditCandidateCommissionTx('from public key', 'to public key', 1, '3000');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-30)

- Sign the **MintToken** transaction
- Constructor: `MinterMintTokenTx($coin, $value)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterMintTokenTx;

$data = new MinterMintTokenTx(2, '3000');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-31)

- Sign the **BurnToken** transaction
- Constructor: `MinterBurnTokenTx($coin, $value)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterBurnTokenTx;

$data = new MinterBurnTokenTx(3, '100000');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-32)

- Sign the **CreateToken** transaction
- Constructor: `MinterCreateTokenTx($name, $symbol, $initialAmount, $maxSupply, $mintable, $burnable)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterCreateTokenTx;

$data = new MinterCreateTokenTx('TEST COIN IS MINTABLE ONLY', 'TEST', '10000', '50000', true, false);
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-33)

- Sign the **RecreateToken** transaction
- Constructor: `MinterRecreateTokenTx($name, $symbol, $initialAmount, $maxSupply, $mintable, $burnable)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterRecreateTokenTx;

$data = new MinterRecreateTokenTx('TEST COIN IS TURNED TO BE BURNABLE ONLY', 'TEST', '50000', '50000', false, true);
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-34)

- Sign the **PriceCommission** transaction
- Constructor: `MinterPriceCommissionTx( $pubKey, $height, $coin, $payloadByte, $send, $buyBancor, $sellBancor, $sellAllBancor, $buyPool, $sellPool, $sellAllPool, $createTicker3, $createTicker4, $createTicker5, $createTicker6, $createTicker7to10, $createCoin, $createToken, $recreateCoin, $recreateToken, $declareCandidacy, $delegate, $unbond, $redeemCheck, $setCandidateOn, $setCandidateOff, $createMultisig, $multisendBase, $multisendDelta, $editCandidate, $setHaltBlock, $editTickerOwner, $editMultisig, $priceVote, $editCandidatePublicKey, $createSwapPool, $addLiquidity, $removeLiquidity, $editCandidateCommission, $moveStake, $burnToken, $mintToken, $voteCommission, $voteUpdate )`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterPriceCommissionTx;

$data = new MinterPriceCommissionTx('public key', 100000,0,'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

###### Example

[](#example-35)

- Sign the **CreateSwapPoll** transaction
- Constructor: `MinterCreateSwapPoolTx($coin0, $coin1, $volume0, $volume1)`

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterCreateSwapPoolTx;

$data = new MinterCreateSwapPoolTx(1, 2, '11000', '22000');
$tx   = new MinterTx($nonce, $data);
$tx->sign('your private key')
```

### Sign transaction with multisignatures

[](#sign-transaction-with-multisignatures)

Returns a signed tx.

###### Example

[](#example-36)

- To sign transaction with multisignatures, you need to call **signMultisig** method and pass **multisig Minter address** and his **private keys** (in any order).

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSendCoinTx;

$data = new MinterSendCoinTx(123, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99', '10');
$tx = new MinterTx($nonce, $data);

$signedTx = $tx->signMultisig('Mxdb4f4b6942cb927e8d7e3a1f602d0f1fb43b5bd2', [
    'b354c3d1d456d5a1ddd65ca05fd710117701ec69d82dac1858986049a0385af9',
    '38b7dfb77426247aed6081f769ed8f62aaec2ee2b38336110ac4f7484478dccb',
    '94c0915734f92dd66acfdc48f82b1d0b208efd544fe763386160ec30c968b4af'
])
```

###### Example

[](#example-37)

- To get the **signature** of transaction (not signed transaction) you need to call **createSignature**

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSendCoinTx;

$data = new MinterSendCoinTx(123, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99', '10');
$tx = new MinterTx($nonce, $data);

$txSignature = $tx->createSignature($privateKey);
```

###### Example

[](#example-38)

- To sign transaction with ready signatures, you need to call **signMultisigBySigns** method and pass **multisig Minter address** and your **signatures** (in any order).

```
use Minter\SDK\MinterTx;
use Minter\SDK\MinterCoins\MinterSendCoinTx;

$data = new MinterSendCoinTx(123, 'Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99', '10');
$tx = new MinterTx($nonce, $data);

$signature1 = $tx->createSignature($privateKey1);
$signature2 = $tx->createSignature($privateKey2);
$signature3 = $tx->createSignature($privateKey3);

$signedTx = $tx->signMultisigBySigns('Mxdb4f4b6942cb927e8d7e3a1f602d0f1fb43b5bd2', [
     $signature1, $signature2, $signature3
])
```

### Get fee of transaction

[](#get-fee-of-transaction)

- Calculate fee of transaction. You can get fee AFTER signing or decoding transaction.

```
use Minter\SDK\MinterTx;

$tx = new MinterTx(...);
$tx->getFee();
```

### Decode transaction

[](#decode-transaction)

Returns an array with transaction data.

###### Example

[](#example-39)

- Decode transaction

```
use Minter\SDK\MinterTx;

$tx = MinterTx::decode('transaction raw starting from 0x...');

// $tx->getSenderAddress()
// $tx->getData()
// $tx->getNonce()
// $tx->getChainID()
// $tx->getGasPrice()
// $tx->getPayload()
// $tx->getSignatureData()
```

### Create Minter Check

[](#create-minter-check)

###### Example

[](#example-40)

- Create check

```
use Minter\SDK\MinterCheck;

$check = new MinterCheck([
    'nonce' => $nonce,
    'chainId' => MinterTx::MAINNET_CHAIN_ID, // or MinterTx::TESTNET_CHAIN_ID
    'dueBlock' => 999999,
    'coin' => 'MNT',
    'value' => '10',
    'gasCoin' => 'MNT'
], 'your pass phrase');

echo $check->sign('your private key here');

// Mc.......
```

- Create proof

```
use Minter\SDK\MinterCheck;

$check = new MinterCheck('your Minter address here', 'your pass phrase');

echo $check->createProof();
```

- Decode check

```
use Minter\SDK\MinterCheck;

$check = new MinterCheck('your Minter check here');

$check->getBody();  // check body

$check->getOwnerAddress(); // check owner address
```

### Minter Wallet

[](#minter-wallet)

###### Example

[](#example-41)

- Create wallet.

```
use Minter\SDK\MinterWallet;

$wallet = new MinterWallet();

// $wallet->getPublicKey();
// $wallet->getPrivateKey();
// $wallet->getMnemonic();
// $wallet->getAddress();
```

- Create wallet from mnemonic

```
use Minter\SDK\MinterWallet;

$wallet = MinterWallet::createFromMnemonic($mnemonic);
```

- Create wallet from private key

```
use Minter\SDK\MinterWallet;

$wallet = MinterWallet::createFromPrivate($privateKey);
```

### Minter Link

[](#minter-link)

###### Example

[](#example-42)

- Create Minter deep link.
- You can pass data of any Minter transaction to the constructor.

```
use Minter\SDK\MinterDeepLink;
use Minter\SDK\MinterCoins\MinterSendCoinTx;

$txData = new MinterSendCoinTx(123, 'Mx18467bbb64a8edf890201d526c35957d82be3d95', '1.23456789');
$link   = new MinterDeepLink($txData);
$link->encode(); // returns encoded link as string
```

- You can define optional fields such as host, payload, nonce, gas price, gas coin, check password.

```
use Minter\SDK\MinterDeepLink;
use Minter\SDK\MinterCoins\MinterSendCoinTx;

$txData = new MinterSendCoinTx(123, 'Mx18467bbb64a8edf890201d526c35957d82be3d95', '1.23456789');
$link   = new MinterDeepLink($txData);

$link->setPayload('Hello World')
    ->setNonce($nonce)
    ->setGasPrice($gasPrice)
    ->setGasCoin($gasCoin)
    ->setHost('https://testnet.bip.to/tx')
    ->setPassword('some check password');

$link->encode(); // returns encoded link as string
```

Tests
-----

[](#tests)

To run unit tests:

```
vendor/bin/phpunit tests
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Recently: every ~0 days

Total

38

Last Release

2028d ago

Major Versions

v0.1.4 → v1.0.02019-05-09

v1.8.0 → v2.0.02020-03-06

v2.3.0 → v3.0.02020-10-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/23ad7557a9307e51f77c826273e23615909cdfb76ccfc53dc2d2ab6e5952e686?d=identicon)[dec0de](/maintainers/dec0de)

---

Top Contributors

[![grkamil](https://avatars.githubusercontent.com/u/10536620?v=4)](https://github.com/grkamil "grkamil (221 commits)")[![danil-lashin](https://avatars.githubusercontent.com/u/3121312?v=4)](https://github.com/danil-lashin "danil-lashin (9 commits)")[![azimuth0x28](https://avatars.githubusercontent.com/u/7585251?v=4)](https://github.com/azimuth0x28 "azimuth0x28 (4 commits)")[![i7495](https://avatars.githubusercontent.com/u/6485434?v=4)](https://github.com/i7495 "i7495 (3 commits)")[![vmalyavin](https://avatars.githubusercontent.com/u/31534360?v=4)](https://github.com/vmalyavin "vmalyavin (2 commits)")[![ingria](https://avatars.githubusercontent.com/u/2178368?v=4)](https://github.com/ingria "ingria (2 commits)")[![shrpne](https://avatars.githubusercontent.com/u/392907?v=4)](https://github.com/shrpne "shrpne (1 commits)")[![mx-dec0de](https://avatars.githubusercontent.com/u/76888636?v=4)](https://github.com/mx-dec0de "mx-dec0de (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mx-dec0de-minter-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/mx-dec0de-minter-php-sdk/health.svg)](https://phpackages.com/packages/mx-dec0de-minter-php-sdk)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

129.7k5](/packages/hardcastle-xrpl-php)[minter/minter-php-sdk

277.5k](/packages/minter-minter-php-sdk)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
