Skip to content

Instantly share code, notes, and snippets.

View cgcardona's full-sized avatar
💭
🤖

Gabriel Cardona cgcardona

💭
🤖
View GitHub Profile

Scale Infinitely via Subnets

What is Avalanche?

Avalanche is a global financial network for the issuing and trading of all digital goods. We enable potentially millions of validators to process thousands of transactions per second with near instant finality using a protocol which is completely green and quiescent. We've paired this high throughput and fast finality protocol w/ an architecture that can meet the needs of unique financial services and decentralized apps.

We accomplish this through the notion of Subnets. Subnets allow anyone anywhere to spin up a taylor-made network w/ custom virtual machines and complex validator rulesets.

Avalanche is a network of networks. It's a platform of platforms where we invision thousands and thousands of public and private Subnets all emerging into this global marketplace which we call The Internet of Finance.

Introduction To Avalanche

Introduction

We're going to go ahead and get started. My name is Gabriel Cardona. I'm Developer Evangelist at Ava Labs. Today's presentation is going to be a high level introduction to the Avalanche Network. We're going to talk about a few of the unique attributes of the Avalanche network which are namely Avalanche Consensus, Subnets and Virtual Machines.

What is Avalanche?

Avalanche is a global financial network for the issuing and trading of all digital goods. We enable potentially millions of validators to process thousands of transactions per second with near instant finality using a protocol which is completely green and quiescent. We've paired this high throughput and fast finality protocol w/ an architecture that can meet the needs of unique financial services and decentralized apps.

How to Launch an Avalanche Subnet

Introduction

We're going to go ahead and get started. My name is Gabriel Cardona. I'm a Developer Evangelist at Ava Labs. Today's presentation is going to be "How to launch an Avalanche Subnet" with a high level introduction to the Avalanche Network followed by demo. We're going to talk about several of the unique attributes of the Avalanche network which are Avalanche Consensus, Network of Networks, Subnets and Virtual Machines and then I'll show how to deploy a local test network for development.

What is Avalanche?

The obvious place to start is what is Avalanche? Avalanche is a global financial network for the issuing and trading of all digital goods. We enable potentially millions of validators to process thousands of transactions per second with near instant finality using a protocol which is completely green and quiescent. We've paired this high throughput and fast finality protocol w/ an architecture that can meet the needs of unique financial services and d

@cgcardona
cgcardona / walkTheDom.js
Last active February 19, 2023 17:46
Recursive function which allows us to go through the tree and visit all the nodes. From Douglas Crockford: An Inconvenient API - The Theory of the DOM @ 27:34 https://youtu.be/Y2Y0U-2qJMs?t=1654
function walkTheDOM(node, callback) {
callback(node)
node = node.firstChild
while (node) {
walkTheDOM(node, callback)
node = node.nextSibling
}
}
task("check-erc20-balance", "Prints out the ERC20 balance of your account").setAction(async function (taskArguments, hre) {
const genericErc20Abi = require("./erc20.abi.json");
const tokenContractAddress = "0x...";
const provider = ethers.getDefaultProvider("https://api.avax.network/ext/bc/C/rpc");
const contract = new ethers.Contract(tokenContractAddress, genericErc20Abi, provider);
const balance = (await contract.balanceOf("0x...")).toString();
console.log(balance)
});
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
import {
Avalanche,
Buffer,
BinTools
} from "../../src"
import {
AVMAPI,
KeyChain,
KeyPair
} from "../../src/apis/avm"

What is Avalanche?

Avalanche is a global financial network for the issuing and trading of all digital goods. We enable potentially millions of validators to process thousands of transactions per second with near instant finality using a protocol which is completely green and quiescent. We've paired this high throughput and fast finality protocol w/ an architecture that can meet the needs of unique financial services and decentralized apps.

We accomplish this through the notion of Subnets. Subnets allow anyone anywhere to spin up a taylor-made network w/ custom virtual machines and complex validator rulesets.

Avalanche is a network of networks. It's a platform of platforms where we invision thousands and thousands of public and private Subnets all emerging into this global marketplace which we call The Internet of Finance.

Avalanche Consensus

@cgcardona
cgcardona / stringify-pchain-tx.ts
Last active October 13, 2022 14:44
This script first fetches the hex of a P-Chain transaction. From that hex it creates a `Buffer` & then it creates an empty P-Chain `Tx` & populates it via passing in the `Buffer` to `tx.fromBuffer`. Next it calls `JSON.stringify` on the `Tx` to encode it as a JSON string. Lastly it takes the JSON string & convert it to an actual JSON object.
import { Avalanche, Buffer } from "avalanche"
import { PlatformVMAPI, Tx } from "avalanche/dist/apis/platformvm"
const ip: string = "api.avax.network"
const port: number = 443
const protocol: string = "https"
const networkID: number = 1
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
const pchain: PlatformVMAPI = avalanche.PChain()
@cgcardona
cgcardona / stringify-xchain-tx.ts
Last active October 13, 2022 14:43
This script first fetches the hex of an X-Chain transaction. From that hex it creates a `Buffer` & then it creates an empty X-Chain `Tx` & populates it via passing in the `Buffer` to `tx.fromBuffer`. Next it calls `JSON.stringify` on the `Tx` to encode it as a JSON string. Lastly it takes the JSON string & convert it to an actual JSON object.
import { Avalanche, Buffer } from "avalanche"
import { AVMAPI, Tx } from "avalanche/dist/apis/avm"
const ip: string = "api.avax.network"
const port: number = 443
const protocol: string = "https"
const networkID: number = 1
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
const xchain: AVMAPI = avalanche.XChain()