willcl-ark
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
      • No invitee
    • Publish Note

      Publish Note

      Everyone on the web can find and read all notes of this public team.
      Once published, notes can be searched and viewed by anyone online.
      See published notes
      Please check the box to agree to the Community Guidelines.
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
No invitee
Publish Note

Publish Note

Everyone on the web can find and read all notes of this public team.
Once published, notes can be searched and viewed by anyone online.
See published notes
Please check the box to agree to the Community Guidelines.
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
1
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Make your own signet w/ Josie ###### tags: `tutorials` `signet` ## Main goals * Run bitcoin core * Run the tests * make changes, test them and run it on a custom signet ## Ideas * Everyone should be mining or able to mine, so should therefore generate a private key to be a signer * Can we automate this all in a single script? * Can people join in as "miners"? * Go through chaincode seminars and for each topics add some exercies which you could do on signet * You can change consensus-critial and non-consensus critial bitcoind stuff, recompile and see how it works on your signet: ... * Remove DNS seeds, then hardcoded seeds, then use -connect * Own activation heights for stuff * Disabling segwit/taproot, change coin prefixes * Change interblock time, observe orphan blocks re-orgs * Change block size, soft or hard fork [Vitalik has a way](https://www.reddit.com/r/btc/comments/428tjl/softforking_the_block_time_to_2_min_my_primarily/) * Eclipse attack someone * Re-introduce [coin age priority](https://github.com/bitcoin/bitcoin/blob/7fcf53f7b4524572d1d0c9a5fdc388e87eb02416/doc/release-notes/release-notes-0.15.0.md#removal-of-coin-age-priority) Other ideas * Could they create P2P messenger * Or build your own node from scratch, no-wallet, or choose which BIPs you want to implement * Try to DoS attack someone else's node, flood mempool etc. * change any and all policy parameters and observer their effect on the network, i.e everyone run in blocks only mode, change mempool min relay fees, etc - [x] Make a repo for signet chaincode seminar exercises/question banks https://github.com/learn-me-a-signet/signet-ex ## TODO: - [x] Run a signet - [x] Familiarise with the scripts - [x] Check if anyone can join as a miner later, if not generate 50 keys to distribute, k of n 1 or 50 - [ ] Can we use taproot multisig (MuSig/MuSig2) - [x] Check if I can mine blocks on my own - [ ] Can we implment regular re-orgs using - [ ] Can we automate people joining the signet - [x] Org Learn-me-a-signet: for signet questions ## Notes ### Generate keys using regtest Start bitcoind in regtest mode and create a non-descriptor wallet (so we can use `dumpprivkey` on it). ```bash bitcoind -regtest bitcoin-cli -regtest -named createwallet wallet_name="test" descriptors=false ``` Next generate a few keys, e.g. in bash: ```bash ADDR=$(bitcoin-cli -regtest -rpcwallet="test" getnewaddress) PK=$(bitcoin-cli -regtest -rpcwallet="test" dumpprivkey) bitcoin-cli -regtest -rpcwallet="test" getaddressinfo $ADDR | grep pubkey | cut -d \" -f4 ``` Fish script to generate `n` keys: ```fish function gen-regtest-keys set num $argv[1] for i in (seq $num) set ADDR (bitcoin-cli -regtest -rpcwallet="test" getnewaddress) set PRIVKEY (bitcoin-cli -regtest -rpcwallet="test" dumpprivkey $ADDR) set PUBKEY (bitcoin-cli -regtest -rpcwallet="test" getaddressinfo $ADDR | grep pubkey | cut -d \" -f4) echo "---------------------------------" echo $PRIVKEY echo $PUBKEY end echo "---------------------------------" end ``` then ```shell= gen-regtest-keys 10 ``` This will output privkeys & pubkeys e.g.: ```text --------------------------------- cPu7ZGY3Hs5WdNB73M7ok3VBH1nV7MRwJ8V6vJqyKGwFv5H5f9bC 02e240f3e2e2a4ef79e03fbd0e3afb999997ddbce14c250e73d2f6b7af97f941f7 --------------------------------- cQHXC3dKXLVRVMfeMv35YNvmsVHxViEiJsH5EAgJHz7VKEanfGrQ 038c761f9fa1b29191011ef95acf76328355bc086b8706f79bce931e55075bd978 --------------------------------- cR1L5F4vv3FPc3LNuKkVoYNzD6fjvt88s8H95KXcfj4WQUbz7qwM 0274fac0536a8e7f384dea2b1e209893d3a043c53d835389b80082a8fbf8d5401d --------------------------------- cUVVjKcib4aRMKq5iemTABDprh433b1vq4GRFNv8dTizVJmfXujF 0353e6b2589f6c5872b0a9cd424af60923f73ac5c081fc30ea99f6e5f188f3ad65 --------------------------------- ``` Multisig script for 1-of-4 will resemble: ```text OP_PUSHNUM_1 OP_PUSHBYTES_33 02e240f3e2e2a4ef79e03fbd0e3afb999997ddbce14c250e73d2f6b7af97f941f7 OP_PUSHBYTES_33 038c761f9fa1b29191011ef95acf76328355bc086b8706f79bce931e55075bd978 OP_PUSHBYTES_33 0274fac0536a8e7f384dea2b1e209893d3a043c53d835389b80082a8fbf8d5401d OP_PUSHBYTES_33 0353e6b2589f6c5872b0a9cd424af60923f73ac5c081fc30ea99f6e5f188f3ad65 OP_PUSHNUM_4 OP_CHECKMULTISIG ``` We can use `createmultisig` from Bitcoin Core with e.g.: ```shell bitcoin-cli -regtest -rpcwallet="test" createmultisig 1 "[\"02e240f3e2e2a4ef79e03fbd0e3afb999997ddbce14c250e73d2f6b7af97f941f7\",\"038c761f9fa1b29191011ef95acf76328355bc086b8706f79bce931e55075bd978\",\"0274fac0536a8e7f384dea2b1e209893d3a043c53d835389b80082a8fbf8d5401d\",\"0353e6b2589f6c5872b0a9cd424af60923f73ac5c081fc30ea99f6e5f188f3ad65\"]" ``` We will be returned a fully-formed multisig address, redeem script and descriptor: ```shell { "address": "2N7W7xJ31SGTiYkh3hpmtkFNXqnJV2xzdYX", "redeemScript": "512102e240f3e2e2a4ef79e03fbd0e3afb999997ddbce14c250e73d2f6b7af97f941f721038c761f9fa1b29191011ef95acf76328355bc086b8706f79bce931e55075bd978210274fac0536a8e7f384dea2b1e209893d3a043c53d835389b80082a8fbf8d5401d210353e6b2589f6c5872b0a9cd424af60923f73ac5c081fc30ea99f6e5f188f3ad6554ae", "descriptor": "sh(multi(1,02e240f3e2e2a4ef79e03fbd0e3afb999997ddbce14c250e73d2f6b7af97f941f7,038c761f9fa1b29191011ef95acf76328355bc086b8706f79bce931e55075bd978,0274fac0536a8e7f384dea2b1e209893d3a043c53d835389b80082a8fbf8d5401d,0353e6b2589f6c5872b0a9cd424af60923f73ac5c081fc30ea99f6e5f188f3ad65))#fa4q073s" } ``` We can use the redeem script as the `signetchallenge` for the signet. ### Start mining on signet First we want to fire up a node on our custom signet. Start by editing `bitcoin.conf`: ```text daemon=1 signet=1 # The redeem script for the multisig signetchallenge=512102e240f3e2e2a4ef79e03fbd0e3afb999997ddbce14c250e73d2f6b7af97f941f721038c761f9fa1b29191011ef95acf76328355bc086b8706f79bce931e55075bd978210274fac0536a8e7f384dea2b1e209893d3a043c53d835389b80082a8fbf8d5401d210353e6b2589f6c5872b0a9cd424af60923f73ac5c081fc30ea99f6e5f188f3ad6554ae ``` Start bitcoind from the new conf (reccomend `-datadir` over `-conf` for cleanliness) and test to see that we're running. ```bash bitcoind -datadir=$HOME/signet/1/ bitcoin-cli -datadir=$HOME/signet/1 -getinfo ``` Create a wallet and import one of the privkeys used to create the multisig into it: ```bash= bitcoin-cli -datadir=$HOME/signet/1 -named createwallet wallet_name="test" descriptors=false bitcoin-cli -datadir=$HOME/signet/1 importprivkey cPu7ZGY3Hs5WdNB73M7ok3VBH1nV7MRwJ8V6vJqyKGwFv5H5f9bC ``` **WARNING**: Need to use the mining script from master, since there is a bug which has been fixed by [24553](https://github.com/bitcoin/bitcoin/pull/24553). Follow the guide to mining from the [Signet Readme](https://github.com/bitcoin/bitcoin/blob/v23.0rc2/contrib/signet/README.md#miner) (in bitcoin source dir): ```bash cd src/ MINER="../contrib/signet/miner" GRIND="./bitcoin-util grind" $MINER calibrate --grind-cmd="$GRIND" nbits=1e00f403 for 25s average mining time ``` To mine the first block in the custom chain run: ```bash CLI="./bitcoin-cli -datadir=$HOME/signet/1" ADDR=$($CLI -signet getnewaddress) NBITS=1e00f403 $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS ``` To mine continuously: ```bash= $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS --ongoing --multiminer=1/4 ``` Using the --multiminer parameter allows mining to be distributed amongst multiple miners. For example, if you have 3 miners and want to share blocks between them, specify --multiminer=1/3 on one, --multiminer=2/3 on another, and --multiminer=3/3 on the last one. If you want one to do 10% of blocks and two others to do 45% each, --multiminer=1-10/100 on the first, and --multiminer=11-55 and --multiminer=56-100 on the others. Note that which miner mines which block is determined by the previous block hash, so occasional runs of one miner doing many blocks in a row is to be expected. When --multiminer is used, if a miner is down and does not mine a block within five minutes of when it is due, the other miners will automatically act as redundant backups ensuring the chain does not halt. The --backup-delay parameter can be used to change how long a given miner waits, allowing one to be the primary backup (after five minutes) and another to be the secondary backup (after six minutes, eg). The --standby-delay parameter can be used to make a backup miner that only mines if a block doesn't arrive on time. This can be combined with --multiminer if desired. Setting --standby-delay also prevents the first block from being mined immediately. ## Misc [min.sc policy](https://min.sc/#c=A%20%3D%2002e240f3e2e2a4ef79e03fbd0e3afb999997ddbce14c250e73d2f6b7af97f941f7%3B%0AB%20%3D%20038c761f9fa1b29191011ef95acf76328355bc086b8706f79bce931e55075bd978%3B%0AC%20%3D%200274fac0536a8e7f384dea2b1e209893d3a043c53d835389b80082a8fbf8d5401d%3B%0AD%20%3D%200353e6b2589f6c5872b0a9cd424af60923f73ac5c081fc30ea99f6e5f188f3ad65%3B%0A%0A1%20of%20%5B%20pk%28A%29%2C%20pk%28B%29%2C%20pk%28C%29%2C%20pk%28D%29%20%5D)

Import from clipboard

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template is not available.
Upgrade
All
  • All
  • Team
No template found.

Create custom template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

How to use Slide mode

API Docs

Edit in VSCode

Install browser extension

Get in Touch

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Upgrade to Prime Plan

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

No updates to save
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Upgrade

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Upgrade

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully