Skip to content

Instantly share code, notes, and snippets.

@bitjson
Last active October 26, 2023 20:31
Show Gist options
  • Save bitjson/a055ad6ba863a4472767bb5e441a3437 to your computer and use it in GitHub Desktop.
Save bitjson/a055ad6ba863a4472767bb5e441a3437 to your computer and use it in GitHub Desktop.
Example Gist for Importing into Bitauth IDE

Single Signature (P2PKH) Wallet

This is an example of a Gist designed for importing into BitAuth IDE.

To import the below template into the IDE, open this URL:

https://ide.bitauth.com/import-gist/a055ad6ba863a4472767bb5e441a3437

Format a Gist for Import

You can import from any GitHub Gist. The IDE will attempt to parse the alphabetically-first file with a .json file extension as an authentication template. (The GitHub Gist interface also displays files in alphabetical order, so the first JSON file in the GitHub interface will also be chosen by the IDE.)

You may also want to create a 0_readme.md (like this one) to offer a quick description and the import link to users who navigate to the Gist on GitHub.

Gist Import URL

The import URL is https://ide.bitauth.com/import-gist/GIST_ID where GIST_ID is the same ID used in the GitHub URL. E.g. this Gist is located on GitHub at:

https://gist.github.com/bitjson/a055ad6ba863a4472767bb5e441a3437/

So the ID is: a055ad6ba863a4472767bb5e441a3437

{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"description": "A standard single-factor authentication template that uses Pay-to-Public-Key-Hash (P2PKH), the most common authentication scheme in use on the network.\n\nThis P2PKH template uses BCH Schnorr signatures, reducing the size of transactions. Because the template uses a Hierarchical Deterministic (HD) key, it also supports watch-only clients.",
"name": "Single Signature (P2PKH)",
"entities": {
"owner": {
"description": "The individual who can spend from this wallet.",
"name": "Owner",
"scripts": ["lock", "unlock"],
"variables": {
"key": {
"description": "The private key that controls this wallet.",
"name": "Key",
"type": "HdKey"
}
}
}
},
"scripts": {
"unlock": {
"name": "Unlock",
"script": "<key.schnorr_signature.all_outputs>\n<key.public_key>",
"unlocks": "lock"
},
"lock": {
"lockingType": "standard",
"name": "P2PKH Lock",
"script": "OP_DUP\nOP_HASH160 <$(<key.public_key> OP_HASH160\n)> OP_EQUALVERIFY\nOP_CHECKSIG"
}
},
"supported": ["BCH_2020_05", "BCH_2021_05", "BCH_2022_05"],
"version": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment