{"id":"yfBJf-S3OR0","title":"How to use DAML Script with project:DABL.","description":"It is a recording of a demo that describes how to use Daml Script with project:DABL.\n\n📖 Get started with Daml: https://bit.ly/tryDaml\n📚 Learn more about Daml Smart Contracts: https://bit.ly/learn_daml\n📮Check out our blogs: https://bit.ly/daml-blog-engineering\n📋 Become a Daml certified expert: https://bit.ly/daml-certification","channel_name":"Daml","published_at":"2020-08-10T00:00:00.000Z","thumbnail_url":"https://i.ytimg.com/vi/yfBJf-S3OR0/hqdefault.jpg","transcript_text":"this demo covers how to use demoscript on dabble for ledger initialization before deploying a model to project dabble it is known best practice to write demo scenarios that test your business logic often the first few lines of these scenarios have to do with onboarding and other preliminary logic to bootstrap the state of your ledger when uploading a demo model to project dabble a similar process is required to bring your ledger to an initialized state however the more complex the demo the more time consuming this becomes the process also can be error prone and in the worst case force someone to have to start over on a blank ledger demoscript is a development tool with a simple api that runs against an actual ledger to test automation logic ui and performs this ledger initialization using it with dabble achieves automatic and accurate ledger bootstrapping enabling you to fast forward your ledger to the desired initialized state the use case i'll use in this demo involves five different parties and relationships between these parties that have to be onboarded to begin the main workflow the operator invites a signing party who holds the keys to transfer digital tokens outside the bounds of his company the signing party invites a compliance officer responsible for checking addresses the compliance officer invites the desk heads and each desk head invites a set of traders that initiate transfer requests this nested relationship between parties is a pain to onboard which is where demoscript comes in handy the simplified workflow is as follows a trader starts with the transfer request the desktop provides a transfer limit contract that specifies it a size limit if the transfer is within the limit it gets passed to the compliance officer who checks the outbound address if the address is whitelisted the transfer is approved and the signing party signs it to be sent out to the relevant network to get this workflow bootstrapped on dabble we will go through the following steps one migrate scenarios to demoscript two configure our dar three deploy it to project dabble four download the scripts ledger parties from dabble and five run the script against our ledger the simplest way to write demoscript is to use pre-existing scenarios and make simple changes to them demo docs has a migration guide that explains the specifics of this simple translation otherwise the demo docs also have a guide to writing a demo script from scratch which is very similar to writing scenarios now let's look at the code it is worth noting that if we replace the scenario code in our demo project to demo script the hash of our compiled dar will change to avoid this i've created a top level directory that contains our project and i've created a new project with a single file for our demo script this file imports demo script and role contracts from our initial project i've copied our scenario code here and turned it into demo script as we can see there is now a record that contains the parties that are inputs arguments to our script function and create becomes create cmd exercise becomes exercise dmd other than unpacking the parties in the initialized script we can continue with pretty much the same logic as our demo scenario now for some additional configuration the demo.yaml file of the script project we need to add demoscript to the list of dependencies here i've added the path of our original project star to the data dependency field here now let's build our dars once we've compiled both dars open project dabble and create an empty ledger upload the original project star to your ledger next add the ledger parties that we specified as arguments in our demo script to our ledger in the live data view all this is doing is initializing parties so there will be no contracts yet here it is important to use camelcase so that these arguments will compile in demo now we want to pull down these parties and their access tokens to use as inputs to our script and run it against our ledger double produces this json file for for our ledger in the ledger settings tab take the participants.json file and add it to your script project for the final step we need to create a file named ledgerparties.json copy the value of party participants from participants.json into ledger party stuff json unfortunately the json here must be formatted party value so flip the order of the key and value pair you got from participants.json now that we have the inputs for our demo script you need to run it against our double ledger this command consists of our participant config being the participants.json file the json api tag because dabble uses json api the name of our script are the name of our script and the input file ledgerparties.json now let's run this demoscript command now we go back to project dabble and from the perspective of the operator we will see the contracts created by the demoscript bootstrap process for more information on demo script visit the demo docs for more information on using demo script with dabble visit the dabble docs","transcript_synced_at":"2026-10-26T04:14:35.189Z","segments":[{"start_seconds":1,"text":"this demo covers how to use demoscript on dabble for ledger initialization","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=1s"},{"start_seconds":9,"text":"before deploying a model to project dabble it is known best practice to write demo scenarios that test your business logic","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=9s"},{"start_seconds":17,"text":"often the first few lines of these scenarios have to do with onboarding and other preliminary logic to bootstrap the state of your ledger","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=17s"},{"start_seconds":24,"text":"when uploading a demo model to project dabble a similar process is required to bring your ledger to an initialized state however the more","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=24s"},{"start_seconds":31,"text":"complex the demo the more time consuming this becomes the process also can be error prone and in the worst case force someone to","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=31s"},{"start_seconds":38,"text":"have to start over on a blank ledger demoscript is a development tool with a simple api that runs against an actual","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=38s"},{"start_seconds":47,"text":"ledger to test automation logic ui and performs this ledger initialization using it with dabble achieves automatic and accurate","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=47s"},{"start_seconds":55,"text":"ledger bootstrapping enabling you to fast forward your ledger to the desired initialized state","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=55s"},{"start_seconds":62,"text":"the use case i'll use in this demo involves five different parties and relationships between these parties that have to be onboarded to begin the","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=62s"},{"start_seconds":70,"text":"main workflow the operator invites a signing party who holds the keys to transfer digital tokens outside the bounds of his","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=70s"},{"start_seconds":77,"text":"company the signing party invites a compliance officer responsible for checking addresses","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=77s"},{"start_seconds":85,"text":"the compliance officer invites the desk heads and each desk head invites a set of","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=85s"},{"start_seconds":92,"text":"traders that initiate transfer requests this nested relationship between parties is a pain to onboard","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=92s"},{"start_seconds":98,"text":"which is where demoscript comes in handy the simplified workflow is as follows a trader starts with the transfer request","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=98s"},{"start_seconds":107,"text":"the desktop provides a transfer limit contract that specifies it a size limit if the transfer is within the limit it gets passed to the","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=107s"},{"start_seconds":115,"text":"compliance officer who checks the outbound address if the address is whitelisted the transfer is approved","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=115s"},{"start_seconds":122,"text":"and the signing party signs it to be sent out to the relevant network","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=122s"},{"start_seconds":130,"text":"to get this workflow bootstrapped on dabble we will go through the following steps one migrate scenarios to demoscript two","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=130s"},{"start_seconds":137,"text":"configure our dar three deploy it to project dabble four download the scripts ledger parties","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=137s"},{"start_seconds":145,"text":"from dabble and five run the script against our ledger","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=145s"},{"start_seconds":154,"text":"the simplest way to write demoscript is to use pre-existing scenarios and make simple changes to them","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=154s"},{"start_seconds":161,"text":"demo docs has a migration guide that explains the specifics of this simple translation otherwise the demo docs also have a","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=161s"},{"start_seconds":168,"text":"guide to writing a demo script from scratch which is very similar to writing scenarios","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=168s"},{"start_seconds":177,"text":"now let's look at the code it is worth noting that if we replace","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=177s"},{"start_seconds":184,"text":"the scenario code in our demo project to demo script the hash of our compiled dar will change","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=184s"},{"start_seconds":193,"text":"to avoid this i've created a top level directory that contains our project and i've created a new project with a single file for our demo script","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=193s"},{"start_seconds":202,"text":"this file imports demo script and role contracts from our initial project","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=202s"},{"start_seconds":209,"text":"i've copied our scenario code here and turned it into demo script as we can see there is now a record that contains the parties that are inputs","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=209s"},{"start_seconds":217,"text":"arguments to our script function and create becomes create cmd exercise becomes exercise dmd","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=217s"},{"start_seconds":226,"text":"other than unpacking the parties in the initialized script we can continue with pretty much the same logic as our demo scenario","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=226s"},{"start_seconds":236,"text":"now for some additional configuration the demo.yaml file of the script project","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=236s"},{"start_seconds":244,"text":"we need to add demoscript to the list of dependencies here i've added the path of our original project","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=244s"},{"start_seconds":252,"text":"star to the data dependency field here","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=252s"},{"start_seconds":257,"text":"now let's build our dars","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=257s"},{"start_seconds":286,"text":"once we've compiled both dars open project dabble and create an empty ledger","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=286s"},{"start_seconds":294,"text":"upload the original project star to your ledger next add the ledger parties that we","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=294s"},{"start_seconds":304,"text":"specified as arguments in our demo script to our ledger in the live data view","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=304s"},{"start_seconds":327,"text":"all this is doing is initializing parties so there will be no contracts yet here it is important to use camelcase so that these arguments will compile in","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=327s"},{"start_seconds":335,"text":"demo now we want to pull down these parties and their access tokens to use as inputs to our script","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=335s"},{"start_seconds":342,"text":"and run it against our ledger double produces this json file for for our ledger in the","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=342s"},{"start_seconds":349,"text":"ledger settings tab take the participants.json file and add","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=349s"},{"start_seconds":359,"text":"it to your script project","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=359s"},{"start_seconds":372,"text":"for the final step we need to create a file named ledgerparties.json","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=372s"},{"start_seconds":379,"text":"copy the value of party participants from participants.json into ledger party","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=379s"},{"start_seconds":387,"text":"stuff json","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=387s"},{"start_seconds":397,"text":"unfortunately the json here must be formatted party value so flip the order of the key and value pair","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=397s"},{"start_seconds":402,"text":"you got from participants.json","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=402s"},{"start_seconds":416,"text":"now that we have the inputs for our demo script you need to run it against our double ledger","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=416s"},{"start_seconds":424,"text":"this command consists of our participant config being the participants.json file the json api tag","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=424s"},{"start_seconds":431,"text":"because dabble uses json api the name of our script are the name of our script and the input","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=431s"},{"start_seconds":440,"text":"file ledgerparties.json now let's run this demoscript command","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=440s"},{"start_seconds":476,"text":"now we go back to project dabble and from the perspective of the operator we will see the contracts created by the","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=476s"},{"start_seconds":485,"text":"demoscript bootstrap process","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=485s"},{"start_seconds":493,"text":"for more information on demo script visit the demo docs for more information on using demo","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=493s"},{"start_seconds":498,"text":"script with dabble visit the dabble docs","url":"https://www.youtube.com/watch?v=yfBJf-S3OR0&t=498s"}],"youtube_url":"https://youtube.com/watch?v=yfBJf-S3OR0","url":"https://ccpedia.xyz/videos/yfBJf-S3OR0"}