Giter Site home page Giter Site logo

Comments (6)

CherryDT avatar CherryDT commented on July 17, 2024 1

@faustbrian Why did you stike-through your text? What solution did you find?

I still cannot find a method to convert the result of privateKey.to_bech32() back to a PrivateKey. The generating transactions example also shows the use of CardanoWasm.PrivateKey.from_bech32 which is undefined...

The code you showed converts from a BIP39 seed and not a bech32 private key like ed25519e_sk16rl5f..., so I'm confused.

from cardano-serialization-lib.

SebastienGllmt avatar SebastienGllmt commented on July 17, 2024

Shelley addresses (usually BaseAddress witnesses are created using make_vkey_witness (

pub fn make_vkey_witness(
)

And yes, all of Shelley (and every other hardfork) is supported.

You can find example code here (but this example code hasn't been updated for Mary yet) https://github.com/Emurgo/cardano-serialization-lib/blob/59426b43d105e6cf4f05e4b5945c0cb3dc483130/doc/getting-started/generating-transactions.md#example-code

Feel free to re-open the issue if you think this doesn't address your question.

from cardano-serialization-lib.

faustbrian avatar faustbrian commented on July 17, 2024

Thanks, that got me a bit further but the CardanoWasm.PrivateKey.from_bech32 method doesn't seem to exist anymore which is used in const prvKey = CardanoWasm.PrivateKey.from_bech32("ed25519e_sk16rl5fqqf4mg27syjzjrq8h3vq44jnnv52mvyzdttldszjj7a64xtmjwgjtfy25lu0xmv40306lj9pcqpa6slry9eh3mtlqvfjz93vuq0grl80");.

What has this been replaced with? I assume with from_normal_bytes and from_extended_bytes and the Bech32 private key should be turned into an UInt[] or are there any helper methods to turn the private key into bytes?

const privateKey = CardanoWasm.Bip32PrivateKey.from_bip39_entropy(Buffer.from(BIP39.toEntropy(mnemonic), "hex"), Buffer.from(""))
		.derive(harden(Purpose.CIP1852))
		.derive(harden(slip44))
		.derive(harden(0))
		.to_raw_key();

from cardano-serialization-lib.

faustbrian avatar faustbrian commented on July 17, 2024

@CherryDT our solution is here https://github.com/ArkEcosystem/platform-sdk/blob/master/packages/platform-sdk-ada/src/services/transaction.ts#L26-L136

from cardano-serialization-lib.

CherryDT avatar CherryDT commented on July 17, 2024

@faustbrian Thank you but I'm a bit lost, I see here only handling of derived keys. Can you point me to the exact place you are loading a string starting with ed25519e_ into a CardanoWasm.PrivateKey object?

from cardano-serialization-lib.

v-almonacid avatar v-almonacid commented on July 17, 2024

@CherryDT there is no method to get a PrivateKey struct from a bech32 string, you will need the raw bytes and then you can use from_extended_bytes() or from_normal_bytes(), depending on how you generated that private key.

from cardano-serialization-lib.

Related Issues (20)

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.