akashic / akashic-pay
A library to interact with the AkashicChain network, written in PHP.
Requires
- php: >=7.2
- ext-curl: *
- ext-gmp: *
- ext-json: *
- ext-openssl: *
- fgrosse/phpasn1: ^2.5.0
- guzzlehttp/guzzle: ^7.9
- monolog/monolog: ^2.9
- protonlabs/bitcoin: ^1.0
- simplito/elliptic-php: ^1.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-08-19 15:07:47 UTC
README
A library to interact with the AkashicChain network, written in PHP.
Installing
composer require akashic/akashic-pay
Usage
use Akashic\AkashicPay;
Features
- Send crypto via Layer 1 and Layer 2 (Akashic Chain)
- Create wallets for your users into which they can deposit crypto
- Fetch balance and transaction details
- Completely Web3: No login or API-key necessary. Just supply your Akashic private key, which stays on your server. The SDK signs your transactions with your key and sends them to Akashic Chain.
- Supports Ethereum and Tron
Getting Started
- Create an account on AkashicLink (Google Chrome Extension or iPhone/Android App)
- Visit AkashicPay and connect with AkashicLink. Set up the URL you wish to receive callbacks for.
- Integrate the SDK in your code. This example configuration uses many optional build arguments, for illustration purposes:
use Akashic\AkashicPay; use Akashic\Constants\Environment; use Akashic\Constants\ACNode; use Akashic\Constants\ACDevNode; $akashicPay = new AkashicPay([ // in development, you will use our testnet and testnet L1 chains 'environment' => getenv('environment') === 'production' ? Environment::PRODUCTION : Environment::DEVELOPMENT, // optional, the SDK will try to find the fastest node if omitted 'targetNode' => getenv('environment') === 'production' ? ACNode::SINGAPORE_1 : ACDevNode::SINGAPORE_1, // use whatever secret management tool you prefer to load the private key // from your AkashicLink account. It should be of the form: // `"0x2d99270559d7702eadd1c5a483d0a795566dc76c18ad9d426c932de41bfb78b7"` // In development, each developer could have their own, or omit this (and // the l2Address), in which case the SDK will create and use a new pair. // you can instead use your Akashic Link account's 12-word phrase, using the // argument `recoveryPhrase` 'privateKey' => getenv('akashicKey'), // this is the address of your AkashicLink account. Of the form "AS1234..." 'l2Address' => getenv('l2Address'), ]);
AkashicPay is now fully setup and ready to use.
Testing
You can also use AkashicPay with the AkashicChain Testnet & Sepolia (Ethereum) and Shasta (Tron) testnets, useful for local development and staging environments. To do this, no AkashicLink is necessary; you can build an AkashicPay instance as follows, and the SDK will create a "test otk" for you:
use Akashic\AkashicPay; use Akashic\Constants\Environment; $akashicPay = new AkashicPay([ 'environment' => Environment::DEVELOPMENT, 'privateKey' => getenv('akashicTestKey'), // this is the address of your AkashicLink account. Of the form "AS1234..." 'l2Address' => getenv('testL2Address'), ]);
You can now create an L1-wallet on a testnet:
use Akashic\Constants\NetworkSymbol; $address = $akashicPay->getDepositAddress(NetworkSymbol::TRON_SHASTA, 'EndUser123');
Use a faucet (e.g. via the Tron Discord) to deposit some coin into the created wallet.
You can check to see if your balance has increased with:
$balances = $akashicPay->getBalance(); // -> [{networkSymbol: 'TRX-SHASTA', balance: '5000'}, ...]
Documentation
For more in-depth documentation describing the SDKs functions in detail, explanations of terminology, and guides on how to use AkashicPay.com, see https://docs.akashicpay.com/
Contributing
See CONTRIBUTING.md for information
License
This project is licensed under the MIT License