This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node v14.4.0 | |
// symbol-sdk v0.21.0 | |
const { Convert, KeyPair, PublicAccount, NetworkType } = require('symbol-sdk'); | |
const publicKey = "717082D8AFB7E9CDED9A1281F96CFB90C985752E19178503BDABA596B0721567"; | |
const signature = "BF51455E759C3CF55C1104B2699183328181EBAD68FD7B53DF53A88F99F633CFAC08C9D2D6E8B3EABEC0B6F017017737440AB6C0C92B74BA7B1EE2B71475BD06"; | |
const hash = "17F752A6399550727919EB2EFFAC178D6F1DE964F06BABD711113020AD71D1DB"; | |
const publicAccount = PublicAccount.createFromPublicKey(publicKey, NetworkType.MAIN_NET); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node v14.4.0 | |
// symbol-hd-wallets v0.13.0 | |
// dotenv v8.2.0 | |
require('dotenv').config(); | |
const { MnemonicPassPhrase, ExtendedKey, Wallet } = require("symbol-hd-wallets"); | |
const { NetworkType } = require('symbol-sdk'); | |
const DEFAULT_ACCOUNT_PATH = "m/44'/4343'/0'/0'/0'"; | |
const VRF_ACCOUNT_PATH = "m/44'/4343'/0'/1'/0'"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node v14.4.0 | |
// symbol-sdk v0.21.0 | |
const { Transaction, Convert } = require('symbol-sdk'); | |
const hash = (signedTransactionPayload, generationHash) => { | |
return Transaction.createTransactionHash( | |
signedTransactionPayload, | |
Array.from(Convert.hexToUint8(generationHash)) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
NetworkType, | |
ReceiptHttp, | |
UInt64 | |
} from 'nem2-sdk'; | |
import {sha3_256} from 'js-sha3'; | |
(async () => { | |
const receiptHttp = new ReceiptHttp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BlockRepository, RepositoryFactoryHttp, UInt64} from "nem2-sdk"; | |
import {sha3_256} from "js-sha3"; | |
const validateTransactionInBlock = async (leaf: string, height: UInt64, blockHttp: BlockRepository) => { | |
// 1.Calculate H(B) (leaf) | |
// 2. Obtain HRoot; in Symbol, this is stored in the block header. | |
const HRoot = (await blockHttp.getBlockByHeight(height).toPromise()).blockTransactionsHash; | |
console.log('Hroot', HRoot); | |
// 3. Request merkle path H(A), HCD, HEE2. | |
const merklePath = (await blockHttp.getMerkleTransaction(height, leaf).toPromise()).merklePath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine | |
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 | |
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | |
sudo yum install -y docker-ce docker-ce-cli containerd.io | |
sudo systemctl start docker | |
sudo docker run hello-world | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
// ここでログアウトして再度ログインする | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const account = Account.createFromPrivateKey('7808B5B53ECF24E40BE17B8EC3D0EB5F7C3F3D938E0D95A415F855AD4C27B2A4', NetworkType.MIJIN_TEST); | |
const recipient = Address.createFromRawAddress('SB2Y5ND4FDLBIO5KHXTKRWODDG2QHIN73DTYT2PC'); | |
const tx1 = SecretLockTransaction.create( | |
Deadline.create(), | |
new Mosaic(new MosaicId('nem:xem'), UInt64.fromUint(100000000)), | |
UInt64.fromUint(60), | |
HashType.SHA3_512, | |
secret, | |
recipient, | |
NetworkType.MIJIN_TEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @internal | |
* Serialize and sign transaction creating a new SignedTransaction | |
* @param account | |
* @returns {CosignatureSignedTransaction} | |
*/ | |
public signWith(account: Account): CosignatureSignedTransaction { | |
const aggregateSignatureTransaction = new CosignaturetransactionLibrary(this.transactionToCosign.transactionInfo!.hash); | |
const signedTransactionRaw = aggregateSignatureTransaction.signCosignatoriesTransaction(account); | |
return new CosignatureSignedTransaction(signedTransactionRaw.parentHash, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {KeyPair } keyPair KeyPair instance | |
* @returns {module:model/TransactionPayload} - Signed Transaction Payload | |
*/ | |
signTransaction(keyPair) { | |
const byteBuffer = this.serialize(); | |
const signingBytes = byteBuffer.slice(4 + 64 + 32); | |
const keyPairEncoded = KeyPair.createKeyPairFromPrivateKeyString(keyPair.privateKey); | |
const signature = Array.from(KeyPair.sign(keyPair, new Uint8Array(signingBytes))); | |
const signedTransactionBuffer = byteBuffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Transfer transaction schema | |
* @const {module:schema/Schema} | |
*/ | |
const schema = new Schema([ | |
uint('size'), | |
array('signature'), | |
array('signer'), | |
ushort('version'), | |
ushort('type'), |
NewerOlder