Skip to content

Instantly share code, notes, and snippets.

View tonymorony's full-sized avatar

Anton "TonyL" Lysakov tonymorony

View GitHub Profile
Python bitcoin RPC lib which worked for me from box and took ~30 seconds to read doc and install:
pip3 install python-bitcoinrpc
ipython3
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:56212"%("user3150903419", "passe8fe2d8aa38c4e6faca129c6f3a6261a605e72a76eff36f2a5897dc7a03c2878b9"))
get_info = rpc_connection.getinfo()
print(get_info)
{'version': 1001550, 'protocolversion': 170003, 'KMDversion': '0.2.1', 'notarized': 0, 'prevMoMheight': 0, 'notarizedhash': '0000000000000000000000000000000000000000000000000000000000000000', 'notarizedtxid': '0000000000000000000000000000000000000000000000000000000000000000', 'notarizedtxid_height': 'mempool', 'KMDnotarized_height': 0, 'notarized_confirms': 0, 'walletversion': 60000, 'balance': Decimal('687990008.41585000'), 'blocks': 15185, 'longestchain': 15185, 'timeoffset': 0, 'tiptime': 1539502959, 'connections': 4, 'proxy': '', 'difficulty': Decimal('31.78766511598413'), 'testnet': False, 'ke
@tonymorony
tonymorony / gist:fae7f3c6074808f7e849e791b0056221
Last active November 28, 2018 12:12
gateway creation process calls/hexes/txids
## From gateway OPERATOR node
./komodo-cli -ac_name=TONY1 tokencreate KMD 1 testing
{
"result": "success",
"hex": "010000000100ab0161028985d24b473d758ee9cbb944006c27b69eb6ec5b0625e7c72bdab400000000494830450221008914c99e55f8471d7985db10fead22d4abdd52670709da9c962e20a1dd77064c022022e1900ab245872eede0439e3acbd8e481304a9ba71039590ee4ca452a628fa801ffffffff0400e1f50500000000302ea22c802090bc95b90831a7837c7ef178f6fd47f26a933bcf8de56da4a2f62894ab6c73fc8103120c008203000401cc1027000000000000232102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702ace0707c48180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000326a30e36321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0034b4d440774657374696e6700000000"
}
./komodo-cli -ac_name=TONY1 sendrawtransaction 010000000100ab0161028985d24b473d758ee9cbb944006c27b69eb6ec5b0625e7c72bdab400000000494830450221008914c99e55f8471d7985db10fead22d4abdd52670709da9c962e20a1dd77064c022022e1900ab245872eede0439e3acbd8e4
Deps
-------------------
sudo yum install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python python-zmq zlib1g-dev wget libcurl4-gnutls-dev bsdmainutils automake curl
Installed partial packages which have similar name in CentOS reps ^^ (just copypasted from Ubuntu installation manual as step0 so most of the packages above will not be installed)
sudo yum groupinstall 'Development Tools'
Then run ^^ to install most of the deps
sudo yum install git pkgconfig automake autoconf ncurses-devel python wget gtest-devel gcc libtool patch lbzip2 curl-devel
more deps ^^
#!/bin/bash
# Dependencies for Komodo
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate vim software-properties-common curl libcurl4-gnutls-dev cmake clang libsodium-dev -y
# Daemon
mkdir ~/komodo
cd ~/komodo
mkdir src
Step 1
***
Started new singpleplayer game without playertxid argument of register.
First game txid: 12354a32af8f782735c1059767c72ce510e1d560dad56be29a3ef48c8c2474f1
Played a little and quit on lvl2
First game bailout txid: 5c062790ddb4bfd9efde13e85548c1d4696bf486ae7c1e0a5ba3755e4611eaa9
.70:
037defd3c07a5ab2ced41d73c0d53c87b18447b50d5b89097f08f2d4de3e6948e6
.122:
03a1bdf4419502e0159f2d5f9c0a175d4f65fbb8990b16393b8d82aa4b5890cb54
Token creation transaction broadcasted: 92aa3cca7ffec26a09d3b91896c63e4b10882bbdf2c9799ac09797f2242616f2
Oracle creation transaction broadcasted: 2c5948a24d1415efe3dc3f0a343f9f1e66f535274d5376a5ef68a82c49dd8167
Oracle registration transaction broadcasted: 434d4b6e801bc458e63be364a6db6726c6875ebc56116ca8e9d17f7e5e096fa9
Gateway bind transaction broadcasted: 9dfd9c2f0124d11e4b2a9428dce9b8e7f3707651dcef081a235eebbe4511f3fe
#!/usr/bin/env python3
"""
Node preparation for gateway binding:
1) Starting and syncing KMD
2) Starting gw testing assetchain with valid pubkey
3) Import privkey from assetchain to KMD chain
4) Save pubkey on assetchain, wallet address and IP as output in text file
5) Mine until balance >0, to have some coins for oracle subscribe, then stop mining
5) Register as oracle publisher and subscribe X times, wait until these transactions mined
@tonymorony
tonymorony / Dockerfile
Last active April 1, 2019 12:02
mm2 container build image
FROM ubuntu:18.04
RUN apt-get update
# installing build tools
RUN apt-get install -y build-essential wget
# installing cmake
RUN wget -qO- "https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
Wikipedia: Multisignature (often called multisig) is a form of technology used to add additional security for cryptocurrency transactions. Multisignature addresses require another user or users sign a transaction before it can be broadcast onto the block chain.
In this short guide will be demonstrated 2of2 multisignature wallet creation and usage. I'll use 2 nodes and Komodo assetchain. On KMD main chain steps will be same, just not use `-ac_name` param.
Step 1
At first lets get addresses on two nodes which we will combine the into single mutlisig address. Also we will need pubkey and privkey (wif) for each address:
# Node 1:
#!/usr/bin/env python3
import re
import os
import requests
import json
import platform
import configparser
import sys
def config(filename, section):