Braydon Fuller
a50fccef4d
Changes behavior of `toJSON` to work as expected with `JSON.stringify`
- see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior
- Updates CONTRIBUTING with changes to Stardard Methods
- Aliases toJSON for toObject
- Removes all `fromJSON` methods, and many cases replaces with `fromObject`
- Constructors expect an object parsed via `JSON.parse` for JSON input
10 years ago
Braydon Fuller
8ff26bb260
Fixes for various formatting issues and typos.
10 years ago
Braydon Fuller
b5ada707bd
Benchmarks for block serialization & 4x performance improvement.
10 years ago
Chris Arnesen
ec2d726e49
typo "formated"
10 years ago
Kirill Fomichev
346b2af446
delete writable for accessor property
10 years ago
Manuel Araoz
dfc075e5d1
fix block parsing problem
10 years ago
Manuel Araoz
270413a655
add simpler test that fails
10 years ago
Manuel Araoz
722eddb894
add test that exposes bug
10 years ago
Manuel Araoz
9a50958943
fix Block#toObject API
10 years ago
eordano
fcc9081ddd
Fix JSDocs from String to string
10 years ago
William Wolf
4b601c3711
Move block.js and blockheader.js into lib/block/
10 years ago
Manuel Araoz
b9be679e09
add some checks
10 years ago
Braydon Fuller
59a6c926d7
Returned jsdoc for info.header, and removed nolonger used opts argument
10 years ago
Braydon Fuller
6aa0d14bb9
Removed magicnumber and size as properties of a block.
10 years ago
Braydon Fuller
116ddac345
If skipMagic is enabled do not set the magic or size on the block, the values would have been incorrect.
10 years ago
Braydon Fuller
38b8c211f3
Fix jshint complaints.
10 years ago
Esteban Ordano
b416655222
block serialization: Add option skip magic numbers
10 years ago
Esteban Ordano
2a084e641c
Coverage for block and blockheader
* JSDocs where already good, written by @braydonf
10 years ago
Manuel Araoz
84deec297a
add tx_invalid tests
10 years ago
Braydon Fuller
d86e718743
Block: Updated documentation, and changed to use consistent naming.
10 years ago
Esteban Ordano
d4b8c4adc6
Remove globals
10 years ago
Esteban Ordano
4433bd422b
Refactor gulpfile
10 years ago
Esteban Ordano
63f1d307fa
Reviewing docs
10 years ago
Braydon Fuller
f43c2f9aa3
Fixed bug, toObject should use other object's toObject
10 years ago
Braydon Fuller
19a17017a9
Block: Added toObject method and changed toJSON to return a string
10 years ago
Braydon Fuller
162438d111
Block: Change utility naming
10 years ago
Braydon Fuller
3276236cce
Consistent names for utilities
10 years ago
Braydon Fuller
94cc10b1a3
Changed *Json to *JSON and returned an object so that methods can be called from other toJSON methods without the double-stringification issue.
10 years ago
Braydon Fuller
1858766627
Standardized toJSON, fromJSON, toString and fromString interfaces
10 years ago
Esteban Ordano
1579eed9af
Consistency with "id", "hash", and "_getHash"
10 years ago
Esteban Ordano
5c974a8ef2
Refactor transaction to match new API
* Refactor transaction into a different subfolder
* Added a lot of tests for sighash and transaction serialization (from
reddit's and Ryan X. Charles' `fullnode`)
* Drop "only" from sighash tests and consolidate logs
10 years ago
Braydon Fuller
5d1da9802c
Block: Added validation of proof of work, merkle tree and other interface changes. Closes #601
10 years ago
Manuel Araoz
4508fb6765
fix references to encoding
10 years ago
Manuel Araoz
ca9b8d8f7b
use strict to protocol
10 years ago
Ryan X. Charles
e984736736
allow bufs in constructors
For Transaction, Block and Blockheader. This is a convenience so if you happen
to have the buffer for one of these, you can make a new one like this:
Transaction(txbuf);
Rather than having to do this:
Transaction().fromBuffer(txbuf);
10 years ago
Ryan X. Charles
cc3196085f
add .hash() function for a block
This is the plain old hash, which is a double sha256. The id of a block is the
reverse of this.
10 years ago
Ryan X. Charles
40d17c5180
block id
The block id is the reverse of the double sha256 hash of the blockheader.
10 years ago
Ryan X. Charles
e11019a083
toJSON, fromJSON
Every object should have toJSON and fromJSON methods so you can have a reliable
way to store and retrieve objects.
10 years ago
Ryan X. Charles
6494ca5076
convenience: varint -> vi
10 years ago
Ryan X. Charles
8a52e6c316
Block
10 years ago