Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.93 KB

MULTISIG.md

File metadata and controls

60 lines (43 loc) · 1.93 KB

Multi Sig usage

Make sure to setup Multi Sig wallets following the Hathor Documentation:

Example usage can be found in HathorMultiSigTests.cs

Collect Public Keys

IHathorWalletApi client = HathorClient.GetWalletClient("http://localhost:8000", "WALLET_SEED_KEY");

var xpubkey = await client. MultiSigGetPubKey(new GetMultiSigPubKeyRequest("WALLET_SEED_KEY"));
            

Start MultiSig Wallets

It's the same as starting a normal wallet, only set multiSig to true

var multi1Response = await client.Start(new StartRequest("WALLET_ID", "WALLET_SEED_KEY", multiSig: true));

Create a MultiSig Transaction

You can create a normal transaction, but instead of sending it, you create a proposal. This will return a transaction Hex.

SendTransactionRequest transaction = new SendTransactionRequest()
{
    Outputs = new System.Collections.Generic.List<Output>()
    {
        new Output("HTR_ADDRESS", 1, "00")
    }
};

var response = await client. MultiSigSendTransactionProposal(transaction);

var txHex = response.TxHex;

Check the MultiSig Transaction

The proposal hex can be checked before signing it.

var decoded = await client.Decode(new DecodeRequest() { TxHex = txHex});

Get Participant Signatures

When you trust the hex you received, you can sign it.

var signature = await clientMultiSig1. MultiSigGetMySignaturesForTxProposal(new EncodedTxRequest(txHex));

Send the MultiSig Transaction

When you collected enough signatures from the MultiSig participants, you can push the transaction to the network.

var response = await clientMultiSig1. MultiSigSignAndPush(new EncodedTxWithSignaturesRequest(txHex, new System.Collections.Generic.List<string>() { signature1, signature2 }));