Custom Blockchain Development Made Easy

GoGoPool
5 min readAug 8, 2023

--

Our goal is to make subnets easy. For cloud based development, we have GoGoPro (Coming Soon!). If you want to develop locally, we have GoGoTools. With GoGoTools, you can:

  • Make your “Time to RPC” 10x faster
  • Easily create many isolated environments to test different versions of binaries
  • Deploy and test your Smart Contracts entirely locally

Installation

You can download the latest binary from the GitHub Releases or you can build from source. Once you have the binary, move it to your PATH and rename it to ggt.

To properly use GoGoTools, you should have Foundry and jq installed as well. Foundry is a new Solidity toolchain written in Rust, and can be installed on Unix based systems with the following commands:

curl -L <https://foundry.paradigm.xyz> | bash
foundryup

You can install jq using your preferred package manager. For example:

brew install jq

or on Ubuntu and Debian

sudo apt update && sudo apt install jq -y

Once all that is done, you can start using GoGoTools!

Note for MacOS Users

When you download the binary, it may pop up an error warning you about executing the binary that’s not signed. Simply go to your security settings and allow GoGoTools, and it should work afterwards without issue.

Getting Started

Create a new directory called mysubnet

mkdir mysubnet
cd mysubnet

Now we can initialize a new subnet!

ggt utils init v1.10.1 v0.5.1
ggt node prepare MyNode --ava-bin=avalanchego-v1.10.1 --vm-name=subnetevm --vm-bin=subnet-evm-v0.5.1

This should have added some new files to your directory. We will go over what they do at a later date, for now just remember that they are needed for your subnet to work properly.

To start up your node, open a new terminal window in the same directory and run the following

ggt node run MyNode

Now that your node is running, we can create a new subnet on the node.

Creating a Subnet

Now we can initialize your subnet! To initialize, run the following commands in another terminal:

ggt wallet create-chain MyNode MyChain subnetevm

This will initialize and create a new wallet. To get the RPC URL of the new subnet as well as the local C Chain, we can run the following command:

ggt node info | jq -r '.rpcs'

You can use this RPC URL in Metamask, Hardhat, Truffle, or any other development tool just like any other Eth-based network. To properly use cast, which is Foundry’s tool for calling commands on chain, we need to add the environment variable ETH_RPC_URL to the current session. Execute the following:

export ETH_RPC_URL=`ggt node info | jq -r '.rpcs.MyChain'`

Now we can call cast directly:

cast chain-id

Or via ggt cast

ggt cast balances | jq

Multiple Nodes

Each node you create exists in its own directory. You can create many different nodes with different settings and configs as you experiment. You can start a particular node by saying

ggt node run <directoryname>

Precompiles

When we created our subnet, ggt created a directory called MyNode which contains all of the various configuration files, database files, and logs for avalanchego. If you want to play around with the built-in precompiles that SubnetEVM ships with, find the subnetevm-genesis.json file inside the MyNode/configs directory. Look for this section

"contractDeployerAllowListConfig": {
"adminAddresses": ["0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC"],
"enabledAddresses": null,
"blockTimestamp": 0
},

Now add an array of address to the enabledAddresses key, and lets restart our node with this genesis. To do this, run

ggt node reset MyNode

This will delete the data directory for the node, so its starts fresh. Then run

ggt node run MyNode
# In another terminal, run
ggt wallet create-chain MyNode MyChain subnetevm

This will start the node, and create a new subnetEVM blockchain with your new genesis, which should only allow specific addresses to deploy contracts.

NOTE: The addresses in the adminAddresses and enabledAddresses keys CANNOT overlap, you must have different addresses for each key.

More info about the SubnetEVM precompiles is here.

Cast

We also have some convenience features for using cast to interact with your EVM. Some examples are:

ggt cast balances | jq
ggt cast send-eth owner alice 1ether | jq
ggt cast send owner NativeMinter "mintNativeCoin(address,uint256)" alice 1ether | jq
ggt cast call owner TxAllowList "readAllowList(address)" bob
ggt cast send owner TxAllowList "setEnabled(address)" bob | jq
ggt cast call owner FeeConfigManager "getFeeConfigLastChangedAt()"
ggt cast call owner FeeConfigManager "getFeeConfig()" | xargs cast --abi-decode "getFeeConfig()(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)"

The names used (alice, bob) are defined in the accounts.json file that was created when you ran ggt utils init.

Explorer

To launch your browser to a blockchain explorer pointed at your running node, run

ggt node explorer MyChain

