Skip to content

Add TX manifest proposal#41

Open
stringhandler wants to merge 1 commit into
ElementsProject:mainfrom
stringhandler:feat/add-compose-elip
Open

Add TX manifest proposal#41
stringhandler wants to merge 1 commit into
ElementsProject:mainfrom
stringhandler:feat/add-compose-elip

Conversation

@stringhandler

Copy link
Copy Markdown

Adds an ELIP for a new TX manifest format for wallets. Specifically aimed at making SimplicityHL contracts easier to integrate into wallets.

Comment thread elip-xxx.mediawiki
| <code>"wallet_key"</code> || 32-byte x-only BIP340 Schnorr pubkey (hex) || <code>m/86h/&lt;coin&gt;h/0h/0/0</code>
|}

<code>coin</code> = 0 for mainnet, 1 for testnet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's 0 for Bitcoin and 1776 for Liquid.

Comment thread elip-xxx.mediawiki
|-
| <code>optional</code> || boolean || NO || If <code>true</code>, output may be omitted. Default: <code>false</code>.
|-
| <code>confidential</code> || boolean || NO || Whether this output is blinded (Liquid/Elements only). Overrides the chain default (see Blinding below).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this possibly be derived from the destination field? The provided address format will say if confidentiality is required.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The address might be a simplicity covenant, in which case the address is the same for both.

Also, the destination might be "wallet" which allows the wallet to create an address, although I don't see a need for turning off confidential amounts for self addresses.

Comment thread elip-xxx.mediawiki

'''<code>"simplicityhl"</code> (static SimplicityHL value).''' Fields: <code>value</code> (required; a SimplicityHL value expression: <code>"0x&lt;hex&gt;"</code> for byte arrays, <code>"Left(())"</code> / <code>"Right(())"</code> for Either types) and <code>simplicity_type</code>

'''<code>"Signature"</code> (BIP340 Schnorr signature).''' Fields: <code>sig_type</code> (required; currently only <code>"simplicity.sig_all_hash"</code>) and <code>source</code> (required; <code>{"type": "wallet", "key": &lt;reference&gt;}</code> where the reference resolves to a 64-hex-char x-only public key). The tool computes the sighash, signs with the wallet key matching the given pubkey, and injects the 64-byte signature as a <code>"simplicityhl"</code> witness. The value <code>"simplicity.sig_all_hash"</code> is namespaced to make clear it is Simplicity's own <code>sig_all_hash</code> jet commitment over the full transaction (computed via the Elements transaction environment), '''not''' the standard Elements SIGHASH_ALL.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes signatures may not have standalone witness names and instead have to be injected into tuples and tuples of tuples.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true. In my example I changed the contract to have two separate witness fields, but let me try get a working example as you say

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the injector code we use in simplex if you need some inspiration:

https://github.com/BlockstreamResearch/smplx/blob/master/crates/sdk/src/signer/wtns_injector.rs

Comment thread elip-xxx.mediawiki
},
"actions": {
"Pay": {
"params": {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand. Do "params" get populated by the wallet (prompting the user for some input), or instead taken from the "instance/build file" passed alongside the manifest?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are shown to the user. Would it make more sense to name these "args"?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect the wallet to handle this prompting? It may be quite arbitrary and complex. I thought the dapp itself (the website) would be used to navigate the user, and then send all the data together with the manifest to the wallet just for the "confirmation" of the action.

Comment thread elip-xxx.mediawiki
"manifest_version": "0.1.0",
"protocol": "p2pk-simplicity",
"description": "...",
"chain": "elements",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'd identify the chain according to BIP-122 and ELIP-144.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants