# Multi-Signature Address

# Introduction

Multi-Signature Address are relative to single-signature accounts. The common account address we use every day is that a single-signature account needs to be signed with our account private key when creating a transaction to ensure that our transaction is safe and not changed. The Multi-Signature Address address is generated by a certain calculation by a public key of multiple common accounts.When creating a transaction, it needs to be signed by the private key corresponding to the multiple public keys that create this multi-signed account, in order to ensure the security of multi-signing account transactions.

When generating a multi-sign account, the public key of N common addresses is used to generate a multi-sign account that requires M signatures to create a legitimate transaction, N ≥ M.Therefore, this account generally requires multiple people to sign, and the minimum number of signatures (M) can be used to use the account's token.

# Features

Multi-Signature Addresss in NULS2.0 can do some of the same operations as regular accounts:

  • Create multi-sign transfer transactions with Chain Assets and Contract Assets transfers
  • Set an alias for a multi-signed account
  • Create a consensus node
  • Participation in consensus stake

# Instructions

We'll cover how to use the various features of a Multi-Signature Address, the issues you might encounter, and the issues developers need to pay attention when assembling multi-sign transactions.Developers may need to have some knowledge of the NULS2.0 general transaction before reading this article.This document contains some interface descriptions. For a more complete description, please refer to the module documentation.

Generate Multi-Signature Address

A Multi-Signature Address is generated by multiple common addresses in order to satisfy the functional scenario of an asset transaction that allows multiple people to control an account.Therefore, when creating a multi-sign account, neither the public key nor the private key is generated, but the generated multi-sign account information includes the public key, the minimum number of signatures, the multi-signing account address, etc. of all participants when the account is generated. information. It is worth noting that the participant public key list is a string list parameter with compatibility. The list can be used to input the string of the common account public key or the string of the account address, and can be mixed in, for example. There are three common accounts a, b, and c, and you need to create a Multi-Signature Address. The public key list can be as follows:

pubKeys = [public key of A account, address of B account, public key of C account]

note

  • If you want to pass in the account address, then the address account needs to exist in the node that invokes the interface. The public key string does not have this restriction.
  • The order in which each public key in the pubKeys public key list is passed does not affect the resulting account.
  • The public key string can be obtained by calling the interface module 'ac_getPubKey`.

Create a Multi-Sign Transfer Transaction

The multi-signature address transfer transaction in NULS2.0 is consistent with the general address transfer transaction protocol and has the same transaction type (type value).However, multi-sign transfer transactions still have special characteristics. The rules for assembling and verifying transactions are different from ordinary transactions. Some things to note are:

  • Transaction from can not mix multiple different addresses, multi-sign transfer transactions If multiple from is assembled, then all from addresses can only be the same multi-sign address, the assets in from can be different, the transaction to There is no such restriction.
  • Signatures or signatures when assembling new deals.
  • Broadcast transactions are automatically sent when the minimum number of signatures is reached after signing.
  • There is no need to continue signing transactions that have reached the minimum number of signatures, it will only increase transaction data, and will not bring more convenience to transaction verification and security.

Signature

After the multi-signal transaction is assembled, it is generally necessary to hand over the transaction data to each multi-sign account controller to sign the transaction separately, so that the minimum signature number of the multi-sign account is satisfied, and finally complete and legal transaction data is obtained.The multi-signing transaction signature interface of NULS2.0 automatically verifies whether the transaction reaches the minimum number of signatures after each execution of the signature, to decide whether to send and broadcast the transaction, without the user separately broadcasting the transaction.

  • When multiple people sign, the next signer only needs to get the value of tx in the return value.

Set Alias, Create Node, Delegate, Exit Delegate, Stop Node transaction is basically the same as ordinary account transaction, but the signature method is different.

# Interface

# ac_createMultiSignAccount

Create a multi-sign account /create a multi sign account

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
pubKeys list<string> Public key collection (public key of any common address or common account address present in the current node) Yes
minSigns int Minimum Signature Yes

return value

Field Name Field Type Parameter Description
address string Multi-Sign Account Address

# ac_createMultiSignTransfer

Create a multi-signal address transfer transaction /create multi sign transfer

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
inputs list Transaction payer data Yes
        address string Account Address Yes
        assetsChainId integer Asset Chain ID Yes
        assetsId integer Asset ID Yes
        amount biginteger Quantity Yes
