Expression | Default Visibility | Applicable Visibility |
---|---|---|
function | public | public / internal / private / external |
constructor | public | public / internal / private / external |
variable | internal | public / internal / private |
event | Not applicable | This is always public |
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 characters
const ethers = require('ethers') | |
const standardPath = "m/44'/60'/0'/0"; | |
const activeIndex = 0; | |
function generatePath(index) { | |
const path = `${standardPath}/${index}`; | |
return path; | |
} |
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 characters
contract ShiftBytes { | |
function replaceBytesAtIndex( | |
bytes32 original, | |
uint256 position, | |
bytes1 toInsert | |
) public pure returns (bytes32) { | |
bytes1 maskBytes = 0xff; | |
bytes32 mask = bytes32(maskBytes) >> ((position * 1) * 8); | |
return (~mask & original) | (bytes32(toInsert) >> ((position * 1) * 8)); | |
} |
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 characters
{ | |
"prettier.arrowParens": "always", | |
"prettier.bracketSpacing": true, | |
"prettier.configPath": "", | |
"prettier.disableLanguages": [], | |
"prettier.documentSelectors": [], | |
"prettier.embeddedLanguageFormatting": "auto", | |
"prettier.enable": true, | |
"prettier.enableDebugLogs": false, | |
"prettier.endOfLine": "lf", |
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 characters
const fs = require('fs'); | |
const { exec } = require("child_process"); | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
const contracts = { | |
"AddressManager": { | |
"address": "0x1De8CFD4C1A486200286073aE91DE6e8099519f1", | |
"params": [] | |
}, |
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 characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"os" | |
"strings" |
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 characters
package main | |
import ( | |
"log" | |
"fmt" | |
"encoding/json" | |
) | |
func main() { | |
b := []byte(`{"name": "tom", "favNum": 6, "interests": ["knives", "computers"], "usernames": {"github": "TomNomNom", "twitter": "@TomNomNom"}}`) |
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 characters
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
I couldn't find a good explanation of each step of signTypedData
EIP with examples of inputs and outputs at each step. I wanted this so I could keep track.
Say this is our private key
const privKey = new Buffer(
"c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3",
"hex"
);
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 characters
let fs = require("fs"); | |
let Web3 = require('web3'); // https://www.npmjs.com/package/web3 | |
// Create a web3 connection to a running geth node over JSON-RPC running at | |
// http://localhost:8545 | |
// For geth VPS server + SSH tunneling see | |
// https://gist.github.com/miohtama/ce612b35415e74268ff243af645048f4 | |
let web3 = new Web3(); | |
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); |
NewerOlder