Skip to content

Instantly share code, notes, and snippets.

View alexbosworth's full-sized avatar

Alex Bosworth alexbosworth

View GitHub Profile

VPC Setup

Setting up an instance for LND

Instance Type

  • EC2: T3 small or better

OS

Keybase proof

I hereby claim:

  • I am alexbosworth on github.
  • I am alexbosworth (https://keybase.io/alexbosworth) on keybase.
  • I have a public key ASA2q8y1jJV6cvp5wmqxysoo6iUsWpoH-dUNPtkllWTWiAo

To claim this, I am signing this object:

@alexbosworth
alexbosworth / timestamp-proof.js
Created May 19, 2018 14:00
Using "javascript-opentimestamps": "0.4.0"
const OpenTimestamps = require('javascript-opentimestamps');
/** Timestamp text
{
text: <Text String>
}
@returns via cbk
{
/** Transaction input
*/
struct TransactionInput {
/** Final sequence number marking the input as final
*/
static let finalSequence = UInt32.max
/** Spending output
*/
let outpoint: Outpoint
import Foundation
/** Outpoint
*/
struct Outpoint {
/** Index
*/
let index: UInt32
/** Number of bytes for the outpoint index
import Foundation
/** Can be included after this time marker
*/
enum Locktime {
case date(Date)
case height(Int)
/** Number of bytes
*/
/** Compact Size UInt
*/
enum CompactSizeUInt {
case uint8(UInt8), uint16(UInt16), uint32(UInt32), uint64(UInt64)
// MARK: - Init
/** Create from hex string
*/
init(from hex: String) throws {
/** Compact size uint marker byte
*/
enum CompactSizeMarker: Byte {
case uint8, uint16 = 253, uint32, uint64
/** Byte length of discriminant
*/
static let discriminantByteLength = 1
/** Hex byte length
/** Extensions to Data
*/
extension Data {
/** Create data from hex string
*/
init(hex: String) throws {
var bytes = Array<Byte>(repeating: Byte(), count: (hex.unicodeScalars.count + 1) >> 1)
try hex.unicodeScalars.enumerated().forEach { index, scalar in
var nibble = try scalar.hexNibble()
/** Extensions to UnicodeScalar
*/
extension UnicodeScalar {
/** Unicode scalar errors
*/
enum UnicodeScalarError: String, Error {
case illegalHexValue
}
/** Get the byte value of a hex nibble