Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Request for dApp deployment documentation/how-to's #59

Closed
6 tasks
mikekeke opened this issue Oct 27, 2021 · 13 comments
Closed
6 tasks

Request for dApp deployment documentation/how-to's #59

mikekeke opened this issue Oct 27, 2021 · 13 comments
Labels
enhancement New feature or request

Comments

@mikekeke
Copy link
Contributor

mikekeke commented Oct 27, 2021

Area

[] Plutus Foundation Related to the GHC plugin, Haskell-to-Plutus compiler, on-chain code
[x] Plutus Application Framework Related to the Plutus application backend (PAB), emulator, Plutus libraries
[] Marlowe Related to Marlowe
[] Other Any other topic (Playgrounds, etc.)

Describe the feature you'd like

While working on deployment story it feels like explicit description of workflow of how to go from On-chain + Off-chain code to dApp is missing.

It looks like for dApp beind deployed developer need:

  1. Hook Contract endpoints to PAB handlers and build PAB executable with Contract(s) embedded in it.
  2. Run PAB executable pointing it to the desired chain index, Node socket and network id.
  3. Provide a way for user wallets to balance and sign partial transactions, built by Off-chain code of dApp

Some parts of the workflow doesn't look quite clear considering the following:

  • For providing REST API for Contract several examples available now:

    • Simulator related from pioneer lectures - seems to be outdated
    • Another Simulator related for uniswap
    • Via runWith from Plutus.PAB.Run - link

    What is the recommended way to start "production" version of PAB for Contract?
    (It looks like last one is a way to go, as PAB demo uses it)

  • PAB configuring: how to start PAB with ability to:

    • Set network to connect to
    • Set node socket
    • Set chain index to use for querying

    Note: a way to start chain index for testnet (Alonzo testnet as example):

    cabal run exe:plutus-chain-index -- --socket-path /path/  to/node.socket --db-path /path/to/chain-index.db --network-id 8 start-index
    
  • PAB - WBE integration.

    WBE docs says that:

    Plutus Application Backend provides payload of unbalanced transaction
    

    Hosted deployment scenario says that:

    The PAB produces a link (URI) for each partial transaction that needs to be balanced and signed. When the user clicks the link, the user’s operating system opens the wallet that is registered to handle the link schema
    

Does this mean, that dApp developer's task will be to deliver link for partial transaction to user through dApp's frontend, and then user will click it and whatever wallet registered for that (and if it works through WBE) will execute REST API call with CBOR-encoded transaction in request body as Using Cardano Wallet with Plutus Application Backend describes it?
Who then submits transaction after it's balanced and signed - PAB or Wallet? If PAB, how does it get signed and balanced transaction back from the user?

Describe alternatives you've considered

Cover topics above in some How-to documentation section.

Additional context / screenshots

@mikekeke mikekeke added the enhancement New feature or request label Oct 27, 2021
@mikekeke mikekeke changed the title Lack of dApp deployment documentation/how-to's Request for dApp deployment documentation/how-to's Oct 27, 2021
@bhoudebert
Copy link

bhoudebert commented Nov 10, 2021

It was not very clear to me, how signing/security will happen, until I read your issue, so thank you.

From testing/emulator we never saw anything about a smart contract endpoint producing an output as link but it really seems to be a right answer for security which is similar to my wondering issue about signing too.

But then It starts to be confusing, to me at least, because our current (from tutorials to examples) pab smart contract are using functions like submitTx and even some awaitTxConfirmed and they obviously not saying anything about any external signing flow (which is great for testing so)

Does that mean that these functions should not be used for real code? Are we able currently to generate such kind of links?

@bhoudebert
Copy link

I have also found this https://github.com/input-output-hk/plutus/blob/master/notes/smart-contract-backend/scb.md which should cover the expected process.

@bhoudebert
Copy link

bhoudebert commented Nov 10, 2021

ok google was my friend this time:

https://input-output-hk.github.io/cardano-wallet/user-guide/common-use-cases/pab

It was way much clear in the process definition, still wondering if we have to create explicitely balance Tx from smart contract code.

@mikekeke
Copy link
Contributor Author

@bhoudebert
Copy link

bhoudebert commented Nov 11, 2021

Thxs I already read this =)

I just found that we have to run the PAB with runWith (found it in plutus-app instead of starter) instead of Simulator.

For now calling a PAB endpoint is sending an unbalanced tx to the cardano-wallet which I assume triggers something like ask the client to sign it.

Not too far from there as I face an issue with the wallet endpoints mock wallet versus pab expectations (apparently not aligned)

@mikekeke
Copy link
Contributor Author

mikekeke commented Nov 15, 2021

@bhoudebert
Maybe this will be useful: how to PAB
This is 1st iteration of our "how-to". Questions, suggestions and corrections are welcome =)

@bhoudebert
Copy link

@mikekeke I will have a look thanks, I did use also some docker for several parts (mostly wallet+node) but I think had issue again with some wallet validation.

I also saw something like signingProcessConfig did you achieve by chance to trigger this kind of process?

@mikekeke
Copy link
Contributor Author

mikekeke commented Nov 15, 2021

@bhoudebert , also readme here has some instructions: https://github.com/input-output-hk/plutus-apps/tree/main/plutus-pab/test-node

I also saw something like signingProcessConfig did you achieve by chance to trigger this kind of process?

I'm not quiet sure yet what is it atm. For our tests we used cardano-wallet integration and transaction signing was performed by cardano-wallet.

@bhoudebert
Copy link

bhoudebert commented Nov 15, 2021

@mikekeke yes I used also this part but I remember that we using the local cluster the wallet was not aligned v2 api was missing.

That's why I was trying to run it also from sources. The docker-compose from cardano-wallet is a good start for that (just miss the chain index in it) letting us run our pab from sources.

Yeah I can confirm current issue is dapps/pab is sending a balancedTx on /v2/wallets/$WALLET_ID/transactions-balance and it fails because of wrong alignment contract: Expected String got JSON.

I'll try to have a look at sources to see if it is a version used issue or else

NB: feels really weird to have hardcoded mock mention in https://github.com/input-output-hk/plutus-apps/blob/main/plutus-pab/src/Plutus/PAB/Webserver/API.hs

@bhoudebert
Copy link

bhoudebert commented Nov 15, 2021

Added: POST /wallets/{walletId}/transactions-balance (warning under development, may not behave as expected) it is not totally ready so that is maybe why PAB could be not aligned.

I think a lot of issues could be related to plutus-starter that was based on plutus-starter-devcontainer/v1.0.14 and not the latest re-release/release of plutus-apps (v2021-11-05)

@alexandru-calinoiu
Copy link

I think this PR #119 should solve one part of the problem, unfortunately don't see yet in it any updates to the samples or readme.

@bhoudebert
Copy link

Yeah I just saw that too, they are starting it!

@silky
Copy link
Contributor

silky commented Nov 23, 2021

Hey all; I'm going to close this issue as it's a little bit unwieldy; but please do feel free to open more specific tickets so that we can address them :)

Thanks!

@silky silky closed this as completed Nov 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants