yes

yes
9 Replies
c8
c82y ago
have you tried it?
MGpai
MGpaiOP2y ago
I have tried and failed you can follow this thread https://discord.com/channels/668903786361651200/840313005064585246/1245088903212433438 I am sure I was close
morphic
morphic2y ago
just published a new version v0.4.3, which now support generating commitements for ReducedTransaction and also passing such commitments to singing methods of SigmaProver. https://www.npmjs.com/package/sigmastate-js See this PR for the changes https://github.com/ScorexFoundation/sigmastate-interpreter/pull/1000 On very high level you need to follow these steps: 1) Create SigmaProver 2) Create Fleet's UnsignedTransaction 3) Reduce the tx to ReducedTransaction using SigmaProver 4) call generateCommitments for the reducedTx and get TransactionHintsBag 5) share commitments with cosigners 6) When all the hints are collected, call signReduced passing them to the method The exact detail are tricky and you need to look at Minotaur's sources Sigma-js provides only basic utility methods, but the whole process should be managed by the app. @c8 @MGpai ^ also at the moment ProverHints is the blackbox, there are not methods to get and manipulate the content. Let me know if some methods are missing.
c8
c82y ago
i looked into minotaur, it's a great reference, also reported a multisig bug (still open), just to confirm, should i be able with those steps sign a SINGLE multisig input? @morphic It currently not possible with sigma-rust wasm (maybe after this PR https://github.com/ergoplatform/sigma-rust/pull/751). I am hoping to sign this transaction:
┌───────────────────────────┐ ┌─────────────────────────┐
│ address: alicePK │ ──┐ │ address: ALICE │
│ value: 1Erg │ │ ┌──► │ value: 2.9989Erg │
└───────────────────────────┘ │ │ └─────────────────────────┘
├──►│
┌───────────────────────────┐ │ │ ┌─────────────────────────┐
│ address: alicePK && bobPk │ │ │ │ address: FEE │
│ value: 2ERG │ ──┘ └──► │ value: 0.0011Erg │
└───────────────────────────┘ └─────────────────────────┘
┌───────────────────────────┐ ┌─────────────────────────┐
│ address: alicePK │ ──┐ │ address: ALICE │
│ value: 1Erg │ │ ┌──► │ value: 2.9989Erg │
└───────────────────────────┘ │ │ └─────────────────────────┘
├──►│
┌───────────────────────────┐ │ │ ┌─────────────────────────┐
│ address: alicePK && bobPk │ │ │ │ address: FEE │
│ value: 2ERG │ ──┘ └──► │ value: 0.0011Erg │
└───────────────────────────┘ └─────────────────────────┘
It looks great, i would love to use it for crystal-pool(https://savonarolalabs.github.io/crystal-pool/#/README), but i need to be able to sign individual inputs, and individual multisig inputs @morphic any chance to add it in the near future?
morphic
morphic2y ago
Strictly speaking this method is not necessary, as signing a single input can be done by adding special hints for the other inputs. But yes, such method is useful helper. Will add similar to SigmaProver. today/tomorrow will be ready input signing method added https://github.com/ScorexFoundation/sigmastate-interpreter/blob/04e7cb6870059c99d670340f48ac567650545aa5/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala#L77 See also signReducedInput method.
c8
c82y ago
Created a one liner test repo (check it out), where i tried signing with sigmastate-js https://github.com/SavonarolaLabs/multisig-input:
git clone git@github.com:SavonarolaLabs/multisig-input.git && cd multisig-input && npm install && npm run test
git clone git@github.com:SavonarolaLabs/multisig-input.git && cd multisig-input && npm install && npm run test
1. Am i on the right track @morphic @MGpai and 2. How do i get previousStateDigest? https://github.com/SavonarolaLabs/multisig-input/blob/53f66d0a40d03cf0bada468a06bc8d0b964ac604/sign.test.ts#L65
GitHub
multisig-input/sign.test.ts at 53f66d0a40d03cf0bada468a06bc8d0b964a...
Proof of concept for signing an AlicePK && BobPK multisig input - SavonarolaLabs/multisig-input
c8
c82y ago
yes, thank you, now i understand what you ment by "i was close", i copied your map functions for headers, but i am still stuck with an undefined.

Did you find this page helpful?