I don't have experience with solana yet and I have question in my work. I see that it is possible to generate a key pair with web3.js But is it possible to generate a new pshair with php ?
2 Answers
Looks like you can do it with the solana-php-sdk
https://github.com/verze-app/solana-php-sdk with:
use Tighten\SolanaPhpSdk\Keypair;
$keypair = new Keypair();
// OR
$keypair = Keypair::generate();
Ripped off from the tests at https://github.com/verze-app/solana-php-sdk/blob/main/tests/Unit/KeypairTest.php
-
is there any documentation for this SDK? For example, how to create a seed phrase or complete a transaction?– Leo LokiCommented Feb 8, 2023 at 15:20
-
I can't find too much info, but there's this bit in the README github.com/verze-app/solana-php-sdk#transactions– Jon CCommented Feb 8, 2023 at 21:58
-
yes, I saw it, thx. But not in mind the ability to generate seed phrase.– Leo LokiCommented Feb 9, 2023 at 4:41
-
The answer is in the KeyPair.php file, and it does has the ability to generate from seed. Line 81: github.com/chongkan/solana-php-sdk/blob/main/src/Keypair.php Commented Apr 23 at 13:42
Solana uses ed25519 keypairs so if you can find a PHP library to do that, absolutely.
EDIT: Such as this one https://github.com/encedo/php-ed25519-ext
-
sorry, can you give an example code for creating an account using php ?– Leo LokiCommented Feb 8, 2023 at 9:41