Skip to content

Add support for Obsidian Coin #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions electrumx/lib/coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2442,3 +2442,28 @@ def header_hash(cls, header):
'''Given a header return the hash.'''
import x13_hash
return x13_hash.getPoWHash(header)

# source: https://github.com/obsidianplatform
class Obsidian(Coin):
NAME = "Obsidian"
SHORTNAME = "ODN"
NET = "mainnet"
XPUB_VERBYTES = bytes.fromhex("0488c21e")
XPRV_VERBYTES = bytes.fromhex("0488b2dd")
P2PKH_VERBYTE = bytes.fromhex("4b")
P2SH_VERBYTES = [bytes.fromhex("7d")]
WIF_BYTE = bytes.fromhex("cb")
GENESIS_HASH = ('0000006dd8a92f58e952fa61c9402b74'
'a381a69d1930fb5cc12c73273fab5f0a')
RPC_PORT = 56661
TX_COUNT = 1067887
TX_PER_BLOCK = 2
TX_COUNT_HEIGHT = 500000
DAEMON = daemon.LegacyRPCDaemon

@classmethod
def header_hash(cls, header):
'''Given a header return the hash.'''
from hashlib import sha512
return sha512(header).digest()[:32]

14 changes: 14 additions & 0 deletions tests/blocks/obsidian_mainnet_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"hash": "1dc7864236293c4243981e4b530796fde0438bf8f659b3fb00b047c6da1dad28",
"size": 176,
"height": 1,
"merkleroot": "aa5f626959c5b35d9b104d273756cdf37e2a8e696cd765dc6ec671dce1707951",
"tx": [
"aa5f626959c5b35d9b104d273756cdf37e2a8e696cd765dc6ec671dce1707951"
],
"time": 1503607998,
"nonce": 0,
"bits": "1e00ffff",
"previousblockhash": "0000006dd8a92f58e952fa61c9402b74a381a69d1930fb5cc12c73273fab5f0a",
"block": "070000000a5fab3f27732cc15cfb30199da681a3742b40c961fa52e9582fa9d86d000000517970e1dc71c66edc65d76c698e2a7ef3cd5637274d109b5db3c55969625faabe3c9f59ffff001e000000000101000000be3c9f59010000000000000000000000000000000000000000000000000000000000000000ffffffff055103e80a06ffffffff010084d717000000001976a914fa21f890dbdffdff1b2637cf21758a4e9815b24988ac0000000000"
}
15 changes: 15 additions & 0 deletions tests/blocks/obsidian_mainnet_100000.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"hash": "188278a41dabb40550075bba3e511273ccabb14520c61b5110ca3b77663136ab",
"size": 445,
"height": 100000,
"merkleroot": "3d8290a988dbe25730959689b0657845ca802b044d01999e7b8b4026273bb138",
"tx": [
"ed01c16f8a74bdd0a20f25e6f503d6324204bc7dc89c58023653c6276d2b1871",
"c964fc2c509f812f014f0c31d675fd4ba51f12afd36d08c001d5640727c1a414"
],
"time": 1510242048,
"nonce": 0,
"bits": "1a062c93",
"previousblockhash": "3044495db50a3c7d0414d1fdef6707d2fc257cdf5bea296cef833223f8521f2a",
"block": "070000002a1f52f8233283ef6c29ea5bdf7c25fcd20767effdd114047d3c0ab55d49443038b13b2726408b7b9e99014d042b80ca457865b08996953057e2db88a990823d0077045a932c061a0000000002010000000077045a010000000000000000000000000000000000000000000000000000000000000000ffffffff0403a08601ffffffff0100000000000000000000000000010000000077045a01ef0319f610b438aa2d0661f9d1c8d49319f522e4b78d9cebcda1780076e63e52020000004847304402205d2d3b9de7a6ce2848cd8de681ae21d43ba7a1881fb073f72419ff8685e6e4a002204ee336ec3d99da53b1c4352c93198879fa1c2e10f8e52fb6079deae5e1eb1d7b01ffffffff0300000000000000000000b8badf110000002321028129e93c653d5a9ae45932d0d67566df026e113c428c877aec7a28d3b818bc03ac00b8badf110000002321028129e93c653d5a9ae45932d0d67566df026e113c428c877aec7a28d3b818bc03ac00000000473045022100bec9c77219a4c46b815304e5f2b9cab6f7001a11ebfc829a4078878686624bfb02201e44aa306525c815ad4eaa2429d88b5b7a61cc57beca028a93de3b8d0a36cf90"
}