Skip to content

Instantly share code, notes, and snippets.

@kctam
kctam / asa_checkBoth.js
Created December 18, 2020 05:49
Algorand ASA demo in JavaScript SDK
const algosdk=require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY" // fill in yours
};
var aliceAddress = '5SL7MUMPYFNDBHUD4L7J4LJRQCQWXQUD3RDK7SBGIDWPH3ZFK47BTH43HE'; // change to yours
var bobAddress = 'BDGUP3RKI3DJVM327B3R4SYT6PQUJBMDMQWHQICKSEQQT6PWCMNAYWEY4M'; // change to yours
@kctam
kctam / asa_bobRemoveOptIn.js
Created December 18, 2020 05:47
Algorand ASA demo in JavaScript SDK
const algosdk = require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY"
};
var bob_mnemonic = "truth erase *** above magic"; // fill in yours
@kctam
kctam / asa_aliceDestroy.js
Last active December 18, 2020 05:47
Algorand ASA demo in JavaScript SDK
const algosdk = require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY" // fill in yours
};
var alice_mnemonic = "cash riot *** able can"; // fill in yours
var aliceAccount = algosdk.mnemonicToSecretKey(alice_mnemonic);
@kctam
kctam / asa_bobOptIn.js
Created December 18, 2020 05:41
Algorand ASA demo in JavaScript SDK
const algosdk = require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY" // fill in yours
};
var bob_mnemonic = "truth erase *** above magic"; // fill in yours
var bobAccount = algosdk.mnemonicToSecretKey(bob_mnemonic);
@kctam
kctam / asa_aliceSendToBob.js
Created December 18, 2020 05:39
Algorand ASA demo in JavaScript SDK
const algosdk = require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY" // fill in yours
};
var alice_mnemonic = "cash riot *** able can"; // fill in yours
var aliceAccount = algosdk.mnemonicToSecretKey(alice_mnemonic);
@kctam
kctam / asa_aliceCreate.js
Created December 18, 2020 05:37
Algorand ASA demo in JavaScript SDK
const algosdk = require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY" // fill in yours
};
var alice_mnemonic = "cash riot *** able can"; // fill in yours
var aliceAccount = algosdk.mnemonicToSecretKey(alice_mnemonic);
@kctam
kctam / main.go
Created November 25, 2020 06:57
Sample chaincode (adapted from SACC) for BSN TestNet
/*
* Copyright IBM Corp All Rights Reserved
*
* SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"fmt"
@kctam
kctam / ccctest.go
Created November 21, 2020 13:03
Testing chaincode for InvokeChaincode()
/*
* Copyright IBM Corp All Rights Reserved
*
* SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"fmt"
@kctam
kctam / send_algos.js
Created November 9, 2020 01:39
Algorand demonstration with JS SDK
const algosdk=require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY"
};
let client=new algosdk.Algodv2(token,server,port);
let mnemonic1='attract unit *** above trip'; // 25-word mnemonic
@kctam
kctam / check_balance.js
Created November 9, 2020 01:29
Algorand demonstration with JS SDK
const algosdk=require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY" // fill in yours
};
let client=new algosdk.Algodv2(token,server,port);