Last active
July 8, 2022 07:27
-
-
Save MattKetmo/d542d3d25745c0b6e1f27fc5401cfe9f to your computer and use it in GitHub Desktop.
Revisions
-
MattKetmo revised this gist
Jul 8, 2022 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ func main() { result := searchBlock(address, fromBlock, toBlock) if result < fromBlock || result > toBlock { fmt.Printf("error: result must be between %d and %d (actual: %d)\n", fromBlock, toBlock, result) os.Exit(1) } @@ -22,13 +22,13 @@ func main() { // Find the block where the balance of the given address changed. func searchBlock(address string, fromBlock, toBlock int) int { // TODO return 0 } // Return the balance of an address at a given block. // // Example with curl: // curl -XPOST -H "Content-Type: application/json" https://goerli.infura.io/v3/1958344898c54b909598f1d0b8457805 \ // -d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xbad1568bf8d55f5f808edec0cd7394ebd8d51d0e", "0x6a6ec1"],"id":1}' func getBalance(address string, blockId int) string { // TODO -
MattKetmo created this gist
Jul 8, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ package main import ( "fmt" "os" ) func main() { address := "0xbad1568bf8d55f5f808edec0cd7394ebd8d51d0e" fromBlock := 6974800 toBlock := 6974900 result := searchBlock(address, fromBlock, toBlock) if result < fromBlock || result > toBlock { fmt.Printf("error: result must be between %d and %d (actual: %d)", fromBlock, toBlock, result) os.Exit(1) } fmt.Printf("result = %d\n", result) } // Find the block where the balance of the given address changed. func searchBlock(address string, fromBlock, toBlock int) int { // TODO return toBlock } // Return the balance of an address at a given block. // // Example with curl: // curl -XPOST -H "Content-Type: application/json" https://goerli.infura.io/v3/xxxxxxxxxxxxxxxx \ // -d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xbad1568bf8d55f5f808edec0cd7394ebd8d51d0e", "0x6a6ec1"],"id":1}' func getBalance(address string, blockId int) string { // TODO return "0" }