Created
June 15, 2021 12:42
-
-
Save marcozecchini/1b39858faea9d19fc4a7323d2210b571 to your computer and use it in GitHub Desktop.
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 fs = require('fs'); | |
const path = require('path'); | |
const algosdk = require('algosdk'); | |
const { countReset } = require('console'); | |
const baseServer = 'https://testnet-algorand.api.purestake.io/ps2'; | |
const port = ''; | |
const token = { | |
'X-API-Key': 'F9I45UDrFb9FuoYhohD35A2Tcfq0mnZ5cTuG81x9', | |
} | |
const postHeader = { | |
'content-type' : 'application/x-binary' | |
} | |
//instantiate the algod wrapper | |
let algodClient = new algosdk.Algodv2(token, baseServer, port); | |
// Function used to wait for a tx confirmation | |
const waitForConfirmation = async function (algodClient, txId) { | |
const response = await algodClient.status().do(); | |
let lastround = response["last-round"]; | |
while (true) { | |
const pendingInfo = await algodClient.pendingTransactionInformation(txId).do(); | |
if (pendingInfo["confirmed-round"] !== null && pendingInfo["confirmed-round"] > 0) { | |
//Got the completed Transaction | |
console.log("Transaction " + txId + " confirmed in round " + pendingInfo["confirmed-round"]); | |
break; | |
} | |
lastround++; | |
await algodClient.statusAfterBlock(lastround).do(); | |
} | |
}; | |
const main = async (i) => { | |
// get suggested parameters | |
const params = await algodClient.getTransactionParams().do(); | |
let accounts = [] | |
let count = 1024; | |
for (let i = 0; i<count; i++ ){ | |
accounts.push(algosdk.generateAccount().addr) | |
} | |
//Setup the parameters for the multisig account | |
const mparams = { | |
version: 1, | |
threshold: 255, | |
addrs: accounts, | |
}; | |
let multsigaddr = algosdk.multisigAddress(mparams); | |
console.log("Multisig Address: " + multsigaddr); | |
// Fund TestNet account | |
console.log('Dispense funds to this account on TestNet https://bank.testnet.algorand.network/'); | |
}; | |
main(123).then().catch(e => { | |
const error = e.body && e.body.message ? e.body.message : e; | |
console.log(error); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment