Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fc170c8

Browse files
authoredSep 3, 2023
Merge pull request #3 from code-architect/transaction_issue
created a coinbase transaction, added a new api for flask
2 parents 3079afb + 0b48442 commit fc170c8

File tree

13 files changed

+639
-61
lines changed

13 files changed

+639
-61
lines changed
 

‎Blockchain/Backend/API/Client_calls/BaseCurl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
abstract class BaseCurl
2+
class BaseCurl
33
{
44
public static function curlSkeletonIfDataSend($curlObj, $OpType, $data)
55
{
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
require_once 'Blockchain/Backend/API/Client_calls/BaseCurl.php';
3+
class PluginHelperAPI extends BaseCurl
4+
{
5+
public static $clientAddress = 'http://localhost:5000/';
6+
7+
public static function postRequestAPI($url, $postData)
8+
{
9+
$ch = curl_init();
10+
curl_setopt($ch, CURLOPT_URL, $url);
11+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
12+
curl_setopt($ch, CURLOPT_POST, 1);
13+
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
14+
$response = curl_exec($ch);
15+
if (curl_errno($ch)) {
16+
echo "cURL Error: " . curl_error($ch);
17+
die();
18+
}
19+
return $response;
20+
}
21+
22+
}

‎Blockchain/Backend/core/Blockchain.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require_once 'Blockchain/Backend/core/BlockHeader.php'; // Assuming the blockheader.php file path
44
require_once 'Blockchain/Backend/core/database/BaseDB.php'; // Assuming the blockheader.php file path
55
require_once 'Blockchain/Backend/util/util.php'; // Assuming the util.php file path
6+
require_once 'Blockchain/Backend/core/transactions/Coinbase.php';
67

78
$ZERO_HASH = str_repeat('0', 64);
89
$VERSION = 1;
@@ -32,12 +33,15 @@ private function GenesisBlock() {
3233

3334
public function addBlock($BlockHeight, $prevBlockHash) {
3435
$timestamp = time();
35-
$Transaction = "Code Architect sent {$BlockHeight} Bitcoins to Indranil";
36-
$merkleRoot = bin2hex(hash256($Transaction));
36+
$coinbaseInstance = new Coinbase($BlockHeight);
37+
$coinbaseTx = $coinbaseInstance->coinbaseTransaction();
38+
$merkleRoot = ' ';
3739
$bits = 'ffff001f';
3840
$blockheader = new BlockHeader($GLOBALS['VERSION'], $prevBlockHash, $merkleRoot, $timestamp, $bits);
3941
$blockheader->mine();
40-
$block = new Block($BlockHeight, 1, (array)$blockheader, 1, $Transaction);
42+
$block = new Block($BlockHeight, 1, (array)$blockheader, 1, $coinbaseTx);
43+
// print_r((array)$block);
44+
// die();
4145
$this->writeOnDisk((array)$block);
4246
}
4347

‎Blockchain/Backend/core/Script.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
class Script
3+
{
4+
public $cmds;
5+
6+
public function __construct($cmds = null)
7+
{
8+
if ($cmds === null) {
9+
$this->cmds = [];
10+
} else {
11+
$this->cmds = $cmds;
12+
}
13+
}
14+
15+
public static function p2pkhScript($h160)
16+
{
17+
// Takes a hash160 and returns the p2 public key hash ScriptPubKey
18+
$script = new Script([0x76, 0xA9, $h160, 0x88, 0xAC]);
19+
return $script;
20+
}
21+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?php
2+
require_once 'Blockchain/Backend/core/transactions/TxIn.php';
3+
require_once 'Blockchain/Backend/core/transactions/TxOut.php';
4+
require_once 'Blockchain/Backend/core/transactions/Tx.php';
5+
require_once 'Blockchain/Backend/core/Script.php';
6+
require_once 'Blockchain/Backend/util/util.php';
7+
require_once 'Blockchain/Backend/API/Client_calls/PluginHelperAPI.php';
8+
9+
const ZERO_HASH = "0000000000000000000000000000000000000000000000000000000000000000";
10+
const REWARD = 50;
11+
const PRIVATE_KEY = "56114968769095885066321288702375272595970830268400415922098497799492460020984";
12+
const MINER_ADDRESS = "1K3if2mFojLAWVtdD1eeYYKNVCwghpBvgb";
13+
14+
class Coinbase {
15+
public function __construct($blockHeight) {
16+
$this->blockHeightIntLittleEndian = intToLittleEndian($blockHeight, bytesNeeded($blockHeight));
17+
}
18+
19+
public function coinbaseTransaction() {
20+
$prevTx = hex2bin(ZERO_HASH);
21+
$prevIndex = 0xFFFFFFFF;
22+
23+
$txIns = [];
24+
$txIns[] = new TxIn($prevTx, $prevIndex);
25+
$txIns[0]->scriptSig->cmds[] = $this->blockHeightIntLittleEndian;
26+
27+
$txOuts = [];
28+
$targetAmount = REWARD * 100000000;
29+
$hexValue = $this->decodeBase58API(MINER_ADDRESS);
30+
$targetH160 = $hexValue;
31+
$targetScript = Script::p2pkhScript($targetH160);
32+
$txOuts[] = new TxOut($targetAmount, $targetScript);
33+
34+
return new Tx(1, $txIns, $txOuts, 0);
35+
}
36+
37+
public function decodeBase58API($value)
38+
{
39+
$address = PluginHelperAPI::$clientAddress;
40+
$url = $address."get_decode_base58";
41+
$ch = curl_init($url);
42+
$data = json_encode(array(
43+
"value" => $value
44+
));
45+
$val = PluginHelperAPI::curlSkeletonIfDataSend($ch, "POST", $data);
46+
$data = json_decode($val['data'], true);
47+
return $data['byte_data'];
48+
}
49+
50+
}
51+
52+
//$address = PluginHelperAPI::$clientAddress;
53+
//$url = $address."get_decode_base58";
54+
//$ch = curl_init($url);
55+
//$data = json_encode(array(
56+
// "value" => "1K3if2mFojLAWVtdD1eeYYKNVCwghpBvgb"
57+
//));
58+
//$val = PluginHelperAPI::curlSkeletonIfDataSend($ch, "POST", $data);
59+
//$data = json_decode($val['data'], true);
60+
//echo "\n\n";
61+
//print_r($data['byte_data']);
62+
//function decodeBase58API($value)
63+
//{
64+
// $address = PluginHelperAPI::$clientAddress;
65+
// $url = $address . "get_decode_base58";
66+
// $ch = curl_init($url);
67+
// $data = json_encode(array(
68+
// "value" => $value
69+
// ));
70+
// $val = PluginHelperAPI::curlSkeletonIfDataSend($ch, "POST", $data);
71+
// $data = json_decode($val['data'], true);
72+
// return $data['byte_data'];
73+
//}
74+
//
75+
//$data = decodeBase58API("1K3if2mFojLAWVtdD1eeYYKNVCwghpBvgb");
76+
//echo "\n\n";
77+
//print_r($data);
78+
//echo "\n\n";
79+
//
80+
//
81+
//$binaryData = hex2bin($data);
82+
//print_r($binaryData);
83+
//echo "\n\n";
84+
//
85+
//// Perform operations on the binary data (if needed)
86+
//
87+
//// Convert the binary data back to a hexadecimal string
88+
//$resultHexadecimal = bin2hex($binaryData);
89+
//
90+
//// Output the result
91+
//echo $resultHexadecimal;
92+
93+
////$hexString = $data;
94+
////$byteString = 'b"' . implode('\x', str_split($hexString, 2)) . '"';
95+
//$byteString = hex2bin($data);
96+
//$formattedBinary = 'b"';
97+
//foreach (str_split($byteString) as $byte) {
98+
// $formattedBinary .= '\x' . bin2hex($byte);
99+
//}
100+
//$formattedBinary .= '",';
101+
//
102+
//echo $formattedBinary;
103+
//echo "\n\n";
104+
//
105+
//$hexString = '';
106+
//$matches = [];
107+
//if (preg_match('/b"(.+)",/', $formattedBinary, $matches)) {
108+
// $hexBytes = explode('\x', $matches[1]);
109+
// foreach ($hexBytes as $hexByte) {
110+
// $hexString .= chr(hexdec($hexByte));
111+
// }
112+
// $hexString = bin2hex($hexString);
113+
// echo $hexString;
114+
//} else {
115+
// echo "Invalid format.";
116+
//}
117+
//echo "\n\n";
118+
//
119+
//$hexString = '';
120+
//$matches = [];
121+
//
122+
//if (preg_match('/b"(.+)",/', $formattedBinary, $matches)) {
123+
// $hexBytes = explode('\x', $matches[1]);
124+
// foreach ($hexBytes as $hexByte) {
125+
// $hexString .= bin2hex(hex2bin($hexByte));
126+
// }
127+
// echo $hexString;
128+
//} else {
129+
// echo "Invalid format.";
130+
//}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
class Tx
4+
{
5+
public $locktime;
6+
public $txOuts;
7+
public $txIns;
8+
public $version;
9+
10+
public function __construct($version, $txIns, $txOuts, $locktime) {
11+
$this->version = $version;
12+
$this->txIns = $txIns;
13+
$this->txOuts = $txOuts;
14+
$this->locktime = $locktime;
15+
}
16+
17+
public function serialize() {
18+
$result = intToLittleEndian($this->version, 4);
19+
$result .= count($this->txIns);
20+
21+
// Add serialization logic here
22+
23+
return $result;
24+
}
25+
26+
public function isCoinbase() {
27+
if (count($this->txIns) !== 1) {
28+
return false;
29+
}
30+
31+
$firstInput = $this->txIns[0];
32+
if ($firstInput->prevTx !== hex2bin(ZERO_HASH)) {
33+
return false;
34+
}
35+
36+
if ($firstInput->prevIndex !== 0xFFFFFFFF) {
37+
return false;
38+
}
39+
40+
return true;
41+
}
42+
43+
public function toDict() {
44+
// Convert Transaction Input to dict
45+
foreach ($this->txIns as $txIndex => $txIn) {
46+
if ($this->isCoinbase()) {
47+
$txIn->scriptSig->cmds[0] = littleEndianToInt($txIn->scriptSig->cmds[0]);
48+
}
49+
50+
$txIn->prevTx = bin2hex($txIn->prevTx);
51+
52+
foreach ($txIn->scriptSig->cmds as $index => $cmd) {
53+
if (is_string($cmd)) {
54+
$txIn->scriptSig->cmds[$index] = bin2hex($cmd);
55+
}
56+
}
57+
58+
$txIn->scriptSig = (array) $txIn->scriptSig;
59+
$this->txIns[$txIndex] = (array) $txIn;
60+
}
61+
62+
// Convert Transaction Output to dict
63+
foreach ($this->txOuts as $index => $txOut) {
64+
$txOut->scriptPubkey->cmds[2] = bin2hex($txOut->scriptPubkey->cmds[2]);
65+
$txOut->scriptPubkey = (array) $txOut->scriptPubkey;
66+
$this->txOuts[$index] = (array) $txOut;
67+
}
68+
69+
return (array) $this;
70+
}
71+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
require_once 'Blockchain/Backend/core/Script.php';
3+
4+
class TxIn
5+
{
6+
public $prevTx;
7+
public $prevIndex;
8+
public $scriptSig;
9+
public $sequence;
10+
11+
public function __construct($prevTx, $prevIndex, $scriptSig = null, $sequence = 0xFFFFFFFF) {
12+
$this->prevTx = $prevTx;
13+
$this->prevIndex = $prevIndex;
14+
$this->scriptSig = $scriptSig ?? new Script();
15+
$this->sequence = $sequence;
16+
}
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
class TxOut
4+
{
5+
public $amount;
6+
public $scriptPubkey;
7+
8+
public function __construct($amount, $scriptPubkey) {
9+
$this->amount = $amount;
10+
$this->scriptPubkey = $scriptPubkey;
11+
}
12+
}

‎Blockchain/Backend/util/util.php

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,33 @@ function hash160($data) {
1010
return hash('ripemd160', $sha256Hash, true);
1111
}
1212

13-
// Example usage
14-
$input = 'some data to hash';
15-
$hashed256 = hash256($input);
16-
$hashed160 = hash160($input);
13+
function intToLittleEndian($number, $length)
14+
{
15+
// Use 'V' format for little-endian and unsigned long
16+
$value = pack('V', $number);
17+
return bin2hex($value);
18+
}
19+
20+
function bytesNeeded($n)
21+
{
22+
if ($n == 0) {
23+
return 1;
24+
}
25+
return intval(log($n, 256)) + 1;
26+
}
1727

18-
echo "Hashed 256: " . bin2hex($hashed256) . PHP_EOL;
19-
echo "Hashed 160: " . bin2hex($hashed160) . PHP_EOL;
28+
function littleEndianToInt($b)
29+
{
30+
// Reverse the byte array and convert it to an integer
31+
$reversedBytes = array_reverse(str_split($b));
32+
$littleEndian = implode('', $reversedBytes);
33+
return hexdec(bin2hex($littleEndian));
34+
}
35+
36+
// Example usage
37+
//$input = 'some data to hash';
38+
//$hashed256 = hash256($input);
39+
//$hashed160 = hash160($input);
40+
//
41+
//echo "Hashed 256: " . bin2hex($hashed256) . PHP_EOL;
42+
//echo "Hashed 160: " . bin2hex($hashed160) . PHP_EOL;

‎Blockchain/Python_Package/test.py renamed to ‎Blockchain/Python_Package/keyGenerate.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
from flask import Flask, jsonify
21
import secrets
32
from EllepticCurve.EllepticCurve import Sha256Point
43
from util import hash160, hash256
54

6-
app = Flask(__name__)
75

8-
9-
@app.route('/generate_keys', methods=['GET'])
10-
def generate_keys():
6+
def generatePrivateKeyPublicAddress():
117
Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
128
Gy = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
139

@@ -53,7 +49,3 @@ def generate_keys():
5349

5450
PublicAddress = prefix + result
5551
return {"privateKey": privateKey, "publicAddress": PublicAddress}
56-
57-
58-
if __name__ == '__main__':
59-
app.run(debug=True)

‎Blockchain/Python_Package/main.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from flask import Flask, jsonify, request
2+
from keyGenerate import generatePrivateKeyPublicAddress
3+
from util import bytes_needed, decode_base58, little_endian_to_int, int_to_little_endian
4+
import json
5+
import sys
6+
7+
8+
app = Flask(__name__)
9+
10+
11+
@app.route('/generate_keys', methods=['GET'])
12+
def generate_keys():
13+
result = generatePrivateKeyPublicAddress()
14+
return result
15+
16+
17+
# ======================================================================================================================
18+
19+
@app.route('/get_bytes_needed', methods=['POST'])
20+
def get_bytes_needed():
21+
data = request.get_json()
22+
if 'value' not in data:
23+
return jsonify({'error': 'Missing values'}), 400
24+
val = int(data['value'])
25+
result = bytes_needed(val)
26+
return jsonify({"result": result}), 201
27+
28+
29+
# ======================================================================================================================
30+
31+
@app.route('/get_decode_base58', methods=['POST'])
32+
def get_decode_base58():
33+
data = request.get_json()
34+
if 'value' not in data:
35+
return jsonify({'error': 'Missing values'}), 400
36+
byte_data = decode_base58(data['value'])
37+
hex_data = byte_data.hex()
38+
response = {
39+
'byte_data': hex_data
40+
}
41+
return jsonify(response)
42+
43+
44+
if __name__ == '__main__':
45+
app.run(debug=True)

‎Blockchain/Python_Package/util.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import hashlib
22
from Crypto.Hash import RIPEMD160
33
from hashlib import sha256
4+
from math import log
5+
from EllepticCurve.EllepticCurve import BASE58_ALPHABET
6+
47

58

69
def hash256(s):
@@ -9,4 +12,39 @@ def hash256(s):
912

1013

1114
def hash160(s):
12-
return RIPEMD160.new(sha256(s).digest()).digest()
15+
return RIPEMD160.new(sha256(s).digest()).digest()
16+
17+
18+
def bytes_needed(n: int):
19+
""" Returns byte length """
20+
if n == 0:
21+
return 1
22+
return int(log(n, 256)) + 1
23+
24+
25+
def int_to_little_endian(n: int, length):
26+
""" Takes integer and return the little endian byte of length """
27+
return n.to_bytes(length, 'little')
28+
29+
30+
def little_endian_to_int(b):
31+
""" takes bit AND RETURNS AN INTEGER """
32+
return int.from_bytes(b, 'little')
33+
34+
35+
def decode_base58(s):
36+
num = 0
37+
for c in s:
38+
num *= 58
39+
num += BASE58_ALPHABET.index(c)
40+
41+
combined = num.to_bytes(25, byteorder='big')
42+
checksum = combined[-4:]
43+
44+
if hash256(combined[:-4])[:4] != checksum:
45+
raise ValueError(f'Bad address {checksum} {hash256(combined[:-4])[:4]}')
46+
47+
value = combined[1:-4]
48+
return value
49+
50+
# b"\xc5\xf5\xdeS\x1f\xfb\xc9G\x16G\x81E\x9b\x06!\xda\xb5'\xee,"

‎Blockchain/data/blockchain

Lines changed: 244 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,104 +4,307 @@
44
"Blocksize": 1,
55
"BlockHeader": {
66
"bits": "ffff001f",
7-
"timestamp": 1692918870,
8-
"merkleRoot": "01d3c8ffac385f49854b12bc69248645efddb80a0435dd09631643bdc605d1d1",
7+
"timestamp": 1693700421,
8+
"merkleRoot": " ",
99
"prevBlockHash": "0000000000000000000000000000000000000000000000000000000000000000",
1010
"version": 1,
11-
"nonce": 57706,
12-
"blockHash": "0000d0f7be9722a4d33a1147995f54e00dd09304c3de35b86abf3c73d493f269"
11+
"nonce": 85333,
12+
"blockHash": "0000eb34365c3f89239ed92b31ec45c079f15f53d980464a15d0d474ddc25e22"
1313
},
1414
"TxCount": 1,
15-
"Txs": "Code Architect sent 0 Bitcoins to Indranil"
15+
"Txs": {
16+
"locktime": 0,
17+
"txOuts": [
18+
{
19+
"amount": 5000000000,
20+
"scriptPubkey": {
21+
"cmds": [
22+
118,
23+
169,
24+
"c5f5de531ffbc947164781459b0621dab527ee2c",
25+
136,
26+
172
27+
]
28+
}
29+
}
30+
],
31+
"txIns": [
32+
{
33+
"prevTx": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
34+
"prevIndex": 4294967295,
35+
"scriptSig": {
36+
"cmds": [
37+
"00000000"
38+
]
39+
},
40+
"sequence": 4294967295
41+
}
42+
],
43+
"version": 1
44+
}
1645
},
1746
{
1847
"Height": 1,
1948
"Blocksize": 1,
2049
"BlockHeader": {
2150
"bits": "ffff001f",
22-
"timestamp": 1692918885,
23-
"merkleRoot": "ede8645e1159205c35365fc6b765fbea7acab3d30d83f2094e87b1dc2829b69b",
24-
"prevBlockHash": "0000d0f7be9722a4d33a1147995f54e00dd09304c3de35b86abf3c73d493f269",
51+
"timestamp": 1693700445,
52+
"merkleRoot": " ",
53+
"prevBlockHash": "0000eb34365c3f89239ed92b31ec45c079f15f53d980464a15d0d474ddc25e22",
2554
"version": 1,
26-
"nonce": 30400,
27-
"blockHash": "0000145cbce04e57681a3492198f05ca5f68f730d2a49ced6f62a22e1e0fb89e"
55+
"nonce": 6742,
56+
"blockHash": "000045245bb909427902c6b9eb8ee3a6ddbf3bd9e143cfbba9905e34fed8721e"
2857
},
2958
"TxCount": 1,
30-
"Txs": "Code Architect sent 1 Bitcoins to Indranil"
59+
"Txs": {
60+
"locktime": 0,
61+
"txOuts": [
62+
{
63+
"amount": 5000000000,
64+
"scriptPubkey": {
65+
"cmds": [
66+
118,
67+
169,
68+
"c5f5de531ffbc947164781459b0621dab527ee2c",
69+
136,
70+
172
71+
]
72+
}
73+
}
74+
],
75+
"txIns": [
76+
{
77+
"prevTx": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
78+
"prevIndex": 4294967295,
79+
"scriptSig": {
80+
"cmds": [
81+
"01000000"
82+
]
83+
},
84+
"sequence": 4294967295
85+
}
86+
],
87+
"version": 1
88+
}
3189
},
3290
{
3391
"Height": 2,
3492
"Blocksize": 1,
3593
"BlockHeader": {
3694
"bits": "ffff001f",
37-
"timestamp": 1692918893,
38-
"merkleRoot": "ee3d44bff24ade0bd29fbf90bcfa1a8a2ef2c991a92bf92e8e8d7bf85cf75e30",
39-
"prevBlockHash": "0000145cbce04e57681a3492198f05ca5f68f730d2a49ced6f62a22e1e0fb89e",
95+
"timestamp": 1693700447,
96+
"merkleRoot": " ",
97+
"prevBlockHash": "000045245bb909427902c6b9eb8ee3a6ddbf3bd9e143cfbba9905e34fed8721e",
4098
"version": 1,
41-
"nonce": 57819,
42-
"blockHash": "0000b8ef9e602a62196ef75a05dc898ac1e599b4cfe69fd23fcef020ffe70e82"
99+
"nonce": 21123,
100+
"blockHash": "00008c920a4eb0fb40d93006e94f7c675e69b8186500341ded65bb23eb789baf"
43101
},
44102
"TxCount": 1,
45-
"Txs": "Code Architect sent 2 Bitcoins to Indranil"
103+
"Txs": {
104+
"locktime": 0,
105+
"txOuts": [
106+
{
107+
"amount": 5000000000,
108+
"scriptPubkey": {
109+
"cmds": [
110+
118,
111+
169,
112+
"c5f5de531ffbc947164781459b0621dab527ee2c",
113+
136,
114+
172
115+
]
116+
}
117+
}
118+
],
119+
"txIns": [
120+
{
121+
"prevTx": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
122+
"prevIndex": 4294967295,
123+
"scriptSig": {
124+
"cmds": [
125+
"02000000"
126+
]
127+
},
128+
"sequence": 4294967295
129+
}
130+
],
131+
"version": 1
132+
}
46133
},
47134
{
48135
"Height": 3,
49136
"Blocksize": 1,
50137
"BlockHeader": {
51138
"bits": "ffff001f",
52-
"timestamp": 1692918912,
53-
"merkleRoot": "d0249e654794fa76a823925895732057dc5c51075131f4784a65d31f93754113",
54-
"prevBlockHash": "0000b8ef9e602a62196ef75a05dc898ac1e599b4cfe69fd23fcef020ffe70e82",
139+
"timestamp": 1693700454,
140+
"merkleRoot": " ",
141+
"prevBlockHash": "00008c920a4eb0fb40d93006e94f7c675e69b8186500341ded65bb23eb789baf",
55142
"version": 1,
56-
"nonce": 91549,
57-
"blockHash": "000046cfcf21c1ef5ae5abdc09ee2f5d2a95dc4b19dea21e312b1ce3f8cc2718"
143+
"nonce": 69161,
144+
"blockHash": "0000bba05acf5a9f312a86f9e3eaf5da7ef1ff49437422c96c344c9cbf8042f9"
58145
},
59146
"TxCount": 1,
60-
"Txs": "Code Architect sent 3 Bitcoins to Indranil"
147+
"Txs": {
148+
"locktime": 0,
149+
"txOuts": [
150+
{
151+
"amount": 5000000000,
152+
"scriptPubkey": {
153+
"cmds": [
154+
118,
155+
169,
156+
"c5f5de531ffbc947164781459b0621dab527ee2c",
157+
136,
158+
172
159+
]
160+
}
161+
}
162+
],
163+
"txIns": [
164+
{
165+
"prevTx": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
166+
"prevIndex": 4294967295,
167+
"scriptSig": {
168+
"cmds": [
169+
"03000000"
170+
]
171+
},
172+
"sequence": 4294967295
173+
}
174+
],
175+
"version": 1
176+
}
61177
},
62178
{
63179
"Height": 4,
64180
"Blocksize": 1,
65181
"BlockHeader": {
66182
"bits": "ffff001f",
67-
"timestamp": 1692918942,
68-
"merkleRoot": "3bf90cb05ba2fb3325fec0def457cd7cc6126b204c8963d4939350b2add27c6d",
69-
"prevBlockHash": "000046cfcf21c1ef5ae5abdc09ee2f5d2a95dc4b19dea21e312b1ce3f8cc2718",
183+
"timestamp": 1693700478,
184+
"merkleRoot": " ",
185+
"prevBlockHash": "0000bba05acf5a9f312a86f9e3eaf5da7ef1ff49437422c96c344c9cbf8042f9",
70186
"version": 1,
71-
"nonce": 88482,
72-
"blockHash": "00008541d660a151dc1d3d4ca81c5dd844c0c37b07e643322192eace6b5e50b7"
187+
"nonce": 3234,
188+
"blockHash": "00003b292ea96d5d4e24437df34d6c84dbc51110a7a3c415dc7f7ee37ce997bf"
73189
},
74190
"TxCount": 1,
75-
"Txs": "Code Architect sent 4 Bitcoins to Indranil"
191+
"Txs": {
192+
"locktime": 0,
193+
"txOuts": [
194+
{
195+
"amount": 5000000000,
196+
"scriptPubkey": {
197+
"cmds": [
198+
118,
199+
169,
200+
"c5f5de531ffbc947164781459b0621dab527ee2c",
201+
136,
202+
172
203+
]
204+
}
205+
}
206+
],
207+
"txIns": [
208+
{
209+
"prevTx": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
210+
"prevIndex": 4294967295,
211+
"scriptSig": {
212+
"cmds": [
213+
"04000000"
214+
]
215+
},
216+
"sequence": 4294967295
217+
}
218+
],
219+
"version": 1
220+
}
76221
},
77222
{
78223
"Height": 5,
79224
"Blocksize": 1,
80225
"BlockHeader": {
81226
"bits": "ffff001f",
82-
"timestamp": 1692918975,
83-
"merkleRoot": "5957ff49fe734ffde6fb685fd313afff54a59671e98acab4f5c84fa8ded0b177",
84-
"prevBlockHash": "00008541d660a151dc1d3d4ca81c5dd844c0c37b07e643322192eace6b5e50b7",
227+
"timestamp": 1693700480,
228+
"merkleRoot": " ",
229+
"prevBlockHash": "00003b292ea96d5d4e24437df34d6c84dbc51110a7a3c415dc7f7ee37ce997bf",
85230
"version": 1,
86-
"nonce": 8339,
87-
"blockHash": "00005c7fd514f61cd3173a7cbd5fa54a0eb90b0ba28e9c442bc0a666fdb1dc71"
231+
"nonce": 5138,
232+
"blockHash": "000073e599f48019a1631952eb5879a4bc76aa570c1275a600303cac5f93a45e"
88233
},
89234
"TxCount": 1,
90-
"Txs": "Code Architect sent 5 Bitcoins to Indranil"
235+
"Txs": {
236+
"locktime": 0,
237+
"txOuts": [
238+
{
239+
"amount": 5000000000,
240+
"scriptPubkey": {
241+
"cmds": [
242+
118,
243+
169,
244+
"c5f5de531ffbc947164781459b0621dab527ee2c",
245+
136,
246+
172
247+
]
248+
}
249+
}
250+
],
251+
"txIns": [
252+
{
253+
"prevTx": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
254+
"prevIndex": 4294967295,
255+
"scriptSig": {
256+
"cmds": [
257+
"05000000"
258+
]
259+
},
260+
"sequence": 4294967295
261+
}
262+
],
263+
"version": 1
264+
}
91265
},
92266
{
93267
"Height": 6,
94268
"Blocksize": 1,
95269
"BlockHeader": {
96270
"bits": "ffff001f",
97-
"timestamp": 1692918978,
98-
"merkleRoot": "fc73585acb5dfb029ad461c0a2caa7259d33e3e9c613eec7ea9926a7fdceb92c",
99-
"prevBlockHash": "00005c7fd514f61cd3173a7cbd5fa54a0eb90b0ba28e9c442bc0a666fdb1dc71",
271+
"timestamp": 1693700482,
272+
"merkleRoot": " ",
273+
"prevBlockHash": "000073e599f48019a1631952eb5879a4bc76aa570c1275a600303cac5f93a45e",
100274
"version": 1,
101-
"nonce": 268283,
102-
"blockHash": "0000210da7a197c7734b55f27751ecfdc7bb3f881bf49f230d5866625fd3dd54"
275+
"nonce": 112657,
276+
"blockHash": "00008cc0036e7f27a36175191f569ff8b6136718e729e15e3d7d9acdd82e2d9a"
103277
},
104278
"TxCount": 1,
105-
"Txs": "Code Architect sent 6 Bitcoins to Indranil"
279+
"Txs": {
280+
"locktime": 0,
281+
"txOuts": [
282+
{
283+
"amount": 5000000000,
284+
"scriptPubkey": {
285+
"cmds": [
286+
118,
287+
169,
288+
"c5f5de531ffbc947164781459b0621dab527ee2c",
289+
136,
290+
172
291+
]
292+
}
293+
}
294+
],
295+
"txIns": [
296+
{
297+
"prevTx": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
298+
"prevIndex": 4294967295,
299+
"scriptSig": {
300+
"cmds": [
301+
"06000000"
302+
]
303+
},
304+
"sequence": 4294967295
305+
}
306+
],
307+
"version": 1
308+
}
106309
}
107310
]

0 commit comments

Comments
 (0)
Please sign in to comment.