Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
yuyasugano / techflare_query_btc_h_filter.sh
Created Jul 27, 2021
techflare external adapter example 2
View techflare_query_btc_h_filter.sh
$ curl -X GET -H "Content-Type: application/json" "https://3t9jjasu58.execute-api.ap-northeast-1.amazonaws.com/Stage/chainlink?n=btc&p=h" \
| jq '. | { name: .name, value: .sma."5"}'
{
"name": "bitcoin",
"value": 37379.58199999999
}
@yuyasugano
yuyasugano / techflare_query_btch.sh
Created Jul 27, 2021
techflare external adapter example
View techflare_query_btch.sh
$ curl -X GET -H "Content-Type: application/json" "https://3t9jjasu58.execute-api.ap-northeast-1.amazonaws.com/Stage/chainlink?n=btc&p=h" | jq .
{
"std": {
"9": 987.8966188715287,
"3": 598.4951346781628,
"5": 636.6109131330054,
"30": 2345.7798994815985,
"20": 2062.520469866928
},
"momentum": {
View flashbots_goerli.js
const ethers = require('ethers');
const { FlashbotsBundleProvider} = require('@flashbots/ethers-provider-bundle')
// Standard json rpc provider directly from ethers.js. For example you can use Infura, Alchemy, or your own node.
// This sample uses one of the default provider goerli
const provider = new ethers.getDefaultProvider("goerli");
// `authSigner` is an Ethereum private key that does NOT store funds and is NOT your bot's primary key.
// This is an identifying key for signing payloads to establish reputation and whitelisting
const authSigner = new ethers.Wallet(
@yuyasugano
yuyasugano / get_blockchains.sh
Last active May 13, 2021
get a list of blockchains in P-Chain
View get_blockchains.sh
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"platform.getBlockchains",
"params" :{}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P | jq '.result.blockchains[-1]'
@yuyasugano
yuyasugano / create_blockchain.sh
Created May 13, 2021
create a blockchain in Avalanche
View create_blockchain.sh
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.createBlockchain",
"params" : {
"subnetID": "2bFRwRRTmvn64z7LuDq4bzLqfjTtFan8GDiMqk6eok85JG8gvK",
"vmID":"avm",
"name":"New test AVM",
"genesisData": "11111WdAJwMmBJiYYaZJcCDmqdBhzAKSUNe2xDYhSEEXegyWznPNKkby24NtZK3U82cHgbqPTh1ALM9S8hpZhRo6uhnKNaxiggDHrtV6LBZktr9D3hhUGEWwViT7vp6iWvJVEkvVckf",
"username":"testuser_jp01",
"password":"<your user password>"
@yuyasugano
yuyasugano / build_genesis.sh
Last active May 13, 2021
build a genesis state in AVM
View build_genesis.sh
curl -X POST --data '{
"jsonrpc": "2.0",
"id" : 1,
"method" : "avm.buildGenesis",
"params" : {
"networkId": 16,
"genesisData": {
"asset1": {
"name": "testFixedCapAsset",
"symbol":"TFCA",
@yuyasugano
yuyasugano / add_validator_subnet.sh
Created May 13, 2021
add a validator into the created subnet
View add_validator_subnet.sh
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.addSubnetValidator",
"params": {
"nodeID":"NodeID-EggGmnQFaTffeRNG1Kzs9dXJzFGdxac3D",
"subnetID":"2bFRwRRTmvn64z7LuDq4bzLqfjTtFan8GDiMqk6eok85JG8gvK",
"startTime":'$(date --date="10 minutes" +%s)',
"endTime":'$(date --date="30 days" +%s)',
"weight":100,
"changeAddr": "P-fuji1s3056zrcm36y0pzx5d3g9p5quavvpxk2yhssvp",
@yuyasugano
yuyasugano / get_node_id.sh
Created May 13, 2021
get your node ID in Avalanche
View get_node_id.sh
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "info.getNodeID",
"params":{},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
{"jsonrpc":"2.0","result":{"nodeID":"NodeID-EggGmnQFaTffeRNG1Kzs9dXJzFGdxac3D"},"id":1}
@yuyasugano
yuyasugano / add_validator_primary.sh
Last active May 13, 2021
add a validator into the primary network
View add_validator_primary.sh
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.addValidator",
"params": {
"nodeID":"NodeID-EggGmnQFaTffeRNG1Kzs9dXJzFGdxac3D",
"startTime":'$(date --date="10 minutes" +%s)',
"endTime":'$(date --date="90 days" +%s)',
"stakeAmount":1000000000,
"rewardAddress":"P-fuji1s3056zrcm36y0pzx5d3g9p5quavvpxk2yhssvp",
"delegationFeeRate":10,
@yuyasugano
yuyasugano / create_subnet.sh
Created May 11, 2021
create a subnet in P-Chain Avalanche
View create_subnet.sh
$ curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.createSubnet",
"params": {
"controlKeys":[
"P-fuji1s3056zrcm36y0pzx5d3g9p5quavvpxk2yhssvp",
"P-fuji16ng9sc5vyy99twvza8fg3xdl0262ryfsmcxcwp"
],
"threshold":2,
"username":"testuser_jp01",