Comments (5)
I found out here that sodium_crypto_sign_ed25519_pk_to_curve25519($binaryString)
is almost always returning a SodiumException
with "conversion failed" message.
Using \ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($binaryString)
I was able to get the correct address
from solana-php-sdk.
For address q5xfHVuAsGmKRTmJNshERHHkVnHKxRX3cKzz5cYnFRn
, it is on curve, the function should return true. Buf it returns false.
I checked #12 , the reason that the function generates false PDA is isOnCurse
issue. If isOnCurve
function works right, it has no issue.
I use another way to avoid this because the isOnCurve function in the other js lib is very difficult.
public static function isOnCurve(PublicKey $publicKey): bool
{
try {
$response = Di::getHttpClient()->sendGetRequest(sprintf(
'http://127.0.0.1:3000/publickey/%s/is_on_curve',
$publicKey->toBase58()
));
$responseBody = json_decode($response->getBody()->getContents(), true);
if (!is_array($responseBody) || !isset($responseBody['is_on_curve'])) {
throw new \Exception($responseBody['error_code']);
}
return (bool) $responseBody['is_on_curve'];
} catch (\Exception $exception) {
Di::getLogger()->error('Check is on curve error: ' . $exception->getMessage());
return false;
}
}
from solana-php-sdk.
@gabrielkoerich good catch, this does indeed seem like a bug. Feel free to write a pull request for it or I will eventually get to it in the future as it's bothering me a little 😄
from solana-php-sdk.
This is fixed in 7b1e6ae thanks to @gabrielkoerich
Not creating a new release yet, see #36
from solana-php-sdk.
@pantaovay not sure I'm getting the problem. Does it return true
or false
for isOnCurve
?
Sidenote, I had an issue with the getProgramAddress
and solved it by checking multiple nonce
values, see #12 (comment) for details.
from solana-php-sdk.
Related Issues (20)
- Updating README.md to reflect 0.2.0 changes HOT 2
- Bug? ProgramAddress is wrong HOT 11
- how do create address?
- Implement Metaplex structs for metadata HOT 1
- Symfony 5.2 : A facade root has not been set HOT 4
- Question: Maybe untangle Borsh into it's own package? HOT 2
- how to transfer tokens using this SDK i.e. spl-token transfer? HOT 10
- How to get NFT token metadata by mint? HOT 9
- How to deal with rate limits of JSON RPC? HOT 5
- Invalid metadata address HOT 2
- How to get owner of a token
- SodiumException secretkey should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes HOT 1
- Support to set timeout HOT 3
- Deprecation warning: Would love to take over the repo HOT 9
- Does anyone have successfully used Borsh::serialize()? HOT 4
- Change namespace and re-release on packagist HOT 2
- How generate secret phrase ? HOT 1
- Does anyone used this sdk in php to mint collection to solana?
- Fatal error when insufficient funds
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solana-php-sdk.