Skip to content

Instantly share code, notes, and snippets.

View itoonx's full-sized avatar
👻
Deep

Makkhawan Voraboot itoonx

👻
Deep
View GitHub Profile
import ecdsa
import ecdsa.der
import ecdsa.util
import hashlib
import os
import re
import struct
b58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
/** pruned version of CTransaction: only retains metadata and unspent transaction outputs
*
* Serialized format:
* - VARINT(nVersion)
* - VARINT(nCode)
* - unspentness bitvector, for vout[2] and further; least significant byte first
* - the non-spent CTxOuts (via CTxOutCompressor)
* - VARINT(nHeight)
*
* The nCode value consists of:
Job Hiring
——————————————
Front End Developer 
[ที่อยู่ เมือง รหัสไปรษณีย์]   [โทรศัพท์]   [ที่อยู่อีเมล] 
 
Responsibilities 
- Develop front end part by coordinating with Backend and Testing teams.  
- Develop web applications for cryptocurrency such as Bitcoin, Ethereum 

Qualifications  
You can use more utility function like ethescan.io, this is example if u want to access via blockchain.info
- Transaction
https://api.blockchain.info/eth/tx/0xbf3a7843ee33b1382389ea7cf433ff23ad0b09f47a1a9ca8190cf763ea6bc270
- Address
https://api.blockchain.info/eth/account/0x2F1659415Ff18dBa7734769aEAA60d961623dc0a/balance
- Multiple Address
https://api.blockchain.info/eth/account/0x2F1659415Ff18dBa7734769aEAA60d961623dc0a,0xBbeE3a75CFe673d5B4d292AD6FE6d0e27Aa3f28E/balance
# ------------------------------------
# Docker alias and function
# ------------------------------------
# Clear all container and images
alias dkc-clear='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker rmi $(docker images -q)'
# Stop and Remove all containers
alias dkc-all='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'
coinbase, scriptPubKey, scriptSig - they are all scripts. You can read in wiki about how to decode script https://en.bitcoin.it/wiki/Script.
Coinbase can contain any data, even invalid script. But typically, it contains valid scripts. Examples of decoding:
coinbase: 038abd07062f503253482f048725ee5208083865a409000000092f7374726174756d2f
03 - length opcode
8abd07 - data with length 03
06 - length opcode
2f503253482f - data with length 06
04 - length opcode
# Update & Upgrade the System
sudo apt-get update
sudo apt-get upgrade
# Install dependencies there might be more based on your system
# However below instructions are for the fresh Ubuntu install/server
# Please carefully watch the logs because if something could not be install
# You have to make sure it is installed properly by trying the command or that particular
# dependency again
tep-by-step description:
We start creating a new transaction which we hash and sign.
Add four-byte version field: 01000000
One-byte varint specifying the number of inputs: 01
32-byte hash of the transaction from which we want to redeem an output (reverse order): be66e10da854e7aea9338c1f91cd489768d1d6d7189f586d7a3613f2a24d5396
Four-byte field denoting the output index we want to redeem from the transaction with the above hash (counting from zero): 00000000
Now comes the scriptSig. For the purpose of signing the transaction, this is temporarily filled with the scriptPubKey of the output we want to redeem. First we write a one-byte varint which denotes the length of the scriptSig (0x19 = 25 bytes): 19
Then we write the actual scriptSig (which is the scriptPubKey of the output we want to redeem): 76 a9 14 dd6cce9f255a8cc17bda8ba0373df8e861cb866e 88 ac (look to the bottom line line on https://blockchain.info/tx/96534da2f213367a6d589f18d7d6d1689748cd911f8c33a9aee754a80de166be?show_adv=true )
01000000 ................................... Version
01 ......................................... Number of inputs
|
| 7b1eabe0209b1fe794124575ef807057
| c77ada2138ae4fa8d6c4de0398a14f3f ......... Outpoint TXID
| 00000000 ................................. Outpoint index number
|
| 49 ....................................... Bytes in sig. script: 73
| | 48 ..................................... Push 72 bytes as data
For mining software developers
Stratum protocol is based on JSON-RPC 2.0. In this chapter I expect that you're familiar with this protocol and you understand terms like "request", "response" and "notification". Please read JSON-RPC specification for more details.
For high level image of the Stratum protocol concept, please read Stratum protocol specification on Google docs. This document needs some care, but give you the basic examples how to connect to Stratum server.
Exception handling
Stratum defines simple exception handling. Example of rejected share looks like:
{"id": 10, "result": null, "error": (21, "Job not found", null)}