Transactions syncing, inputs and outputs mocked up. Bcoin data for tx, inputs and outputs varies depending on the vanilla object vs the object.toJSON() method Bcoin attaches to its primitives. Will likely need to redress this as Bcoin changes but for now this is how we move forward.
This commit is contained in:
parent
ea7e7aae34
commit
7d5cade288
20
README.md
20
README.md
@ -14,4 +14,22 @@ Logging is current defaulting to debug during dev. Bitcore logging is preceded b
|
||||
|
||||
# Nginx
|
||||
|
||||
The API is configured to run on port 3000 by default. Use the standard Nginx reverse proxy to flip http to https and handle ssl certs.
|
||||
The API is configured to run on port 3000 by default. Use the standard Nginx reverse proxy to flip http to https and handle ssl certs.
|
||||
|
||||
# Priorities
|
||||
1. Required Insight-UI
|
||||
|
||||
/addr/:addrStr/?noTxList=1
|
||||
/block/:blockhash
|
||||
/blocks
|
||||
/block-index/:blockHeight
|
||||
/currency
|
||||
/version
|
||||
/status
|
||||
/sync
|
||||
/peer
|
||||
/tx/:txId
|
||||
/txs
|
||||
/txs
|
||||
|
||||
sockets
|
||||
|
||||
@ -57,34 +57,40 @@ function processBlock(entry, block, cb) {
|
||||
|
||||
function processTx(entry, txs) {
|
||||
txs.forEach((tx) => {
|
||||
const hash = util.revHex(tx.hash().toString('hex'));
|
||||
const txHash = util.revHex(tx.hash().toString('hex'));
|
||||
const blockHash = util.revHex(entry.hash);
|
||||
|
||||
const inputs = tx.inputs.map((input) => {
|
||||
console.log('input');
|
||||
console.log(input);
|
||||
console.log(input.toJSON());
|
||||
//console.log('input');
|
||||
//console.log(input);
|
||||
//console.log(input.toJSON());
|
||||
});
|
||||
|
||||
const outputs = tx.outputs.map((output) => {
|
||||
console.log('output');
|
||||
console.log(output);
|
||||
console.log(output.toJSON());
|
||||
//console.log('output');
|
||||
//console.log(output);
|
||||
//console.log(output.toJSON());
|
||||
});
|
||||
|
||||
const t = new TxModel({
|
||||
txid: hash,
|
||||
chain: config.bcoin.network,
|
||||
txid: txHash,
|
||||
version: 1,
|
||||
lockTime: tx.lockTime,
|
||||
vin: [],
|
||||
vout: [],
|
||||
blockHash: blockHash,
|
||||
blockHeight: entry.height,
|
||||
blockHash: '123',
|
||||
blockTime: 0,
|
||||
blockTimeNormalized: 0,
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
coinbase: false,
|
||||
fee: 0,
|
||||
inputsProcessed: false,
|
||||
confirmations: 0,
|
||||
time: entry.ts,
|
||||
blockTime: entry.ts,
|
||||
blockTimeNormalized: entry.ts,
|
||||
valueOut: tx.value,
|
||||
size: tx.size,
|
||||
valueIn: tx.value,
|
||||
fees: tx.fee,
|
||||
chain: config.bcoin.network,
|
||||
});
|
||||
console.log(hash);
|
||||
console.log(txHash);
|
||||
t.save((err) => {
|
||||
if (err) {
|
||||
console.log(err.message);
|
||||
|
||||
@ -19,18 +19,20 @@ const OutputSchema = new Schema({
|
||||
const TransactionSchema = new Schema({
|
||||
txid: String,
|
||||
version: Number,
|
||||
chain: String,
|
||||
blockHeight: Number,
|
||||
lockTime: Number,
|
||||
vin: [InputSchema],
|
||||
vout: [OutputSchema],
|
||||
blockHash: String,
|
||||
blockHeight: Number,
|
||||
confirmations: Number,
|
||||
time: Date,
|
||||
blockTime: Date,
|
||||
blockTimeNormalized: Date,
|
||||
inputs: [InputSchema],
|
||||
outputs: [OutputSchema],
|
||||
coinbase: Boolean,
|
||||
fee: Number,
|
||||
inputsProcessed: Boolean,
|
||||
lockTime: Number,
|
||||
wallets: { type: [Schema.Types.ObjectId] },
|
||||
valueOut: Number,
|
||||
size: Number,
|
||||
valueIn: Number,
|
||||
fees: Number,
|
||||
chain: String,
|
||||
});
|
||||
|
||||
TransactionSchema.index({ txid: 1 }, { unique: true });
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
{ hash: 'ed1be20876b90b857a4ddb32e72f334df997cf45f5a33b3578f0dda65abacd57',
|
||||
witnessHash: 'ed1be20876b90b857a4ddb32e72f334df997cf45f5a33b3578f0dda65abacd57',
|
||||
size: 404,
|
||||
virtualSize: 404,
|
||||
value: '7.49',
|
||||
{ hash: '0fa53ce8b5aa3eb9e46a9dde25c26df02f4b0cf11eb0920be2780a8c7b9a6e33',
|
||||
witnessHash: '0fa53ce8b5aa3eb9e46a9dde25c26df02f4b0cf11eb0920be2780a8c7b9a6e33',
|
||||
size: 135,
|
||||
virtualSize: 135,
|
||||
value: '50.0',
|
||||
fee: '0.0',
|
||||
rate: '0.0',
|
||||
minFee: '0.00000404',
|
||||
minFee: '0.00000135',
|
||||
height: -1,
|
||||
block: null,
|
||||
ts: 0,
|
||||
@ -14,27 +14,45 @@
|
||||
version: 1,
|
||||
flag: 1,
|
||||
inputs:
|
||||
[ { type: 'pubkeyhash',
|
||||
[ { type: 'coinbase',
|
||||
subtype: undefined,
|
||||
address: <Address: type=pubkeyhash version=-1 str=1C8gfoC9B77sea4buoYNwCBwFxpdCp9TCp>,
|
||||
script: <Script: 0x49 0x3046022100d850be1963dc544faf861827179572cc8989188d9a1e94b68a3ab5453c295432022100da2e198ebc13cee9b706b879e0fc57ebba3b69aba96ab4b5dec0db480c55a11401 0x41 0x046b49c0b7124c4a31dc2f497f9240a04d3898cbeabdc99afafbc9fded9426ce73c23e6a8b9b0a72351c16f86ef1a5750cc5ebddc1ec96e9a10ad9fbf5c46c0e00>,
|
||||
address: undefined,
|
||||
script: <Script: 0x04 0xffff001d 0x02 0xde00>,
|
||||
witness: <Witness: >,
|
||||
redeem: undefined,
|
||||
sequence: 4294967295,
|
||||
prevout: <Outpoint: 18b6eb72c8f7df40904b1d8a01f5dd0a1fb2dad7df67a2a7fa18c0a831f001e3/1>,
|
||||
coin: null },
|
||||
{ type: 'pubkeyhash',
|
||||
subtype: undefined,
|
||||
address: <Address: type=pubkeyhash version=-1 str=1C8gfoC9B77sea4buoYNwCBwFxpdCp9TCp>,
|
||||
script: <Script: 0x47 0x304402201b07884070a5af58dbb2239d68c15da533cb44f86691c117f32567c02caa94680220247bce95ecea9ba6a95d72a677fef3f06960a091dd0c52cb084df7adda5adb1a01 0x41 0x046b49c0b7124c4a31dc2f497f9240a04d3898cbeabdc99afafbc9fded9426ce73c23e6a8b9b0a72351c16f86ef1a5750cc5ebddc1ec96e9a10ad9fbf5c46c0e00>,
|
||||
witness: <Witness: >,
|
||||
redeem: undefined,
|
||||
sequence: 4294967295,
|
||||
prevout: <Outpoint: c1b63ca51404d07d2b850c333a20b78a5a25c9eb027c20e72eed6557a4ea367f/1>,
|
||||
prevout: <Outpoint: 0000000000000000000000000000000000000000000000000000000000000000/4294967295>,
|
||||
coin: null } ],
|
||||
outputs:
|
||||
[ { type: 'pubkeyhash',
|
||||
value: '7.49',
|
||||
script: <Script: OP_DUP OP_HASH160 0x14 0x711df121c2d1132e99df2986fc9086a79d928576 OP_EQUALVERIFY OP_CHECKSIG>,
|
||||
address: <Address: type=pubkeyhash version=-1 str=1BK7E5XRMmboPYnLGSbEUgAJFSGBaebLkN> } ],
|
||||
[ { type: 'pubkey',
|
||||
value: '50.0',
|
||||
script: <Script: 0x41 0x042200490195c16c77e0d5b28079e218ddf23c0cf23e770b5e1ad0589d03a803cc188a1c79601dd181a67dc121a2bf2c5b2313c89f2b2be758caca6c7ab56959ac OP_CHECKSIG>,
|
||||
address: <Address: type=pubkeyhash version=-1 str=15WLVXrj2owbChece54ibqqukk2PcA4TLt> } ],
|
||||
locktime: 0 }
|
||||
|
||||
toJSON():
|
||||
|
||||
{ hash: '0fa53ce8b5aa3eb9e46a9dde25c26df02f4b0cf11eb0920be2780a8c7b9a6e33',
|
||||
witnessHash: '0fa53ce8b5aa3eb9e46a9dde25c26df02f4b0cf11eb0920be2780a8c7b9a6e33',
|
||||
fee: undefined,
|
||||
rate: undefined,
|
||||
ps: 1501788263,
|
||||
height: undefined,
|
||||
block: undefined,
|
||||
ts: undefined,
|
||||
date: undefined,
|
||||
index: undefined,
|
||||
version: 1,
|
||||
flag: 1,
|
||||
inputs:
|
||||
[ { prevout: [Object],
|
||||
script: '04ffff001d02de00',
|
||||
witness: '00',
|
||||
sequence: 4294967295,
|
||||
address: undefined,
|
||||
coin: undefined } ],
|
||||
outputs:
|
||||
[ { value: 5000000000,
|
||||
script: '41042200490195c16c77e0d5b28079e218ddf23c0cf23e770b5e1ad0589d03a803cc188a1c79601dd181a67dc121a2bf2c5b2313c89f2b2be758caca6c7ab56959acac',
|
||||
address: '15WLVXrj2owbChece54ibqqukk2PcA4TLt' } ],
|
||||
locktime: 0 }
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
{
|
||||
"txid": "b2da7a4efeee11d74be9e1cae735861b29db3268356fdc103d456c63ee680ce7",
|
||||
"version": 1,
|
||||
"locktime": 0,
|
||||
"vin": [
|
||||
{
|
||||
"txid": "4f54901d6bdb6b319cc71e0c9fd2bbd2438dbb3012e2e3ed58b806ccbdaaf17f",
|
||||
"vout": 0,
|
||||
"sequence": 4294967295,
|
||||
"n": 0,
|
||||
"scriptSig": {
|
||||
"hex": "4730440220524768cb6ace93625e3247ba05908e4ecd175a82397ac9831ca772e9a1a82e880220638df1b591bee299e539018d0e72bc3fd26ebee0e31a68de48454ca414aef2e10141047f1dbd4f3ef4f5435511d337120821cf9d3a3a72f8e8065dc86cf92941f1c480f59e670ebc83f09935cbd103e9c2ab8e0c061b24a8f1cd30f31a2d4e067ece2d",
|
||||
"asm": "30440220524768cb6ace93625e3247ba05908e4ecd175a82397ac9831ca772e9a1a82e880220638df1b591bee299e539018d0e72bc3fd26ebee0e31a68de48454ca414aef2e1[ALL] 047f1dbd4f3ef4f5435511d337120821cf9d3a3a72f8e8065dc86cf92941f1c480f59e670ebc83f09935cbd103e9c2ab8e0c061b24a8f1cd30f31a2d4e067ece2d"
|
||||
},
|
||||
"addr": "15VSWTF7qRzBhQzo45ATu6jMc3CuBCd4XN",
|
||||
"valueSat": 14263520000,
|
||||
"value": 142.6352,
|
||||
"doubleSpentTxID": null
|
||||
}
|
||||
],
|
||||
"vout": [
|
||||
{
|
||||
"value": "142.02520000",
|
||||
"n": 0,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a914ad62df6af0462dc5ca2007013c3c4dca1fcfb72388ac",
|
||||
"asm": "OP_DUP OP_HASH160 ad62df6af0462dc5ca2007013c3c4dca1fcfb723 OP_EQUALVERIFY OP_CHECKSIG",
|
||||
"addresses": [
|
||||
"1GonLz5Q87PS6PRYMc1SF8Kmgsz8XQbPSM"
|
||||
],
|
||||
"type": "pubkeyhash"
|
||||
},
|
||||
"spentTxId": "25079d76d0bb1a38489a738967e9e48d52c58a698810d4d9e8c1a0b2b2b0b3d5",
|
||||
"spentIndex": 0,
|
||||
"spentHeight": 132000
|
||||
},
|
||||
{
|
||||
"value": "0.61000000",
|
||||
"n": 1,
|
||||
"scriptPubKey": {
|
||||
"hex": "76a914096c81f7272f89900e1621e46d4f38202885b31e88ac",
|
||||
"asm": "OP_DUP OP_HASH160 096c81f7272f89900e1621e46d4f38202885b31e OP_EQUALVERIFY OP_CHECKSIG",
|
||||
"addresses": [
|
||||
"1rq4yP5EgxmduuhwcoR4x36Qw6NS4NM78"
|
||||
],
|
||||
"type": "pubkeyhash"
|
||||
},
|
||||
"spentTxId": "d75f552d9e00d3325cc8db2534734c8bc83f617d46deded4772eeec9d2210055",
|
||||
"spentIndex": 11,
|
||||
"spentHeight": 134969
|
||||
}
|
||||
],
|
||||
"blockhash": "000000000000060c631d74547fe0ab596b54440403ce86bba8bf3a405fdf4984",
|
||||
"blockheight": 131997,
|
||||
"confirmations": 346893,
|
||||
"time": 1308551232,
|
||||
"blocktime": 1308551232,
|
||||
"valueOut": 142.6352,
|
||||
"size": 257,
|
||||
"valueIn": 142.6352,
|
||||
"fees": 0
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user