Skip to content

Instantly share code, notes, and snippets.

Created April 9, 2020 19:24
What would you like to do?
A node.js script to print details about the Celo blockchain that is connected at http://localhost:8545
// Run this script in a npm project with contractkit installed
const Kit = require('@celo/contractkit')
const CeloContract = Kit.CeloContract
const kit = Kit.newKit('http://localhost:8545')
async function wrapper(){
let accounts = await kit.web3.eth.getAccounts()
let balance = await kit.getTotalBalance(accounts[0])
const goldTokenAddress = await kit.registry.addressFor(CeloContract.GoldToken)
const stableTokenAddress = await kit.registry.addressFor(CeloContract.StableToken)
const registryAddress = await kit.registry.addressFor(CeloContract.Registry)
const validatorsAddress = await kit.registry.addressFor(CeloContract.Validators)
console.log("Accounts: ", accounts)
for (let [key, value] of Object.entries(balance)) {
console.log(`${key}: ${value.toString(10)}`);
console.log("Gold Token Address: ", goldTokenAddress)
console.log("Stable Token Address: ", stableTokenAddress)
console.log("Registry Address: ", registryAddress)
console.log("Validators Address: ", validatorsAddress)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment