Skip to content

Instantly share code, notes, and snippets.

View mikedotexe's full-sized avatar
🤙
hakuna matata

Mike Purvis mikedotexe

🤙
hakuna matata
View GitHub Profile
@mikedotexe
mikedotexe / dev tools console.nothing
Created October 24, 2024 05:33
messing around with SubtleCrypto
const newEd25519Key = await window.crypto.subtle.generateKey('Ed25519', true, ['sign', 'verify']);
const encoder = new TextEncoder();
const messageUtf8Bytes = encoder.encode("aloha honua");
const signature = await window.crypto.subtle.sign("Ed25519", newEd25519Key.privateKey, messageUtf8Bytes);
console.log('signature', signature);
const pkcs8PrivateKey = await window.crypto.subtle.exportKey('pkcs8', newEd25519Key.privateKey);
const pkcs8PrivKeyArr = new Uint8Array(pkcs8PrivateKey)
console.log('pkcs8PrivKeyArr', pkcs8PrivKeyArr);
@mikedotexe
mikedotexe / yarn.config.cjs
Created October 17, 2024 08:05
Yarn 4.5.0 constraint (`yarn set version berry` has to be run)
module.exports = {
async constraints({ Yarn }) {
// get the root-level package.json's version
// then update all the packages' versions
/* The line below returns something like
{
cwd: '.',
ident: '@meer-js/monorepo',
@mikedotexe
mikedotexe / get-mpc-signature-from-tx-hash.js
Created May 14, 2024 22:00
Get MPC signature pieces from a transaction hash, like one returned from MyNEARWallet as a URL param
// run with "node get-mpc-signature-from-tx-hash.js" or whatever name
const { connect, keyStores } = require('near-api-js')
const mockKeyStore = new keyStores.InMemoryKeyStore()
const nearConfig = {
keyStore: mockKeyStore,
networkId: 'testnet',
nodeUrl: 'https://archival-rpc.testnet.near.org',
}
@mikedotexe
mikedotexe / chain-siggy.js
Created March 13, 2024 01:06
Chain signatures (shell of BOS frontend)
const ProgressBar = VM.require("mike.near/widget/ProgressBar");
console.log('props', props);
const yoctoZeroes = "000000000000000000000000";
const [stakingAmount, setStakingAmount] = useState("6");
const [unstakingWithdrawlAmount, setUnstakingWithdrawlAmount] = useState("19");
const StakeUnstakeWithdraw = ({ validator, method, amount }) => {
const openAnotherModal = ({validator, method, amount}) => {
// Let's explicitly have these in a switch so no one tries any funny business with methods
switch (method) {
@mikedotexe
mikedotexe / croncat-task-osmosis-1.sh
Created June 26, 2023 17:19
Simple CronCat task via shell script
#!/bin/sh
SIMPLE_PAYROLL='{
"create_task": {
"task": {
"actions": [
{
"msg": {
"bank": {
"send": {
@mikedotexe
mikedotexe / switch-network-print-gas-flags.sh
Created June 20, 2023 17:43
Switching Cosmos networks and printing gas flags
function set_cosmos_cli_config {
# If you're using a pretty old shell, might remove "local"
local cmd="$1"
local chain_id="$2"
local node="$3"
local gas_prices="$4"
local echo_str="$5"
"$cmd" config chain-id "$chain_id"
"$cmd" config node "$node"
@mikedotexe
mikedotexe / scrypt.md
Created June 14, 2023 02:28 — forked from jaekwon/scrypt.md
The Scrypt of C฿J

This document is a personal document and does not represent the views of the company. This document is in draft form and I reserve to modify the contents of it.

The Scrypt of C฿J

  • ! The days after Christmas, for personal reasons, it became clear to me that I had been living most of my life within the confines of guilt masked as love. This is just the circumstance of my personal life, something that chose me by chance or by fate, but somehow I was always aware of.
  • ! When all the circumstances of my life and work came together under this new perspective, everything began to make sense. That I was too selfless to a fault (though some would say naive). And finally I could see why.
  • ! I don’t wish to speak more about it for respect of those involved, and to keep their honor; and besides, I accept the imperfections that I have, if I don’t celebrate them.
  • ! Until I settled in the Mission in San Francisco, I was always moving around, country to country, state to state. The only constant I knew w
@mikedotexe
mikedotexe / permissionless-communities.md
Last active February 12, 2023 18:23
Patience and boundaries in web3 community development

Motivation

In 2023, we're seeing new and promising general-purpose, permissionless smart contract platforms launching in the interchain. This document is meant to cover thoughts on community management, avoiding trolls and toxicity, maximizing cooperation, and underscoring the landscape to expect as a sovereign-but-permissionless chain.

Forest for the trees

To set the stage, let's briefly zoom out and talk about the advent of public, community computers that have arrived in our lifetime.

In my lifetime, I saw the birth of the internet, and the confusion that hit the masses in the early day. We didn't know what to do with this thing. It could be argued that we didn't see the concrete possibilities, not because it wasn't properly explain, but because the idea was so incredibly broad and far-reaching, that it evaded us for decades. While we were building Geocities pages for fun, we didn't anticipate that online maps would be a regular part of daily navigation. Or that online deliveries would supplant i

@mikedotexe
mikedotexe / to-do-deploy.md
Last active August 10, 2022 09:21
Getting the To-Do List contract deployed to a local `wasmd` blockchain

To-Do List locally

We're going to get a local wasmd blockchain going, so we'll install that according to these instructions (after cloning the repo): https://github.com/CosmWasm/wasmd#quick-start

It's not a bad idea to create a new account in Keplr for testnet. We can use that seed phrase to store the same private key on your file system, securly via the operating system. What I mean by that is Mac users will see this when trying to use an app that wants to access it.

After you create an account on Keplr, you can find the mnemonic here:

@mikedotexe
mikedotexe / token-standards-handoff.md
Last active October 5, 2021 16:37
Token standards handoff

The main things we need from token standards are minting and burning of fungible and non-fungible tokens, as well as events. We need to now determine if we SHOULD have standard function names for minting and burning, and if so, if they should be in a single standard or two. (For minting, for burning.)

Illia is proposing we do not have function names and instead only events:

Image of comment suggesting we should not have function-based names for minting and burning

(link to comment)

Wondering how this will work with NFT contracts "out there" that are using nft_mint that indexer and Wallet have worked around in order to show them as collectibles.