Git Product home page Git Product logo

Comments (7)

evias avatar evias commented on September 27, 2024

the hex generated should definitely give you the same addresses, there is a unit test for that, are you sure you are using the right network to generate the address with php?

Address::fromPublicKey(pubKey, 104) for mainnet

from nem-php.

momopaper avatar momopaper commented on September 27, 2024

yup, im using -104 testnet, since im still testing out the sdk, so i dont mind share my private key here

privatekey:
1925f8049d117284ad3fb7ed8029453654613010ac887d1527fe582459da78db

Address::fromPublicKey give me :
TDSECQWGEHEE5AJMD4C3WGEGRWLPCZNHUY6ZNWK7

nano wallet give me:
TDDWELLRR4GEX3H4DN5FBEPB7WZJH5K7N5BZ6DAJ

$keypair = new NEM\Core\KeyPair("1925f8049d117284ad3fb7ed8029453654613010ac887d1527fe582459da78db"); $address = NEM\Models\Address::fromPublicKey($keypair->getPublicKey(), -104); $address_a = $address->toClean();

from nem-php.

evias avatar evias commented on September 27, 2024

mhmm this is indeed a weird case, I do confirm the nano address derivation for this private key.

I will try and setup a small test case, I have used this library for other projects and never had such problems, I actually always make sure that nano reproduces the same address, as a first.

I will come back to you with the test case and example, thanks for pointing this out. It could be something about how you use the classes, maybe I have been using them differently and that's what I want to check 👍

from nem-php.

evias avatar evias commented on September 27, 2024

I believe there could be a problem with the Address::fromPublicKey algorithm, please let me know and try with :

$kp = KeyPair::create("1925f8049d117284ad3fb7ed8029453654613010ac887d1527fe582459da78db");

$pubKey = $kp->getPublicKey()->getHex();
$t_address = $kp->getAddress(-104); // Testnet
$n_address = $kp->getAddress(104); // Mainnet

from nem-php.

momopaper avatar momopaper commented on September 27, 2024

nice, i will try out later, tell me if u need anything else, i can try my best to help u

from nem-php.

momopaper avatar momopaper commented on September 27, 2024

sorry for the late reply,

here is the result:

pubkey:
00b3bf2f56f64d503650261102f482437a6fc3190ea0d3104b83bc42d9657b28

t_address:
TDSECQWGEHEE5AJMD4C3WGEGRWLPCZNHUY6ZNWK7

n_address:
NDSECQWGEHEE5AJMD4C3WGEGRWLPCZNHUZQJMQGZ

from nem-php.

evias avatar evias commented on September 27, 2024

Hello, I tried with a small test case and i cannot reproduce your case. Here is the link to the gist of the PHP used :

https://gist.github.com/evias/b30c6b8821b9c309d921188a21d44f64

I have successfully recreated the same address as Nanowallet.

You are probably doing something wrong with your private key before initializing the keypair.

✌️

from nem-php.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.