Skip to content

Instantly share code, notes, and snippets.

@hoakbuilds
hoakbuilds / Solana
Created September 28, 2021 12:12
Solana dev resources
Guides / Walkthroughs
Intro to Programming on Solana
https://paulx.dev/blog/2021/01/14/programming-on-solana-an-introduction/
Development Tutorial by Solong
https://solongwallet.medium.com/solana-development-tutorial-things-you-should-know-before-structuring-your-code-807f0e2ee43
Intro to Anchor Framework
https://project-serum.github.io/anchor/getting-started/introduction.html
using Solnet.KeyStore;
using Solnet.Programs;
using Solnet.Rpc;
using Solnet.Rpc.Builders;
using Solnet.Rpc.Core.Http;
using Solnet.Rpc.Messages;
using Solnet.Rpc.Models;
using Solnet.Wallet;
using System;
using System.Collections.Generic;
Block Slot: 89661259 Transactions: 1182 Consensus: 981 Percentage: 82.99%
Block Slot: 89661261 Transactions: 1626 Consensus: 1614 Percentage: 99.26%
Block Slot: 89661262 Transactions: 2722 Consensus: 2682 Percentage: 98.53%
Block Slot: 89661263 Transactions: 905 Consensus: 860 Percentage: 95.03%
Block Slot: 89661264 Transactions: 3273 Consensus: 3180 Percentage: 97.16%
Block Slot: 89661265 Transactions: 1217 Consensus: 1165 Percentage: 95.73%
Block Slot: 89661266 Transactions: 2349 Consensus: 2228 Percentage: 94.85%
Block Slot: 89661267 Transactions: 1956 Consensus: 1833 Percentage: 93.71%
Block Slot: 89661270 Transactions: 5612 Consensus: 4911 Percentage: 87.51%
Block Slot: 89661271 Transactions: 2224 Consensus: 20 Percentage: 0.90%
@hoakbuilds
hoakbuilds / FreezeAuthorityExample.cs
Created August 7, 2021 00:36
Example on how to use multi signature accounts to control a token's mint and freeze authorities.
/// <summary>
/// An example on how to control the freeze authority of a token using multi signatures
/// </summary>
public class FreezeAuthorityExample : IExample
{
private static readonly IRpcClient rpcClient = ClientFactory.GetClient(Cluster.TestNet);
private const string MnemonicWords =
"route clerk disease box emerge airport loud waste attitude film army tray " +
"forward deal onion eight catalog surface unit card window walnut wealth medal";
@hoakbuilds
hoakbuilds / TransferWithDurableNonce.cs
Created July 21, 2021 00:34
Solana - GetAccountInfo, Decode NonceAccount to use Nonce instead of RecentBlockhash
public class TransactionBuilderTransferWithDurableNonceExample : IExample
{
private static readonly IRpcClient rpcClient = ClientFactory.GetClient(Cluster.TestNet);
private const string MnemonicWords =
"route clerk disease box emerge airport loud waste attitude film army tray " +
"forward deal onion eight catalog surface unit card window walnut wealth medal";
public void Run()
{
var wallet = new Wallet.Wallet(MnemonicWords);
Choose an example to run:
0)NameServiceProgramExamples
1)SolanaKeygenWallet
2)SolletKeyGeneration
3)SolletKeygenKeystore
4)TransactionBuilderExample
5)CreateInitializeAndMintToExample
6)TransferTokenExample
7)TransferTokenCheckedExample
8)CreateNonceAccountExample
@hoakbuilds
hoakbuilds / GetNonceFromNonceAccountData.cs
Last active July 20, 2021 17:10
Solana - GetNonceAccount
public class TransactionBuilderNonceExample : IExample
{
private static readonly IRpcClient rpcClient = ClientFactory.GetClient(Cluster.TestNet);
private static PublicKey NonceAccountKey = new ("3PwBSiCKoRRrA43W3MxqDgZcWz4StuhUUipFmXravAg1");
public void Run()
{
// Get the Nonce Account to get the Nonce to use for the transaction
RequestResult<ResponseValue<AccountInfo>> nonceAccountInfo = rpcClient.GetAccountInfo(NonceAccountKey);
@hoakbuilds
hoakbuilds / CreateNonceAccount.cs
Created July 20, 2021 16:44
Solana - Create Nonce Account using Solnet
public class CreateNonceAccountExample : IExample
{
private static readonly IRpcClient rpcClient = ClientFactory.GetClient(Cluster.TestNet);
private const string MnemonicWords =
"route clerk disease box emerge airport loud waste attitude film army tray " +
"forward deal onion eight catalog surface unit card window walnut wealth medal";
public void Run()
{
@hoakbuilds
hoakbuilds / ccxt_fetch_historical_dataset.py
Created November 7, 2020 18:54
ccxt fetch entire historical
import os
import sys
import time
import pandas as pd
from pandas import ExcelWriter
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
@hoakbuilds
hoakbuilds / 001-risk_manager.py
Created January 29, 2020 01:05
Python Script for Risk Management and Order Placement through Bitmex API
#If you enjoy using this script, I'd appreciate if you could use my
#Bitmex Referral here https://www.bitmex.com/register/x51NKV
#You save on fees and I get a little incentive to expand this tool further
#Thank you
#!/usr/bin/env python
# coding: utf-8
# In[ ]: