Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Multisig Wallet #357

Open
rodendron-xrhodium opened this issue Oct 12, 2021 · 1 comment
Open

Creating Multisig Wallet #357

rodendron-xrhodium opened this issue Oct 12, 2021 · 1 comment

Comments

@rodendron-xrhodium
Copy link

This is a small how-to for creating a multisig wallet.

To start XRC node for testing use following start args:

--chain=XRC -server -iprangefiltering=0 -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 --chain=XRC -server -iprangefiltering=0 rpcuser=*** rpcpassword=*** rpcport=16661 defaultwalletname=multisig1-2of3 txindex=true

Creating Multisig Wallet

curl --location --request POST 'localhost:16661' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic *****' \
--data-raw '[
    {
        "method": "createmutisigwallet",
        "params": [
            "multisig1-2of3", 
            2,             ["xpub6BvFdAWrvdnASyu41VYvS2Q5P4whhnbLZkd9qv6A1AFwwp5DAZTr3hMKTTDYKBsXfW3bXdrqxGmKhn88tAgzn4ws7otv37uxp9DPrGCZoyL",                "xpub6Cnh2EhE9yAggVwQA7mAy2Reh7hP9VsqVMa7FTBckKUYKwHvi1HPJcqwkuunA5V3LRhCvx8EeKdKoxSRFD2GJQeAd7wawJC1jqJvD2HeP8W"],  
            "trim protect peace young drop area rural choose click begin climb live purchase kick domain only easily arrive model file first mind shed empty", 
            "R8bg2JFXBDtPys2r",
            "R8bg2JFXBDtPys2r"
        ],
        "id": 1525052699893
    }
]'

This should create and store the wallet in file system right place. Trigger wallet synchronisation.
This specific wallet will have some xrc coin in mainnet for testing.

To create a raw transaction we use.

curl --location --request POST 'localhost:16661' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic *****' \
--data-raw '[
    {
        "method": "createrawtransaction",
        "params": [
            "[]",
            "{'\''rcrEgwKijMpSDT2FbS7jCQopr1Kv39jfQs'\'': 0.9999,'\''rVbfxyQWq6SWeDfqVYtqLrCCzK8AR2S3Sw'\'': 1.9999}"
        ],
        "id": 1
    }
]'

This returns transaction hex that’s passed to next RPC call.

To fund & sign multisig transaction we call with all co-signer wallets :

curl --location --request POST 'localhost:16661' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ******' \
--data-raw '[
    {
        "method": "fundandsignmultisigtransaction",
        "params": [
            "",
            "01000008000110270000000000001976a9143a25ee63e21887aac3aade9eae0bd67ef8e2b6f788ac00000000",
            "R8bg2JFXBDtPys2r"
        ],
        "id": 1
    }
]'

To switch between other wallets in node we use:

curl --location --request POST 'localhost:16661' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ***' \
--data-raw '[
    {
        "method": "setwallet",
        "params": ["multisig1-2of3"],
        "id": 1525052699893
    }
]'

To combine signatures we use:

curl --location --request POST 'localhost:16661' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ****' \
--data-raw '[
    {
        "method": "combinemultisigsignatures",
        "params": [           
            [
                "010000000148d6fca4cc20ef99cec51d078717f4297137d7b6b4322c320e474b6386c0302d00000000b600004730440220606f4cd9e961c2eef81cf5965143935434e5a221be72f5cfd59cb883cf0f834d022011576c5faed7ae475f64401a0fce62f782f1ee0246a363c705451f7592fb10af01004c695221024a7088f372ca162025f3ddbad6c99ed4d828d9c819c368caa3bc42450f44fb092102784c59f90d06fef61d4fb04a9275ca29219821938240f104bddd6dca2ec48de5210280d767323327d01aa05458ea166c0d74431c778505a2ea7d870b07167c8a4dfc53aeffffffff0233e201000000000017a9141dd822d4bd8db8b9aae1ff3fd44ee9d83ca06be08710270000000000001976a9143a25ee63e21887aac3aade9eae0bd67ef8e2b6f788ac00000000","010000000148d6fca4cc20ef99cec51d078717f4297137d7b6b4322c320e474b6386c0302d00000000b600473044022056737c9434573d9c076b0cb790a1879a1ab9e401f7feb3c5ef59f63c1c1b259c02205fb668af41b70803df162668ddcce185ea62c1590fb48970d958aea9fef97b7d0100004c695221024a7088f372ca162025f3ddbad6c99ed4d828d9c819c368caa3bc42450f44fb092102784c59f90d06fef61d4fb04a9275ca29219821938240f104bddd6dca2ec48de5210280d767323327d01aa05458ea166c0d74431c778505a2ea7d870b07167c8a4dfc53aeffffffff0233e201000000000017a9141dd822d4bd8db8b9aae1ff3fd44ee9d83ca06be08710270000000000001976a9143a25ee63e21887aac3aade9eae0bd67ef8e2b6f788ac00000000"
                ]
        ],
        "id": 1525052699893
    }
]'

To send transaction to network we use:

curl --location --request POST 'localhost:16661' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ****' \
--data-raw '[{
    "method":"sendrawtransaction",
    "params":["010000000148d6fca4cc20ef99cec51d078717f4297137d7b6b4322c320e474b6386c0302d00000000fc00473044022056737c9434573d9c076b0cb790a1879a1ab9e401f7feb3c5ef59f63c1c1b259c02205fb668af41b70803df162668ddcce185ea62c1590fb48970d958aea9fef97b7d014730440220606f4cd9e961c2eef81cf5965143935434e5a221be72f5cfd59cb883cf0f834d022011576c5faed7ae475f64401a0fce62f782f1ee0246a363c705451f7592fb10af014c695221024a7088f372ca162025f3ddbad6c99ed4d828d9c819c368caa3bc42450f44fb092102784c59f90d06fef61d4fb04a9275ca29219821938240f104bddd6dca2ec48de5210280d767323327d01aa05458ea166c0d74431c778505a2ea7d870b07167c8a4dfc53aeffffffff0233e201000000000017a9141dd822d4bd8db8b9aae1ff3fd44ee9d83ca06be08710270000000000001976a9143a25ee63e21887aac3aade9eae0bd67ef8e2b6f788ac00000000"],
    "id":1}]'

@dangershony
Copy link
Member

Thanks this is great, this will help to make a new tab on the UI for multisig once the PR is ready

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

No branches or pull requests

2 participants