public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Jeremy Rubin <jeremy.l.rubin@gmail.com>
To: Bitcoin development mailing list <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] BIP-119 CTV Meeting #4 Draft Agenda for Tuesday February 22nd at 12:00 PT
Date: Tue, 22 Feb 2022 10:05:21 -0800	[thread overview]
Message-ID: <CAD5xwhjd2yUbANH9=NHQ5FdmPtEcfA4vBPQXV4Hjwfi36L=QSg@mail.gmail.com> (raw)
In-Reply-To: <CAD5xwhjBvGLC5AHR4Xngnkg78A_UV4AkPUKAi0COzCxMZnVeNQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 6472 bytes --]

Hi Devs,

As promised, a Sapio Tutorial. In this tutorial we'll walk through how to
use the Sapio CLI to generate contracts and play with them on the network.
We'll use a congestion control tree because it's very simple! We will walk
through this step-by-step during the meeting today.

-1. Install JQ (json manipulating tool) if you don't have it / other things
needed to run a bitcoin node.
0. Set up a node as described above.  You'll likely want settings like this
in your bitcoin.conf too:
[signet]
# generate this yourself

rpcauth=generateme:fromtherpcauth.pyfile
txindex=1
signetchallenge=512102946e8ba8eca597194e7ed90377d9bbebc5d17a9609ab3e35e706612ee882759351ae

rpcport=18332
rpcworkqueue=1000
fallbackfee=0.0002

Get coins https://faucet.ctvsignet.com/ / DM me

1. Follow the install instructions on
https://learn.sapio-lang.org/ch01-01-installation.html You can skip the the
sapio-studio part / pod part and just do the Local Quickstart up until
"Instantiate a contract from the plugin". You'll also want to run *cargo
build --release* from the root directory to build the sapio-cli.


2. Open up the site https://rjsf-team.github.io/react-jsonschema-form/
3. Run *sapio-cli contract api --file
plugin-example/target/wasm32-unknown-unknown/debug/sapio_wasm_plugin_example.wasm*
4. Copy the resulting JSON into the RJSF site
5. Fill out the form as you wish. You should see a JSON like
{
"context": {
"amount": 3,
"network": "Signet",
"effects": {
"effects": {}
}
},
"arguments": {
"TreePay": {
"fee_sats_per_tx": 1000,
"participants": [
{
"address": "tb1pwqchwp3zur2ewuqsvg0mcl34pmcyxzqn9x8vn0p5a4hzckmujqpqp2dlma",
"amount": 1
},
{
"address": "tb1pwqchwp3zur2ewuqsvg0mcl34pmcyxzqn9x8vn0p5a4hzckmujqpqp2dlma",
"amount": 1
}
],
"radix": 2
}
}
}

You may have to delete some extra fields (that site is a little buggy).

Optionally, just modify the JSON above directly.

6. Copy the JSON and paste it into a file ARGS.json
7. Find your sapio-cli config file (mine is at
~/.config/sapio-cli/config.json). Modify it to look like (enter your
rpcauth credentials):
{
 "main": null,
 "testnet": null,
 "signet": {
   "active": true,
   "api_node": {
     "url": "http://0.0.0.0:18332",
     "auth": {
       "UserPass": [
         "YOUR RPC NAME",
         "YOUR PASSWORD HERE"
       ]
     }
   },
   "emulator_nodes": {
     "enabled": false,
     "emulators": [],
     "threshold": 1
   },
   "plugin_map": {}
 },
 "regtest": null
}

8. Create a contract template:
*cat ARGS.json| ./target/release/sapio-cli contract create  --file
plugin-example/target/wasm32-unknown-unknown/debug/sapio_wasm_plugin_example.wasm
 | jq > UNBOUND.json*
9. Get a proposed funding & binding of the template to that utxo:

*cat UNBOUND.json| ./target/release/sapio-cli contract bind | jq >
BOUND.json*
10. Finalize the funding tx:

*cat BOUND.json | jq ".program[\"funding\"].txs[0].linked_psbt.psbt" |
xargs echo | xargs -I% ./bitcoin-cli -signet utxoupdatepsbt % |  xargs -I%
./bitcoin-cli -signet walletprocesspsbt % | jq ".psbt" | xargs -I%
./bitcoin-cli -signet finalizepsbt % | jq ".hex"*

11. Review the hex transaction/make sure you want this contract... and then
send to network:



*./bitcoin-cli -signet sendrawtransaction
020000000001015e69106b2eb00d668d945101ed3c0102cf35aba738ee6520fc2603bd60a872ea0000000000feffffff02e8c5eb0b000000002200203d00d88fd664cbfaf8a1296d3f717625595d2980976bbf4feeb10ab090180ccdcb3faefd020000002251208f7e5e50ce7f65debe036a90641a7e4d719d65d621426fd6589e5ec1c5969e200140a348a8711cb389bdb3cc0b1050961e588bb42cb5eb429dd0a415b7b9c712748fa4d5dfe2bb9c4dc48b31a7e3d1a66d9104bbb5936698f8ef8a92ac27a650663500000000*


12. Send the other transactions:

*cat BOUND.json| jq .program | jq ".[].txs[0].linked_psbt.psbt" | xargs -I%
./target/release/sapio-cli psbt finalize --psbt %  | xargs -I%
./bitcoin-cli -signet sendrawtransaction %*



Now what?

- Maybe load up the Sapio Studio and try it through the GUI?
- Modify the congestion control tree code and recompile it?
- How big of a tree can you make (I did about 6000 last night)?
- Try out other contracts?
--
@JeremyRubin <https://twitter.com/JeremyRubin>


On Mon, Feb 21, 2022 at 7:36 PM Jeremy Rubin <jeremy.l.rubin@gmail.com>
wrote:

> Hi All,
>
> Apologies for the late posting of the agenda. The 4th CTV meeting will be
> held tomorrow at 12:00 PT in ##ctv-bip-review in Libera.chat.
>
> Tomorrow the conversation will be slightly more tutorial focused. If you
> have time in advance of the meeting, it might be good to do some of this in
> advance.
>
> 1) Discussion: What is the goal of Signet? (20 minutes)
>     - Do we have a "decision function" of observations from a test network?
>     - What applications should be prototyped/fleshed out?
>     - What level of fleshed out matters?
>     - Should we add other experiments in the mix on this net, like
> APO/Sponsors?
>     - Should we get e.g. lightning working on this signet?
> 2) Connecting to CTV Signet Tutorial (10 mins)
>
> We'll make sure everyone who wants to be on it is on it & debug any issues.
>
> *Ahead of Meeting: Build this
> branch https://github.com/JeremyRubin/bitcoin/tree/checktemplateverify-signet-23.0-alpha
> <https://github.com/JeremyRubin/bitcoin/tree/checktemplateverify-signet-23.0-alpha>*
>
> Connect to:
> ```
> [signet]
>
> signetchallenge=512102946e8ba8eca597194e7ed90377d9bbebc5d17a9609ab3e35e706612ee882759351ae
> addnode=50.18.75.225
> ```
>
> 3) Receiving Coins / Sending Coins (5 mins)
> There's now a faucet for this signet: https://faucet.ctvsignet.com
> And also an explorer: https://explorer.ctvsignet.com
>
> 4) Sapio tutorial (25 minutes)
>
> *Ahead of meeting, if you have time: skim https://learn.sapio-lang.org
> <https://learn.sapio-lang.org> & download/build the sapio cli & plugin
> examples*
>
> We'll try to get everyone building and sending a basic application (e.g.
> congestion control tree or vault) on the signet (instructions to be posted
> before meeting).
>
> We won't use Sapio Studio, just the Sapio CLI.
>
> 5) Sapio Q&A (30 mins)
>
> After some experience playing with Sapio, more general discussion about
> the project and what it may accomplish
>
> 6) General Discussion (30 minutes)
>
>
> Best,
>
> Jeremy
>
> --
> @JeremyRubin <https://twitter.com/JeremyRubin>
>

[-- Attachment #2: Type: text/html, Size: 32272 bytes --]

      reply	other threads:[~2022-02-22 18:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22  3:36 [bitcoin-dev] BIP-119 CTV Meeting #4 Draft Agenda for Tuesday February 22nd at 12:00 PT Jeremy Rubin
2022-02-22 18:05 ` Jeremy Rubin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD5xwhjd2yUbANH9=NHQ5FdmPtEcfA4vBPQXV4Hjwfi36L=QSg@mail.gmail.com' \
    --to=jeremy.l.rubin@gmail.com \
    --cc=bitcoin-dev@lists.linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox