Skip to content

Instantly share code, notes, and snippets.

View saltyskip's full-sized avatar
🤠
Decentralizing

Andrei Terentiev saltyskip

🤠
Decentralizing
View GitHub Profile
EXPLAIN (SELECT * FROM ((
SELECT id, status, 'purchase' AS type,
user_id, NULL AS to_user_id, amount,
bonus_amount, NULL AS fee, payment_id,
type AS sub_type,
finalized_at, created_at
FROM purchase WHERE 1 AND created_at < FROM_UNIXTIME(1)) UNION (
SELECT id, status, 'payment' AS type,
user_id, to_user_id, amount,
NULL AS bonus_amount, processing_fee AS FEE,
@saltyskip
saltyskip / genesis.json
Created September 9, 2017 10:24
Neo Genesis Block
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"hash": "0xd782db8a38b0eea0d7394e0f007c61c71798867578c77c387c08113903946cc9",
"size": 686,
"version": 0,
"previousblockhash": "0xd42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf",
"merkleroot": "0xd6ba8b0f381897a59396394e9ce266a3d1d0857b5e3827941c2d2cedc38ef918",
"time": 1476647382,
Participants (@apisit, @luis, @saltyskip)
NEP2 Support Done (neo-swift)
-> Implementation of (AES, scrypt, SHA256, Base58Check, PBKDF2 by @luis, kudos to him
NEP5 Support Needs Review (neo-swift)
More Stable Peer Management Done (neo-swift)
O3 Nodes Spun up Done (PR at https://github.com/CityOfZion/neo-mon/pull/4)
Successful Beta Run with O3 over 100 users participated, no reports of lost funds
O3 is now approved at live on app store at https://itunes.apple.com/us/app/id1292233893
Add dark theme https://github.com/CityOfZion/OzoneWalletIOS/pull/24
@saltyskip
saltyskip / sample_dnft.py
Created May 20, 2019 05:51
Sample of dnft contra t
"""NEO Non-Fungible Token Smart Contract Template
Authors: Joe Stewart, Jonathan Winter
Email: [email protected], [email protected]
Version: 2.0
Date: 15 March 2019
License: MIT
Based on NEP5 template by Tom Saunders
import 'package:english_words/english_words.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color color = Theme.of(context).primaryColor;
Widget buttonSection = Container(

Keybase proof

I hereby claim:

To claim this, I am signing this object:

class BcomBlockchainTransaction {
var wallet: BcomWallet
var chainAssetProtocol: ChainAssetProtocol
var amount: Decimal
var assetId: String
//bitcoin specific
var utxo: [UTXO]?
var satsPerByteFee: Int
class BcomBlockchainTransactionBuilder {
private var tx: BcomBlockchainTransaction
init(signingWallet: BcomWallet, chainAssetProtocol: ChainAssetProtocol, amount: Decimal, assetId: String) {
tx = BcomBlockchainTransaction(signingWallet: signingWallet, chainAssetProtocol: chainAssetProtocol, amount: amount, assetId: assetId)
}
//Chain Level Builder
func buildBitcoinCash(utxos: [UTXO], satsPerByteFee: Int) -> BitcoinCashBuilder {
tx.satsPerByteFee = satsPerByteFee
let txTrust = BcomBlockchainTransactionBuilder(signingWallet: pr.selectedWallet!.masterWallet!, chainAssetProtocol: .bch, amount: 0.00001547, assetId: "bch", destination: pr.toAddress!)
.buildBitcoinCash(utxos: utxos, satsPerByteFee: 1, changeAddress: pr.toAddress!) { baseResult in
baseResult.buildSlp() { slpResult in
slpResult
.withSLPUtxos()
.withSpentSLPUtxos()
}
.withSpentUtxos()
.withChangeUtxos()
}
@saltyskip
saltyskip / jpmnemonic.swift
Last active December 7, 2020 07:52
JP mnemonic tests
func testJPMnemonic1() throws {
let mnemonic = ["ふうとう", "いがく", "はんろん", "よそう", "たまご", "にちじょう", "かんけい", "いだい", "だんねつ", "くなん", "れいせい", "すきま"]
let wallet = BcomWallet(mnemonic: mnemonic, chain: .bitcoin)
let address = BlockchainAddressGenerator.shared.getDefaultBlockchainAddress(from: wallet, x: 0, y: 0, chain: BcomBlockchain.bitcoin)
XCTAssertEqual(address, "15wZ1znjcz48MDjSgzasvzJBiSyLn8cqZ4")
let xPub = wallet.getExtendedPubKey(for: .bitcoin)
XCTAssertEqual(xPub, "xpub6D9oYGG8TsHWBxYaGMQPyMq7o7xyv6kvqUozhzTGnHgA9gY4WYdPdQJt2WWCUBP3iYW8xs4pymVhJAhR7Mdi7qbTbP2in2FFV7kHcSJdXgv")
}