This will connect to the default node RPC (http://localhost:9650) and query the node info for the RPC for your custom blockchain you created, and then open an explorer pointed at that RPC.

Mnemonics

You can generate a BIP-39 mnemonic with

ggt utils mnemonic

To see all the keys and addresses for a mnemonic, run

ggt utils mnemonic-keys "test test test test test test test test test test test junk"

This will show the first 10 keys in both C-Chain (Ethereum) format as well as P-Chain (Avalanche) format

0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 m/44'/60'/0'/0/0
0x70997970C51812dc3A010C7d01b50e0d17dc79C8 59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d m/44'/60'/0'/0/1
0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC 5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a m/44'/60'/0'/0/2
0x90F79bf6EB2c4f870365E785982E1f101E93b906 7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 m/44'/60'/0'/0/3
0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a m/44'/60'/0'/0/4
0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc 8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba m/44'/60'/0'/0/5
0x976EA74026E726554dB657fA54763abd0C3a0aa9 92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e m/44'/60'/0'/0/6
0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 m/44'/60'/0'/0/7
0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f dbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 m/44'/60'/0'/0/8
0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 m/44'/60'/0'/0/9
P-avax1yljhuvjkmtu0y5ls6kf4exsdd8gea9mp8jd32r PrivateKey-Fapb8hTUMABpZc9zWurmPR7why34LQNshss5RZHgCAgiY5n83 m/44'/9000'/0'/0/0
P-avax18wvaf02nxrfpxhz5fwrj5yjydhhrlef6jslzqg PrivateKey-2DFyMtm5iENeShhPsXenSsQepoVwUMNbSG9DHRxsQEwSwM3e48 m/44'/9000'/0'/0/1
P-avax1kk4tuwm7ley05828x75p8pvdcw5j3wlveyr6rf PrivateKey-2B9ukB5wfRqS8vnJRWQohAEaZNQtV6NksrCb1B3wdozw2AKz9o m/44'/9000'/0'/0/2
P-avax1au4csswhjcjd3d9dzxj532puc4s6fm5twqrhmg PrivateKey-FaWRW4Fwpy8dgPq1WmshzmMVqD7Lg89pfPngMnY9aoi7cotbu m/44'/9000'/0'/0/3
P-avax1s8kxj6agyaf4qwdu9y37aklgq3c0kjnj69nhhg PrivateKey-2oo4uTtBJfU64mB2G8E1ggJGbcL1XTq1siaR2EY4KCJSkv7T8t m/44'/9000'/0'/0/4
P-avax12r4ys4ssmj56q0z36w080u4z8546apr3fxm6qc PrivateKey-R79TRuBkoJympQD33nsP3kdmBCr7QWLH7zUtgfhjc3uaA7icc m/44'/9000'/0'/0/5
P-avax1sdn9w8tsfets3lmfz23war6gqd270en38962rn PrivateKey-2mWtmQ2iQxEdGwjhbXH7jwETk2n7xDeZbGRNrM8pJyoosWfeV5 m/44'/9000'/0'/0/6
P-avax1hvdsp7z6z9dqwvasu2dk6xjf5u6kuyrst7vpjl PrivateKey-2fP2rzMCgN6LvKzKWnLYzeBtT41G47Cs5bC7FAWKJgwsrnZt3Z m/44'/9000'/0'/0/7
P-avax1935pmegr7aayegy8llaeznn9axap44evnh36lp PrivateKey-KyVd5iu1CJ32QrynkwhqFLBjeTyxWkkjN4zWgMoVvE8VyDi2V m/44'/9000'/0'/0/8
P-avax1yj4kunsv2z5dmwkmm56l65hwaer2s6g5gagppg PrivateKey-H6bSJB5xj2FbMuV9xoZRaKnTqEpbmRtUWBiTfD7FhNFiWLLza m/44'/9000'/0'/0/9

Conclusion

By leveraging GoGoTools, you can significantly increase your developer velocity while working on subnets. By leveraging GoGoTools, developers can significantly reduce their “Time to RPC,” create isolated testing environments, and deploy and test Smart Contracts locally. The intuitive installation and setup process makes it easier than ever to harness the power of GoGoTools for your projects. With seamless integration into existing development tools such as Metamask, Hardhat, and Truffle, GoGoTools is set to become an indispensable tool in the Avalanche Subnet and Solidity development ecosystem. Don’t miss out on this powerful suite that streamlines your subnet management and optimizes your workflow. Try GoGoTools today and experience the difference for yourself!

--

--

GoGoPool
GoGoPool

Written by GoGoPool

Decentralized staking protocol building for Avalanche Subnets.

Responses (1)