Skip to content

Instantly share code, notes, and snippets.

View bgok's full-sized avatar

Ken Hodler bgok

View GitHub Profile
@bgok
bgok / mobile-coin-payment-request.ts
Created January 25, 2023 19:25
Create a Mobile Coin payment request from a public address.
import ProtoBuff from "protobufjs"
import BS58 from "bs58"
import crc32 from "crc/crc32"
function getChecksum(buffer: Buffer | Uint8Array): Buffer {
const crc = crc32(buffer).toString(16).padStart(8,'0')
return Buffer.from(crc, "hex").reverse()
}
export function parseB58(b58Message: string): Buffer {
@bgok
bgok / external.proto
Created January 18, 2023 07:41
Fiddling around with PaymentRequests on MobileCoin
// Copyright (c) 2018-2022 The MobileCoin Foundation
// MUST BE KEPT IN SYNC WITH RUST CODE!
syntax = "proto3";
package external;
option java_package = "com.mobilecoin.api";
option java_outer_classname = "MobileCoinAPI";
@bgok
bgok / console_output.txt
Last active October 4, 2022 23:04
Can't create a token from a smart contract using HTS
$ solcjs contracts/NFTCreator.sol -o build --optimize --bin && solcjs contracts/NFTCreator.sol -o build --abi
✨ Done in 3.00s.
$ node scripts/deploy-and-execute-nftcreator.js
Contract created with ID: 0.0.48512162
/Users/ken/Projects/hedera-hashies/node_modules/@hashgraph/sdk/lib/ReceiptStatusError.cjs:45
super(props, `receipt for transaction ${props.transactionId.toString()} contained error status ${props.status.toString()}`);
^
// Generate a random user name in the form <intensifier>-<descriptor>-<noun>.
// Examples:
// charming-metallic-kangaroo
// dashing-speckled-lizard
// captivating-chartreuse-penguin
const intensifier = [
'adorable',
'alluring',
'amazing',
Verifying my identity on Peepeth.com 0x28e22396c45ac478c70f3fdd438c56af2f8b50f9
@bgok
bgok / get_bin.py
Created May 22, 2018 22:34
Dump the base64 and fingerprint from a firmware file
#!/usr/bin/env python3
import sys
import hashlib
if sys.version_info < (3, 6):
import sha3
import base64
import requests
import glob
import json
@bgok
bgok / keybase.md
Last active January 31, 2019 02:46

Keybase proof

I hereby claim:

  • I am bgok on github.
  • I am bgok (https://keybase.io/bgok) on keybase.
  • I have a public key ASD1NNcNP_jhJ35GJJ0CrAu9g-VL0aNNUvCF6dPbMPOa6wo

To claim this, I am signing this object:

@bgok
bgok / gist:6b35cff6677ee15271c8
Created September 8, 2015 23:02
Example of signing a message with keepkey and verifying with bitcoinjs-lib
var message = require('bitcoinjs-lib').Message;
var sys = require('sys')
var exec = require('child_process').exec;
var child;
// executes `pwd`
child = exec("../python-keepkey/cmdkk.py sign_message -n 10 foo", function (error, stdout, stderr) {
stdout = stdout.replace(/\'/g, '"');
stdout = stdout.replace(/u\"/g, '"');