マルチシグ化
8.マルチシグトランザクションの実行
address3を、address1,address2を連署者とした1of2のマルチシグ化するトランザクションを実行します。
使用するトランザクションは前項:7.AggregateBondedサンプルと同じ、AggregateBondedトランザクションになります。
実行
node 08_multisig_transaction.js
出力例:
network 96
GenerationHash 7E77022504E4EAEFC49F4C1F33A30BEE6E40417BB63597CA400EED72ECBFF6A4
Fee TransactionFees {
averageFeeMultiplier: 0,
medianFeeMultiplier: 0,
highestFeeMultiplier: 0,
lowestFeeMultiplier: 0,
minFeeMultiplier: 0
}
UInt64 { lower: 0, higher: 0 }
------------------- signedTransaction ------------------------
SignedTransaction {
payload: '<payloadが表示されます>',
hash: '55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2',
signerPublicKey: '<送信元workaddressのpublicKeyが表示されます>',
type: 16961,
networkType: 96
}
------------------- hashRockTransaction ------------------------
LockFundsTransaction {
type: 16712,
networkType: 96,
version: 1,
deadline: Deadline { adjustedValue: 127126704591 },
maxFee: UInt64 { lower: 0, higher: 0 },
signature: undefined,
signer: undefined,
transactionInfo: undefined,
payloadSize: undefined,
mosaic: Mosaic {
id: MosaicId { id: [Id] },
amount: UInt64 { lower: 0, higher: 0 }
},
duration: UInt64 { lower: 1000, higher: 0 },
hash: '55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2'
}
------------------- sendTransaction ------------------------
------------------- Success --------------------------------
Success: Transaction AggregateTransaction {
type: 16961,
networkType: 96,
version: 2,
deadline: Deadline { adjustedValue: 127202304571 },
maxFee: UInt64 { lower: 0, higher: 0 },
signature: '<signatureが表示されます>',
signer: PublicAccount {
publicKey: '<送信元workaddressのpublicKeyが表示されます>',
address: Address {
address: '<送信元workaddressのアドレスが表示されます>',
networkType: 96
}
},
transactionInfo: TransactionInfo {
height: UInt64 { lower: 0, higher: 0 },
index: undefined,
id: undefined,
timestamp: UInt64 { lower: 0, higher: 0 },
feeMultiplier: 0,
hash: '55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2',
merkleComponentHash: '0000000000000000000000000000000000000000000000000000000000000000'
},
payloadSize: undefined,
innerTransactions: [
TransferTransaction {
type: 16724,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: undefined,
payloadSize: undefined,
recipientAddress: [Address],
mosaics: [Array],
message: [PlainMessage]
},
MultisigAccountModificationTransaction {
type: 16725,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: undefined,
payloadSize: undefined,
minApprovalDelta: 1,
minRemovalDelta: 1,
addressAdditions: [Array],
addressDeletions: []
}
],
cosignatures: []
}
Next Command: node ./07_02_aggregate_bonded_transaction_cosign address1 55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2
Next Command: node ./07_02_aggregate_bonded_transaction_cosign address2 55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2
Next Command: node ./07_02_aggregate_bonded_transaction_cosign address3 55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2
最期に Next Command: が3つ表示されます。
上記でworkaddressが発行したTxhashに対して、address1,address2,address3がそれぞれ署名を行います。
署名は
- address1
- address2
- address3
3つのアドレスが署名を期限内に行う必要があります。
本サンプルでは期限を2時間としています。
署名を実行する際に、署名対象のTxhashを指定します。
上記出力例ではTxhashとして 55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2
が表示されていますが、実行は実際のTxhashを指定して下さい。
address1の署名
実行
node 07_02_aggregate_bonded_transaction_cosign.js address1 <出力されたTxhash>
出力例:
node ./07_02_aggregate_bonded_transaction_cosign address1 55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2
network 96
GenerationHash 7E77022504E4EAEFC49F4C1F33A30BEE6E40417BB63597CA400EED72ECBFF6A4
AggregateTransaction {
type: 16961,
networkType: 96,
version: 2,
deadline: Deadline { adjustedValue: 127202304571 },
maxFee: UInt64 { lower: 0, higher: 0 },
signature: '<signatureが表示されます>',
signer: PublicAccount {
publicKey: '<送信元workaddressのpublicKeyが表示されます>',
address: Address {
address: '<送信元workaddressのアドレスが表示されます>',
networkType: 96
}
},
transactionInfo: TransactionInfo {
height: UInt64 { lower: 0, higher: 0 },
index: 0,
id: '6493E303E1FE0179BF2C2C3C',
timestamp: UInt64 { lower: 0, higher: 0 },
feeMultiplier: 0,
hash: '55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2',
merkleComponentHash: '0000000000000000000000000000000000000000000000000000000000000000'
},
payloadSize: 392,
innerTransactions: [
TransferTransaction {
type: 16724,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: [AggregateTransactionInfo],
payloadSize: undefined,
recipientAddress: [Address],
mosaics: [Array],
message: [PlainMessage]
},
MultisigAccountModificationTransaction {
type: 16725,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: [AggregateTransactionInfo],
payloadSize: undefined,
minApprovalDelta: 1,
minRemovalDelta: 1,
addressAdditions: [Array],
addressDeletions: []
}
],
cosignatures: []
}
address2の署名
実行
node 07_02_aggregate_bonded_transaction_cosign.js address2 <出力されたTxhash>
出力例:
node ./07_02_aggregate_bonded_transaction_cosign address2 55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2
network 96
GenerationHash 7E77022504E4EAEFC49F4C1F33A30BEE6E40417BB63597CA400EED72ECBFF6A4
AggregateTransaction {
type: 16961,
networkType: 96,
version: 2,
deadline: Deadline { adjustedValue: 127038296433 },
maxFee: UInt64 { lower: 0, higher: 0 },
signature: '<signatureが表示されます>',
signer: PublicAccount {
publicKey: '<送信元workaddressのpublicKeyが表示されます>',
address: Address {
address: '<送信元workaddressのアドレスが表示されます>',
networkType: 96
}
},
transactionInfo: TransactionInfo {
height: UInt64 { lower: 0, higher: 0 },
index: 0,
id: '64916266E1FE0179BF2BAB44',
timestamp: UInt64 { lower: 0, higher: 0 },
feeMultiplier: 0,
hash: '55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2',
merkleComponentHash: '0000000000000000000000000000000000000000000000000000000000000000'
},
payloadSize: 392,
innerTransactions: [
TransferTransaction {
type: 16724,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: [AggregateTransactionInfo],
payloadSize: undefined,
recipientAddress: [Address],
mosaics: [Array],
message: [PlainMessage]
},
MultisigAccountModificationTransaction {
type: 16725,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: [AggregateTransactionInfo],
payloadSize: undefined,
minApprovalDelta: 1,
minRemovalDelta: 1,
addressAdditions: [Array],
addressDeletions: []
}
],
cosignatures: [
AggregateTransactionCosignature {
signature: '<signatureが表示されます>',
signer: [PublicAccount],
version: [UInt64]
}
]
}
address3の署名
実行
node 07_02_aggregate_bonded_transaction_cosign.js address3 <出力されたTxhash>
出力例:
node ./07_02_aggregate_bonded_transaction_cosign address3 55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2
network 96
GenerationHash 7E77022504E4EAEFC49F4C1F33A30BEE6E40417BB63597CA400EED72ECBFF6A4
AggregateTransaction {
type: 16961,
networkType: 96,
version: 2,
deadline: Deadline { adjustedValue: 127202304571 },
maxFee: UInt64 { lower: 0, higher: 0 },
signature: '<signatureが表示されます>',
signer: PublicAccount {
publicKey: '<送信元workaddressのpublicKeyが表示されます>',
address: Address {
address: '<送信元workaddressのアドレスが表示されます>',
networkType: 96
}
},
transactionInfo: TransactionInfo {
height: UInt64 { lower: 0, higher: 0 },
index: 0,
id: '6493E303E1FE0179BF2C2C3C',
timestamp: UInt64 { lower: 0, higher: 0 },
feeMultiplier: 0,
hash: '55C8CA907165A5610A5C33969338C0CA0D441E7FB5274BAF01FE7B799DDDCFF2',
merkleComponentHash: '0000000000000000000000000000000000000000000000000000000000000000'
},
payloadSize: 392,
innerTransactions: [
TransferTransaction {
type: 16724,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: [AggregateTransactionInfo],
payloadSize: undefined,
recipientAddress: [Address],
mosaics: [Array],
message: [PlainMessage]
},
MultisigAccountModificationTransaction {
type: 16725,
networkType: 96,
version: 1,
deadline: [Deadline],
maxFee: [UInt64],
signature: '<signatureが表示されます>',
signer: [PublicAccount],
transactionInfo: [AggregateTransactionInfo],
payloadSize: undefined,
minApprovalDelta: 1,
minRemovalDelta: 1,
addressAdditions: [Array],
addressDeletions: []
}
],
cosignatures: [
AggregateTransactionCosignature {
signature: '<signatureが表示されます>',
signer: [PublicAccount],
version: [UInt64]
},
AggregateTransactionCosignature {
signature: '<signatureが表示されます>',
signer: [PublicAccount],
version: [UInt64]
}
]
}
マルチシグ化アカウント情報の取得
上記でマルチシグ化を実施した、address3のアカウント情報を確認します。
- address3
実行
node account_info.js address3
出力例:
AccountInfo {
url: 'https://xxxxxxxx.mijin.io',
network: '96',
account: 'address3',
address: '<address3のアドレスが表示されます>',
mosaics: [
{
mosaic: '1D361778B3471970',
amount: '3',
namespaceAlias: 'techbureau'
}
],
linkedKeys: { linked: 'None', node: 'None', vrf: 'None', voting: 'None' },
meta: [],
multisig: [
'<address1のアドレスが表示されます>',
'<address2のアドレスが表示されます>'
]
}
multisig
の値が追加され、連署者であるaddress1,address2が表示されます。
参考)ブロックチェーンエクスプローラーでaddress3のアドレスを検索すると、以下の様に表示されます。
ブロックチェーンエクスプローラーに関しては以下FAQを参照ください。