outputs list Transaction Recipient Data Yes
        address string Account Address Yes
        assetsChainId integer Asset Chain ID Yes
        assetsId integer Asset ID Yes
        amount biginteger Quantity Yes
        lockTime long unlock time, -1 is always locked, 0 is not locked (default) no
remark string Transaction Notes Yes
signAddress string The first signature account address (without filling, only create transactions are not signed) No
signPassword string The first signature account password (without filling, only create transactions are not signed) No

return value

Field Name Field Type Parameter Description
tx string Complete transaction serialization string, continue signature if the transaction does not reach the minimum number of signatures
txHash string Trading hash
completed boolean true: the transaction is complete (broadcast), false: the transaction is not completed, the minimum number of signatures has not been reached

# ac_signMultiSignTransaction

Multi-sign transaction signature / sign MultiSign Transaction

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
tx string Transaction Data String Yes
signAddress string Signature Account Address Yes
signPassword string Signature Account Password Yes

return value

Field Name Field Type Parameter Description
tx string Complete transaction serialization string, continue signature if the transaction does not reach the minimum number of signatures
txHash string Trading hash
completed boolean true: the transaction is complete (broadcast), false: the transaction is not completed, the minimum number of signatures has not been reached

# ac_setMultiSignAlias

Set the alias of multi sign account

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
address string Multi-Sign Account Address Yes
alias string alias yes
signAddress string The first signature account address (without filling, only create transactions are not signed) No
signPassword string The first signature account password (without filling, only create transactions are not signed) No

return value

Field Name Field Type Parameter Description
tx string Complete transaction serialization string, continue signature if the transaction does not reach the minimum number of signatures
txHash string Trading hash
completed boolean true: the transaction is complete (broadcast), false: the transaction is not completed, the minimum number of signatures has not been reached

# cs_createMultiAgent

Multi-Sign Account Create Agent transaction

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
agentAddress string node address (multiple signing address) yes
packingAddress string Node Block Address Yes
rewardAddress string reward address, default node address no
commissionRate int Commission Ratio Yes
deposit string Mortgage amount Yes
password string Signature Account Password Yes
signAddress string Signature Account Address Yes

return value

Field Name Field Type Parameter Description
tx string Complete transaction serialization string, continue signature if the transaction does not reach the minimum number of signatures
txHash string Trading hash
completed boolean true: the transaction is complete (broadcast), false: the transaction is not completed, the minimum number of signatures has not been reached

# cs_multiDeposit

Multi-Sign Account deposit agent transaction

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
address string Multi-Sign Account Address Yes
agentHash string Node HASH Yes
deposit string commission amount yes
password string Signature Account Password Yes
signAddress string Signature Account Address Yes

return value

Field Name Field Type Parameter Description
tx string Complete transaction serialization string, continue signature if the transaction does not reach the minimum number of signatures
txHash string Trading hash
completed boolean true: the transaction is complete (broadcast), false: the transaction is not completed, the minimum number of signatures has not been reached

# cs_multiWithdraw

Multi-Sign Account withdraw deposit agent transaction

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
address string Multi-Sign Account Address Yes
txHash string Join the consensus transaction HASH Yes
password string Signature Account Password Yes
signAddress string Signature Account Address Yes

return value

Field Name Field Type Parameter Description
tx string Complete transaction serialization string, continue signature if the transaction does not reach the minimum number of signatures
txHash string Trading hash
completed boolean true: the transaction is complete (broadcast), false: the transaction is not completed, the minimum number of signatures has not been reached

# cs_stopMultiAgent

Multi-Sign Account Stop Agent

Parameter Name Parameter Type Parameter Description Is Not Empty
chainId int chain id yes
address string node address (multiple signing address) yes
password string Signature Account Password Yes
signAddress string Signature Account Address Yes

return value

Field Name Field Type Parameter Description
tx string Complete transaction serialization string, continue signature if the transaction does not reach the minimum number of signatures
txHash string Trading hash
completed boolean true: the transaction is complete (broadcast), false: the transaction is not completed, the minimum number of signatures has not been reached
Last Updated: 1/31/2024, 10:54:06 PM