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
function sendAndCosignAggregateTransaction(payloads, address1, account2, addressG) { | |
return new Promise((resolve, reject) => { | |
const calcurateTransactionHash = function(payload) { | |
const hashInputPayload = | |
payload.substr(4*2,32*2) + | |
payload.substr((4+64)*2,32*2) + | |
payload.substr((4+64+32)*2); | |
const hasher = sha3_256.create(); | |
return hasher.update(Buffer.from(hashInputPayload, 'hex')).hex().toUpperCase(); | |
} |
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
function createOpeningTransaction(multisigPublicAccount, account1, account2, accountG) { | |
return new Promise((resolve, reject) => { | |
const account1Tx = TransferTransaction.create( | |
Deadline.create(), | |
multisigPublicAccount.address, | |
[XEM.createRelative(5)], | |
PlainMessage.create('opening tx 5XEM'), | |
NetworkType.MIJIN_TEST, | |
); | |
const publicAccount2Tx = TransferTransaction.create( |
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
{ | |
"meta": { | |
"height": [ | |
139357, | |
0 | |
], | |
"hash": "B24F6D9078EC6849F0994B03779C3EDD31BEE886285D1C09F9E886C328A1AC8A", | |
"merkleComponentHash": "477F158D6D98839C0449AED7DC9B782031DEB9A0B617E7BE07567BCECEE0F124", | |
"index": 0, | |
"id": "5C26F8E304C6E10001670980" |
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 |
NewerOlder