boisedriver Posted December 12, 2020 Share Posted December 12, 2020 I used Ripple-KeyPairs on github a few years ago to generate XRP accounts. Below is one of the Account Public Keys, and I've seen in technical docs for XRP that the Account Public Key should have the 'a' prefix: aB48jL2Z57cAeAM9d6iCJWQdVdtTNHFnTmYuRXg9RhUJzrUBwasg When I use the tool at https://ripplerm.github.io/ripple-wallet/ to replicate the XRP account generation for this same account (same family seed), everything is the same, except the Account Public Key given with that tool is encoded as: 026D8310621F4EBC0E7098A2166F282CDF93DCE56221E046303DFD6C2C36C60958 what is causing this difference? Link to comment Share on other sites More sharing options...
boisedriver Posted December 12, 2020 Author Share Posted December 12, 2020 anyone know? Is there a different forum where someone would know? Link to comment Share on other sites More sharing options...
jn_r Posted December 13, 2020 Share Posted December 13, 2020 15 hours ago, boisedriver said: anyone know? Is there a different forum where someone would know? You can use 'ripple-address-codec'. It will encode the public key to the codec described above. Running this program const api = require('ripple-address-codec') const buffer = Buffer.from('026D8310621F4EBC0E7098A2166F282CDF93DCE56221E046303DFD6C2C36C60958', 'hex') const encoded = api.encodeAccountPublic(buffer) console.log('Encoded:', encoded) will give this as output: Encoded: aB48jL2Z57cAeAM9d6iCJWQdVdtTNHFnTmYuRXg9RhUJzrUBwasg boisedriver and BillyOckham 1 1 Link to comment Share on other sites More sharing options...
boisedriver Posted December 13, 2020 Author Share Posted December 13, 2020 (edited) 1 hour ago, jn_r said: You can use 'ripple-address-codec'. It will encode the public key to the codec described above. @jn_r, Thank you. So the hex encoding is the first encoding, and the 'a' encoding derives from that. If so, understood, thank you. Edited December 13, 2020 by boisedriver Link to comment Share on other sites More sharing options...
jn_r Posted December 13, 2020 Share Posted December 13, 2020 22 minutes ago, boisedriver said: @jn_r, Thank you. So the hex encoding is the first encoding, and the 'a' encoding derives from that. If so, understood, thank you. Yes correct. The first hex-encoding is a direct representation of the key. But the derived 'a' encoding is for human convenience: It is 1) recognizable and 2) typo-proof (a checksum, if one character is wrong, it will be recognized as an invalid key). You will find that almost all crypto make use of these kind of encodings. Except at first instance Ethereum, that uses just plain hexadecimal addresses. Later they found however this to be inconvenient and they came up with a system of capitalising some of the letters in the Ethereum address. Not so nice/enforcing as a real encoding, but it's at least something boisedriver, BillyOckham and at3n 1 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now