Skip to content

Instantly share code, notes, and snippets.


Santiago Palladino spalladino

View GitHub Profile
spalladino /
Created May 15, 2021
How to bypass BitGo's error when using a Ledger wallet

How to bypass BitGo's error when using a Ledger wallet

BitGo recently updated the version of its bitcoinjs-lib dependency, but failed to update the code that interacted with legacy wallets that relied on Ledger hardware wallets. This triggered a r.bufferutils.varIntSize is not a function error whenever trying to use the funds in the wallet. Following is a workaround you can use to manually patch the error, and get your funds out of BitGo.

Disclaimer: I set up this workaround to help a friend rescue their funds. I have no idea if it works for every instance of this error, and it may lead to loss of funds. I strongly suggest that you try it out with a small amount before you attempt to remove all your bitcoin from BitGo.

The problem

The problem seems to happen when interacting with a legacy wallet managed by a Ledger hardware wallet. You have a legacy wallet if BitGo displays the following notice when you open your wallet (fun fact: the link to the instructions to mi

spalladino / Loans.sol
Created Mar 20, 2021
Strawman for flashloans for flashbots
View Loans.sol
pragma solidity ^0.7.0;
// Each mining pool that intends to provide flash loans deploys a Loaner contract and transfers ETH to it
// When testing each bundle, the diff in balance in this contract is taking into account for calculating effective gas price
// The contract loans funds only on blocks mined by the miner and on zero-gasprice txs
contract Loaner {
address immutable owner;
constructor(address _owner) {
owner = _owner;
spalladino /
Last active Nov 3, 2021
Falsehoods that Ethereum programmers believe

Falsehoods that Ethereum programmers believe

I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.

About Gas

Calling estimateGas will return the gas required by my transaction

Calling estimateGas will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i

spalladino / deploy-function.js
Created Sep 27, 2020
Deploy a subset of AWS SAM functions bypassing CloudFormation for a faster development cycle
View deploy-function.js
#! /usr/bin/env node
const TEMPLATE_FILENAME = 'template.yaml';
const WEBPACK_CONFIG = './api/webpack.config.js';
const WEBPACK_CONTEXT = './api';
const STACKNAME = process.env.STACKNAME;
const { Lambda, CloudFormation } = require('aws-sdk');
const { yamlParse } = require('yaml-cfn');
const { readFileSync } = require('fs');
spalladino / revert.ts
Created Sep 11, 2020
Get the revert reason before sending an Ethereum transaction if the transaction would fail
View revert.ts
export async function tryGetRevertReason(to: string, from: string, data: string): Promise<string | undefined> {
const provider = ethers.getDefaultProvider();
const tx = { to, from, data };
try {
await provider.estimateGas(tx);
} catch {
const value = await;
return hexDataLength(value) % 32 === 4 && hexDataSlice(value, 0, 4) === '0x08c379a0'
? defaultAbiCoder.decode(['string'], hexDataSlice(value, 4))
: undefined;
spalladino /
Created Aug 25, 2020
Bash scripts for MFA sign in to AWS in the console
AWS_ACCOUNT_ID= # aws account
AWS_USER_PROFILE= # profile in aws/credentials to your access key
AWS_REGION= # default region
AWS_IAM_NAME= # your iam name in the aws account
ARN_OF_ROLE= # the role you want to assume
spalladino /
Created Jan 29, 2020
Guess solc settings used to compile a given contract
#!/usr/bin/env python3
import json
import subprocess
import sys
import re
VERSIONS = [f'0.5.{minor}' for minor in range(0,16)]
RUNS = [0, 100, 200, 300]
TARGETS = ['byzantium', 'constantinople', 'petersburg', 'istanbul']
spalladino /
Last active Nov 18, 2020
Manual script for setting up a GSNv1 relayer

Manual setup for a GSN relayer

⚠️ This setup is only good for GSNv1. Head over to for the latest setup for GSNv2.

Install nginx and certbot

sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install nginx software-properties-common certbot python-certbot-nginx
spalladino / AdminUpgradeabilityProxy.abi.json
Created May 20, 2019
ABI for ZeppelinOS AdminUpgradeabilityProxy as of zos-lib@2.3.0
View AdminUpgradeabilityProxy.abi.json
"constant": false,
"inputs": [
"name": "newImplementation",
"type": "address"
"name": "upgradeTo",
spalladino / RepoPackage.sol
Created Sep 25, 2018
Sample package 2.0 contract
View RepoPackage.sol
contract RepoPackage {
event NewVersion(uint256 versionId, uint16[3] semanticVersion);
struct Version {
uint16[3] semanticVersion;
address contractAddress;
bytes contentURI;
mapping (bytes32 => Version) versions;