diff --git a/.grep-exclude b/.grep-exclude new file mode 100644 index 00000000..960fe795 --- /dev/null +++ b/.grep-exclude @@ -0,0 +1,2 @@ +*.txt + diff --git a/Gruntfile.js b/Gruntfile.js index 715c647e..e83a5145 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -48,7 +48,7 @@ module.exports = function(grunt) { }, jshint: { all: { - src: ['Gruntfile.js', 'server.js', 'app/**/*.js', 'public/js/**'], + src: ['Gruntfile.js', 'server.js', 'app/**/*.js', 'public/js/**','lib/*.js'], options: { jshintrc: true } @@ -66,7 +66,7 @@ module.exports = function(grunt) { options: { file: 'server.js', args: [], - ignoredFiles: ['public/**', 'test/**','util/**','lib/**'], + ignoredFiles: ['public/**', 'test/**','util/**'], watchedExtensions: ['js'], // nodeArgs: ['--debug'], delayTime: 1, diff --git a/app/models/Transaction.js b/app/models/Transaction.js index d8971f7a..fbb3f35a 100644 --- a/app/models/Transaction.js +++ b/app/models/Transaction.js @@ -141,7 +141,7 @@ TransactionSchema.statics.explodeTransactionItems = function(txid, time, cb) { } }, function (err) { - if (err) console.log (err); + if (err && !err.message.match(/E11000/) ) console.log (err); async.forEachLimit(info.vout, CONCURRENCY, function(o, next_out) { /* diff --git a/backwards_sync b/backwards_sync new file mode 100644 index 00000000..ce028de4 --- /dev/null +++ b/backwards_sync @@ -0,0 +1,46 @@ + + +Hi all, + +Yesterday I've been thing about the sync and the installation process of mystery. + +I believe is a terrible use experience to have to wait 20+ hours to be explore the blockchain. I think this is not acceptable given that we are using a thin-object model. We should be able to provide basic exploration capatilities right away after the installation (given that the paired bitcoind server has the blockchain updated). + +Also, having to run a different process (sync.js) independently adds complexity to installation and mantainance process, and generates other problems like: what happens is the process gets interrupted? what should the user do if he stops the server (and the p2p sync) to some time and then restart it? Should he run sync.js again? What happends if bitcoind become unavailable for a while? + +So, inspired on that Ryan's say about node async nature and Manuel's work to integrate p2p to the node http server, I thought the following process, when the server starts: + +1)- Query bitcoind for the lastblock, if there is not sync task running, we trigger a backwards block synchronization, starting from the lastblock, backwards to the genesis block. + +2)- set up a interval function to run 1) every X seconds. + +3)- start listening p2p + +4)- start the serving http + => Stream to every page: + [ SYNC STATUS: xx%] + => In address detail pages: + [WARNING SYNC INCOMPLETE, BALANCEs ARE NOT SHOWN] + + +Advantages: + - Simplicity for installation & maintenance + - Handles bitcoind and mystery outages & recovering + - Opens a simple way to handle reorgs (the nextBlockHash needs to be stored on the Block model, so when the backward sync detects a incoherence in a block pointer, the old branch's transactions get flagged). + - The user will be probably more interested on recent blocks (which get processed first) than old blocks. + + +PS: Synchronization works (since yesterday) is as follow: + sync(blockHash) + - retrive blockHash from RPC + - Not found -> exit + + - check if we have the blockHash in mongo + - if no + -> Get transactions, parse transactions, insert transaction items in mongo + -> Insert transaction Ids in mongo + -> Insert Block Id in mongo + - sync( directionIsForward ? nextHash : prevHash) + - if yes + -> exit. + diff --git a/gitmagic b/gitmagic new file mode 100644 index 00000000..da59bca1 --- /dev/null +++ b/gitmagic @@ -0,0 +1,3 @@ +. +Can always rebase by hand: git branch -m foo foo.old ; git checkout -b foo master ; git checkout foo.old ; for commit in A B C do; git show $commit > /tmp/patch.$commit ; echo $commit >> /tmp/commits.lst ; done ; git checkout foo ; for commit in `cat /tmp/commits.lst` do; patch -sp1 < /tmp/patch.$commit ; git commit -a ; done + diff --git a/kk b/kk new file mode 100644 index 00000000..466df367 --- /dev/null +++ b/kk @@ -0,0 +1,488 @@ +Syncing Blocks, starting from: 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 end: null +in 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 +block null + Historic sync status: 1/168129 [0%] +in 00000000b873e79784647a6c82962c70d228557d24a747ea4d1b8bbe878e1206 +block null +in 000000006c02c8ea6e4ff69651f7fcde348fb9d557a06e6957b65552002a7820 +block null +in 000000008b896e272758da5297bcd98fdc6d97c9b765ecec401e286dc1fdbe10 +block null +in 000000008b5d0af9ffb1741e38b17b193bd12d7683401cecd2fd94f548b6e5dd +block null +in 00000000bc45ac875fbd34f43f7732789b6ec4e8b5974b4406664a75d43b21a1 +block null +in 000000006633685edce4fa4d8f12d001781c6849837d1632c4e2dd6ff2090a7b +block null +in 00000000e29e3aa65f3d12440eac9081844c464aeba7c6e6121dfc8ac0c02ba6 +block null +in 000000009cbaa1b39a336d3afa300a6d73fab6d81413b2f7965418932a14e2f9 +block null +in 0000000050ff3053ada24e6ad581fa0295297f20a2747d034997ffc899aa931e +block null +in 00000000700e92a916b46b8b91a14d1303d5d91ef0b09eecc3151fb958fd9a2e +block null +in 00000000adde5256150e514644c5ec4f81bda990faec90230a2c80a929cae027 +block null +in 000000004705938332863b772ff732d2d5ac8fe60ee824e37813569bda3a1f00 +block null +in 0000000092c69507e1628a6a91e4e69ea28fe378a1a6a636b9c3157e84c71b78 +block null +in 000000006408fcd00d8bb0428b9d2ad872333c317f346f8fee05b538a9913913 +block null +in 000000009425e151b8bab13f801282ef0f3dcefc55ec4b2e0355e513db4cd328 +block null +in 00000000c4cbd75af741f3a2b2ff72d9ed4d83a048462c1efe331be31ccf006b +block null +in 00000000fe198cce4c8abf9dca0fee1182cb130df966cc428ad2a230df8da743 +block null +in 000000008d55c3e978639f70af1d2bf1fe6f09cb3143e104405a599215c89a48 +block null +in 000000009b3bca4909f38313f2746120129cce4a699a1f552390955da470c5a9 +block null +in 00000000ede57f31cc598dc241d129ccb4d8168ef112afbdc870dc60a85f5dd3 +block null +in 000000001a29aff8154de6230a4909a3a971c52ae590006e00fddff33f9e3773 +block null +in 0000000042d3db6c529dd8f1b085367cb6d907b534f5b1a5dfdd3a34a3459886 +block null +in 00000000c262f9428bb84407780bb0bd008b74941d651111ab2500cf649fa45d +block null +in 0000000022bb34bc09f8d8d0ae26b86c87f8483e54b9c3addfe6f30b12bc656a +block null +in 00000000bd39c82427195244706aa36869f9e690bcbef62b28ef51ccf91ff2e3 +block null +in 00000000b3b42e09ae848b7a204aa89b9c0c55792e988d05a3816ab1f1af6de1 +block null +in 000000009c6d106c2f6097fd451389b6b48ae7558386604c415861c22dd2eb59 +block null +in 00000000093b2ef24808084f43ef04366519dc4705b0ceeb7fb202f282bedd15 +block null +in 000000002bbae8acb9161807b7d71f615f5be7a88d43e05d5df89276e39565a7 +block null +in 000000005f21810064bb55e4f7904e5e6d50b09b528170d8322ff353183174a7 +block null +in 000000003a34d15228219b756bb376ae6f9fe910f921021e9f6524694faaefd0 +block null +in 00000000a8c3af05dadff24b9798dd317191645f45bb46c99d4bedd84705604c +block null +in 00000000663742a962be4db62757e0464a83583c0f5abd74832ba35a3e5571f5 +block null +in 0000000037baeb6db425c25bd84b4009869a92793bab8237338ef68d213e27d8 +block null +in 00000000181cf8ccf929094b0b4ea8d1c6dd4f1cf292f0a4147d24da255061ad +block null +in 00000000a2dc6fcb5b38b46c14329ff6f572c979293e441becc3622e8f80dae7 +block null +in 00000000db23273437aa123dd35477ecbb501bf327af2b7d2cd2276fc3868b92 +block null +in 000000005e3366083e9e8f211d8a854ed779363e848087c3cd52e2d3456bc988 +block null +in 00000000749f7108368cb96405b7bed717a5413c1dbb9eff55619242fd765d88 +block null +in 00000000283a18616ffce66d4ae48407aa03ac3bcee847d1b02e9b6c0716f493 +block null +in 00000000d0e3aef47d44f6308303e9903c2da8e062c051e75861a8f41d86daf9 +block null +in 00000000d7c0a9997fab884956232389281d1cbaea8ca88c3ae951f5a9043a30 +block null +in 0000000048099f7163d4304db54c6828ec655cededdd9ac84c9eb1ab2a06826b +block null +in 0000000075069724e7f6df3e5b74bcd71f1cc76203a22ae5e6dd1ad2782e33f7 +block null +in 00000000ea4a9dc0b40887c85581e2ce25966368027d1111a6e6f7a68ecbebc9 +block null +in 00000000a166c3c87af6d6a5002fe968fe9bae7a27336a5fb09dc4959f882c56 +block null +in 0000000013a42d4c4b90b7275b4f7e1e95672c45c6cdf68053aa25d671ef1cd4 +block null +in 000000009c5dab265485e46ddaae9b93b79df462d5768526dd897b95359a3595 +block null +in 0000000063d2d2aa667102c497e53ee0afbcd35ccc33eb503b5adbad655f507d +block null +in 000000007adfc0b45968dc3e2d75e19dc761c0e01450c7ac025023b977bbd513 +block null +in 00000000cbfaaebcd468d2f72993cb4f4a6670fd24318de1582acb40aec52e61 +block null +in 00000000de250bf0016bf10a08b2b9506dbf9c22eb92482ed1f0926e83e13cf1 +block null +in 00000000a50fcb7dbcff8eaca8dffbba691363ccf83b60acad0cd76b63ae24ee +block null +in 000000007951f5eea246739b1f9e6b5bd84a6322408cfa75ebf08121cda35063 +block null +in 000000001b71c0342097f445a3a97f87b3e8bab8805277f2bf7d0514b0929da2 +block null +in 00000000ed4a5a6ee2f6a91bef0d8c461197b80c64172e2c4833bf55944abfdc +block null +in 00000000d81e2c02757dfe888367c8b7dc302248c65d707582cbab02aab22904 +block null +in 000000000e33cd74a98c9c8d68ad05c0a3d7d8c7c5b91fd77393b3b3308a1d87 +block null +in 00000000438e70988896a0e26183820bf06a693b69062532432ea5034e8afd19 +block null +in 000000006d00e94f462f3c38a4a1980088c79836e1e505a3ab9c67d27bd650d2 +block null +in 00000000adfaa194a65ec30f5b2ba253f17d30bd6d9b5280e9dee3aadbb8839d +block null +in 000000000d339e96526f390f6cd92f1d007e5520dcc7118abed1c11504ffd1a7 +block null +in 000000005f33b9e3b26f654fa4c747b721f85ba86485ba98a67a4a8ff0108ad9 +block null +in 000000009e8b595b5654ddabf88dd270f394f8ebb344f44d020dbb8d375a9631 +block null +in 00000000388b6b3335d35512c88d0156ad13fe7b5e17fb66215d8bad4d9ecc04 +block null +in 00000000a61024d843ae74b2b7f687e1b7973a640166a3f188d5503985e79320 +block null +in 000000003abda2b12a8ec8f0ec193b6e8ffc32f79795015161e160534b7df1ef +block null +in 000000001b3fefce25ad0d7b98beed85d21385b1f07c98f00895a4326ca55ebf +block null +in 0000000033149147a294028df23b30536d31fc6572c87f34dc7b57abe663ff91 +block null +in 0000000032828ea3939a022667c55b3fb476d335ffd42b7037a9c977b39f74bc +block null +in 000000008116171525e5ac1bcc5bf5fd52d1b9c2ffe37f6e9093a34e924923a0 +block null +in 00000000f0694b7ba54a1b571b458f70f78f434d1c149a9ca9fd7a29a7cef511 +block null +in 00000000ee58d44fb9d3bb1e01d0baedb9ec4c61cb91f6c557154df515c6a44b +block null +in 000000001e99f10c99811b2df407035e20bbb5c849a474c96a141301f1868871 +block null +in 0000000081ec31c539e84554e01ab71bd9a403f3c84bc108e9e4275cbffffb81 +block null +in 0000000036ad3b9c095a91a4f3b44be0b650ecf9f011855454c07c431b377f6d +block null +in 00000000f6c28e3dd805612dded520f6c71b9f5b5ee1a80490b76813752d2cb8 +block null +in 0000000071a43d7fee203e376e2987f9e03022c9e90e50be6b25359dbcf1fe6e +block null +in 00000000e8cb5880352f2bd86a5d729509ed8da2839b2b6594b5605968ed89e7 +block null +in 00000000beaf2091cc7b1637fb228e481d82de09d0f895092e00a105e2ed0606 +block null +in 000000000d4a05ac654b5de2331a30eccb974e8e50197555252413faf7e0a36d +block null +in 000000007300a0c069c5378794e498955cf643886ce9a6b2b364b25b34329ccb +block null +in 00000000f190f2aabecedab67eacafb8c7fb559d3be40dabe50c0ced599f3495 +block null +in 00000000f52b57d18c835fe3521e098007a6ee145558f044da86e48a5ca1e10b +block null +in 000000000fecea96db97ec1603f668ddeafa192ed3e94b2cd91b7bde30b6b7c0 +block null +in 000000003f49484ebb0bb5cb5b00a3b1a0a5258cd8e107d8bdf2c89d43513cae +block null +in 0000000088ba7fccc9764740c96c6acb639c2439c0627b5e08848e690c3512ce +block null +in 00000000ea35a691c65f9629bcae4a4349b78592edc48b0b4c6d632a25a8cc3d +block null +in 0000000014b38785f19c24b84c0e684096045fb4644ea5aec6d506ec4c7fcdf6 +block null +in 000000009836d06cf1068dfdd4c41d85849b96f3be0b8696cdade4fa9b134ec6 +block null +in 00000000ea76b5d8a89ad94d5f9d2a1398cd07b4ace1b5fe35226198a011e8a3 +block null +in 0000000097091f85a14d7ef6f9f90515d4d59b7fd6df8c5d769c4ce16fb85aab +block null +in 0000000052ec2ea934a6dd564234c10bb7efb245903e6eafab9c362177f6e96e +block null +in 00000000abcdbe6fdc3f8b90aaea8f4cefb58089efacd4ae5d6947374261efb3 +block null +in 00000000d7cd1c7906017b9024528f0beb2abd526d4fd9c71e39b67b0cc3751c +block null +in 0000000053b491c133cdd8967bc0e81a2a4497c7a5233b9710535d230406bba8 +block null +in 00000000c8de546e05e6ba1d6326e150e539f5e7cf527bb71b37420caff2374d +block null +in 00000000caf46e77f96a0646d8d871f2b799705ea1d367457a64883a4274e787 +block null +in 000000004929c1f4a8affb754235f2cd0f037fa4301360d886779bd5a1e63b2f +block null +in 000000002ce019cc4a8f2af62b3ecf7c30a19d29828b25268a0194dbac3cac50 +block null +in 00000000e38816ab3892339d43ae31fafd3d4e633f2d909c236b2d209343040e +block null +in 00000000423cc5a91cb52e9e1ee5bc817b50c74e11f3f4424d92f45ebae69663 +block null +in 0000000040a24e14497879bdd67db948cf30edc5d0a5833e8cb2736582157b49 +block null +in 00000000a04a30baed00999ad971f807b5e742f602e013519f89eb7248c7ddf5 +block null +in 000000008f453af3c04f323c8525de2e43f4e03fef24db5e499f4cd58e758a91 +block null +in 0000000058167a25317bb041b1fb9d21d5f64e58a1bd9f7dafe9b0de7c3f8935 +block null +in 000000009fdacd20e0019ccdfd1c4da58fa0baac813237126b34ca948ec4f8b6 +block null +in 00000000326ccd8c4995122d8c0f075d3c5b86dc03c240994ae00cd700db0660 +block null +in 0000000077efad65c020c66ca6ff3d82dd3115485fc8dd72287b8d5570c10d5e +block null +in 000000002f82b5e6188ccfeb404ce4236543f21501cfe34faf1dbc20ab0c3256 +block null +in 00000000fc92806bce687555788006c8956f045f6155d10f03a4747dab63b0cc +block null +in 000000001e6fa975cd1d5962540999282c813b888c4b40be27dd46bd617a6d7f +block null +in 000000003c57326aef40756faae2f9d31aa0207d8bf6461a4dd376e1e3cfe86b +block null +in 000000005772805866e1235ba97d05b4e27e15d001e42d7443ba8a252372b89c +block null +in 00000000589c8bd91248c962b02745adc694e81a84e06a79bc265ca8a371b752 +block null +in 000000001acb8b9de74ebedfaba91793e14d11b985f97b6d69f77e63b57ea07c +block null +in 00000000e4a86b28672a737f0b9e154b6d32263d676fa1ddab03bf9073946f32 +block null +in 0000000014e581981f9543836ea2e5c1471df4d01c7ec4ec236f2ff48df65aa4 +block null +in 000000007ce577a4616cb900be5047c02c3e34b755c18ecf8e2a15dbcfc4ae7e +block null +in 0000000058dbb5e3fce9be42ae79beb564be666866c6b85c9791863219ec36db +block null +in 000000009ed831839be09e84062bb65f4aa8cf9eaba3ca29c5eacd6e68a6f8d8 +block null +in 00000000da7610c0d7c8234f42198b05d1d74d49b63da96a7001046e277546c5 +block null +in 000000008a91ac6ac787eda6a2f5a7ddc94311322c3f80ddf0f144cb7c2ba7bc +block null +in 00000000b45520fb1036ad6217463e5266d039dd56aa9b6620a672466e6d9d76 +block null +in 00000000d8fe3095f7c84c8a68f1dd3177ec3b88d39ab8b30841d69b3e5846e8 +block null +in 00000000ee24a06c55f99b6b02e9a9530e45c00a316358f7f1723d552c01721d +block null +in 00000000ba48b7df69f94ab95aecf8c50d198d5af5587c45677b4ca0bfdfc5d2 +block null +in 000000003f5321860e395d939936f873276cd1e6a04db1f122bf0b7232e90b88 +block null +in 000000002b3e7dea042c66777bb65ca77677ca1757341323a9081cd674b1b000 +block null +in 00000000bca1f43643a1ce6f46b5c9f8ede03bd7ae9c2f516af19d6360575389 +block null +in 000000007dd5a0c7da84df7c525b6693d5d0a4c5c211716fc8d48f7f885d1da6 +block null +in 000000007f65e65a59a9550ac33366950bcdaa1f432361391d18aebd2b8f677f +block null +in 00000000793d9f28b977a4b60282c492fe9f595032612dd21f9fe48c752b1154 +block null +in 00000000ddb9f1b7d3ac69f1e3470bca9a11c949c660d075699132ff862814bb +block null +in 00000000b23e86dc9781b46e60204ec0b71f1300038953131fad081df536a929 +block null +in 000000001888bb2530e2764011c77df3208f1030aa8312d8d60c92188475167d +block null +in 00000000cb34c19b9d3b573c2014db3b47dc921f8aaf1cf98c85dce13a24a687 +block null +in 000000004ec5b5037345d7b580340a056a76d41befbe97e74ef7f1180b1a0a2d +block null +in 000000002ea3327dc7533bc9e755aa1d00cff507a5d49645b7363700a20e5060 +block null +in 00000000b9b7655f618e40b81996c52b5b475768b9a93466e4ca2980421b3dcc +block null +in 00000000a0eda8777ead8f448fe7f30ec77052bda423379e4adbdb3fcb9cda73 +block null +in 000000005110aded6fe9effe2d12b765e45dd4c41d275c8a1f3c192adf985aef +block null +in 0000000035c96651a7dc7a99a9c959a8add21d3cc978c3127a6eecb9c56c2548 +block null +in 000000007bf23738f73e6f19bc9f6809f5fc57bba53baedd91886d704b7c5deb +block null +in 000000007f8987a7bd4b3ce982ec496f8195986429516c76f1cda58ae94d21e5 +block null +in 0000000025710fc4c3aea7f29ed12fb99bdbaa20246bb117a1aa29dc4cc04ffd +block null +in 0000000035e7209cc94730177fd8f23659ab575f4dabcf4e8743d37371c65272 +block null +in 000000003b2584db8e92a81b462e8cbab6237aa8e06644b2cd191d6deb46775a +block null +in 00000000291d8e6f5d0d2a59de8f0f206917f3e00ff53edc8f6dcaddd61f3fe9 +block null +in 0000000014e6ae5aef5b7b660b160b7572fe14b95609fefb6f87c2d2e33a5fdd +block null +in 00000000ff41b51f43141f3fd198016cead8c92355f7064849c4507f9e8914f8 +block null +in 0000000040601867cc01cb7092f296b5faca919e0c5bf92d1fd9872c37c6720f +block null +in 0000000051f1e18b269bd79d3466a61493cf37113accdbd5a12c37d21491b37c +block null +in 00000000dd178e524c4118e247c6dcc1ffe061fdebfb636f66b0aaa14f63d8f8 +block null +in 000000003c69affde6fae915e87138221dc234b250e055fff4abb01851ae3a94 +block null +in 00000000f26bcec54f016022e34e46b497c8a77805ad26cc49a4e78c6140606c +block null +in 00000000b1691c0c304c008cc8e575a4f89a966a7647a2260f8c21fab4de67c0 +block null +in 00000000337fdd4ff763bf42f92b9e9eeba3647529601eedceedef7cb808ba5c +block null +in 00000000d9378e9071689e790797e40f57031231d25a2172d9b8fa035222cc1d +block null +in 000000003a136880180c374f3a83afe8d3246a611bb41287f0648c1f1ca84f64 +block null +in 000000007b9c44d9ebd5bbc2eb9a2d2828c2234cff7df1d73c1770c88c0a75ba +block null +in 000000005de65b4d86bae61ffba03abbffdf5f324ee8fe4470e78228910df4e0 +block null +in 00000000e580d532ecc9f0055f3a4a8e8de8c1d4e08e6e5ce55e6d9ff8e5e803 +block null +in 0000000055249f21d166e67a8d1c7736b37e2f3951e23aa888eab0f78a1789f3 +block null +in 00000000cb424323d667417af89366e3bc5842234cb629ad9330ddb6c7c9ced8 +block null +in 00000000f58d78bff94e6a0bf7f815567a71cbba86e801ab92b3d954048550d8 +block null +in 000000000119550f603dad72bbce40f8414d455f5aae1cced57859fafbb7f13c +block null +in 00000000b17a4250b1dd2d7402bb7f5646c5ac2f05637a4a916fec2d8f6a7f2d +block null +in 00000000774442ed62e512f13530dbf32cd54a78295fb429096ca1c5b2cd7689 +block null +in 000000007bf59538e2143e5d1604372639bca591876219441f4f019618f9d7d6 +block null +in 000000002ae8eed1e0f00f88944ab1cc220524a1aa35d452da01608c3750e22b +block null +in 00000000b3688d9bc46a39d3462e32bd5175e1fa4f639f50c6a5e58110c24a06 +block null +in 0000000060ff94c494dedada1153ef89d5470ab7ace99d8efd99476f65bb1cad +block null +in 0000000062f0451ef6a798ef86744d0fd5369a88a53949b01268ab5152830d9f +block null +in 000000003e08e9ccfd684b5b50795a81d0c034a095bcf362e805013ddb5e10d1 +block null +in 0000000086a90141ba816ffd5ee39a0776d972be6f9207909ded92bf72c8e7d1 +block null +in 00000000c8d928db0841f06f8e877f8378c5c9b864f6a1ca911a0af873b08792 +block null +in 000000002826ccbfe5e946785c349fa9018d6f2691da0b458656a18c000ff0a3 +block null +in 00000000f7bb05cb62b88ddca462adc879bdb621e4aa9f99f32e5343b1d3ce12 +block null +in 000000003de5d5da9a09965cdbe15418476237322f740df06a4590b62496c3f0 +block null +in 00000000cb852c439002a8c12ce20ac1fc4842621c762da6166871b2122e4a29 +block null +in 00000000e6aeb77f532a674a1c464728b4c68c17a03c16cb09996b363ad04e77 +block null +in 00000000a5a2d8c475fa4a8a030561af0f287eee43df7659d052c95a5d0a9083 +block null +in 0000000092d01e73e543f08fbc685bec7be1851ee4b1a96bbda1aadb8c6b3310 +block null +in 000000000bf6fbe736eec59210e8a0848649d645ad752edeb1e37566a7525bec +block null +in 00000000a7a8236d9ded2725d62a35b6d81a9834e41f357cf79494b499e8f77a +block null +in 000000004eb9c7c004d8eddd1d57380d3061126024a2bf2715fdf69937e92bf2 +block null +in 00000000b3d306b78ec94eb3999334a8126720e77ce1c1a2d79cd924796a1499 +block null +in 00000000a87a669392fe60b69ee4cb1709aac7d269cbdcedd91175cfd49d13e5 +block null +in 000000002fbb355416d3cfa66b26cf1a26f33a0539d9583a3834cca6e3c0a552 +block null +in 00000000ebecc48af6cca0b45ee6669ca576f6bce61c84d1ca3932062b74d62e +block null +in 000000003eacad27508770feb3a380b77e84a0b3377966c30828b38b633f4a4d +block null +in 000000001c5ec4ce256fdd0fd5dc99771b0bb1ca114775bf7e474aae03d8867b +block null +in 00000000a09cdd0e6943d383bbf98d1a6da4301983a9fa5f5151ab6ca91b2334 +block null +in 000000008fab2c4c4bf7bb62f6320b2b23529fbe3dcd68d9e53bae1932d52794 +block null +in 0000000060b2931b67222cafd85724f6e15b60ec23324d5850449d10f34097db +block null +in 00000000e0405de8d785ba27da9db6ec109162599e11e2328dd451ddad4d44de +block null +in 0000000014566680b6013daad38fcdc70dcdf8d441a3a09506cf0cdd0c4273a1 +block null +in 00000000132561fe8954a7719e286e9c443ec90871bf86efebdf53a0872b3f34 +block null +in 00000000a4144456126bb190ba436f79e63b3754ccc0f937ba691e891ab77543 +block null +in 000000004211e009aacbc9cae1f18087835087c4096e8b721240f4a6d9f9b2f7 +block null +in 00000000e0718f16a4b6de8d34ef7fb0e0d27b34e48a431bcfa0d4d151cd88a6 +block null +in 000000004d7fba8e3e502671c7649c3899e85e60ad95f732ab4152b842b8f510 +block null +in 000000003fd1956b7a2f798be92a2b70a06dae45de6afcba596d5d0dbff947ee +block null +in 0000000038a875337f34f5655beba2da85a4389fe18f4a55132604b1996d39a0 +block null +in 00000000ad06fd4b00e2fbc26a13ce17e0a393ae92fcff3c7710611e30ce8707 +block null +in 000000007ceb059f66682f7c5db4395d08b9785502f81c5425a2a7785a4876ae +block null +in 00000000086f359cf409d74610505c5ced56ce43e7c94e1df38ffb8d9fd0cc57 +block null +in 00000000f2075ac9aec7e3ee74c01452d5489046965b6f9317b99a66ac4c2842 +block null +in 000000009202c2fe65c87b0a36c30ac6b95070b560a872f3138a90535c0c825d +block null +in 00000000d09cae5718fa27f63a22709c7e5b59867e759404657d5620412d3b3c +block null +in 00000000e51ac24f7c2f0db7e1a9e6602a4c494e43aaf1fd657802820ffa747e +block null +in 00000000f5b7104de08be55050d65d17ae9e015eae552019679657040db76049 +block null +in 00000000047c75238839b143952b93f90c322bcf76c405e19372bb6677c35489 +block null +in 0000000057aaa0981843419353177917fbdbb746bf0091dbd5d351694bedd352 +block null +in 00000000c5d4004c5bbe52347c07b98b0a861c86ac4885536104e7936f61542d +block null +in 000000005ac908df36a019b6c34bbd31294c2a17576016c62fd3e77ff5b726e2 +block null +in 00000000b52bc4848b3622ecad26d8de1726c5a12f1d7f28618cfb87eceb1254 +block null +in 000000005c01140b1d77c59ec0a0d3b900bfc0c3caa3b5bad71874c140ca24ba +block null +in 0000000012d67c80e8a206c0012058875d04511b2ba00b6a10b75627853e826e +block null +in 00000000035226b2eb11ccfc2ff1bcdd1fc83dc47ad4f98c2c3ab425c1ad033f +block null +in 000000009cce43b11d11bb4741ebc823d52cc237a6efba140eeb1259dffedf2b +block null +in 0000000080414d6c1d681859411dc6553c8b541d660f43b8dc63247797b3c111 +block null +in 000000006066a659fba0fae8cf97748b00e704eadc0c78f8d159e01ba205e7a0 +block null +in 000000005be9be6041db126f5bbd1920fa58e7cc9486adb52d8243859b5c2c49 +block null +in 000000001e86d086797f426a2f56606d7ddb5ed9ef1e90407afdbcbdf3a7e395 +block null +in 0000000010d25371e488d4c44eae348047ec83236eaacaaa94f37acbff0e3f0a +block null +in 00000000c614c911e59dd82e5433cca4903693ea023e4a2df44172646dd9f0a1 +block null +in 000000009a4dcc4bb53e957227d6e54762a17a7049389482e40d0c1789318bf7 +block null +in 000000007df91a8fa7c24925e236d33a2d54a0b0f4f8bd0295175133ec5c8359 +block null +in 00000000bfa5f5443026664ba39812fc0e66dcc815d9e74b9b89a195d3e4a2c6 +block null +in 00000000ce882941e41d5a5fe034a2068c67ec1405f099aa103a83299c2de667 +block null +in 00000000840b4f18898fbb8a85c3223dad31d0880d51c0db9f466b938cac68d4 +block null +in 00000000e9f88347ecc865a5b304a8212ed70b3c3b2966a1cd9e5afb4ccd9dd6 +block null +in 00000000c186b0e3f70aad7e85600a51849ab6d6e4f41a225d353a9ed115eea4 +block null +in 00000000f64fd16187a818f57233d5f87dd36ad38a9523e1bea17b4fce32eade +block null +in 0000000092907b867c2871a75a70de6d5e39c697eac57555a3896c19321c75b8 +block null +in 00000000042ddc75cd642cbf51830a956b55447e8bee6366cb2c18cac68fa635 +block null +in 00000000d2331eb9b8dfe35cfcaa5a819c2d3d09aa17fee91a7bf3342b595b2e +block null +in 000000003f5ac18f9517f1fa00a172551c43d846fab3d004f76403339bd03b77 +block null +in 000000004a0cd08dbda8e47cbab13205ba9ae2f3e4b157c6b2539446db44aae9 +block null +in 0000000009de10e138a25adda2fd80a256e9d7eeab600339eebe0386fef87d33 +block null diff --git a/kkk.ks b/kkk.ks new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/kkk.ks @@ -0,0 +1 @@ + diff --git a/server.js b/server.js index 3c9aa54d..970c8e5b 100644 --- a/server.js +++ b/server.js @@ -10,6 +10,7 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development'; var express = require('express'), fs = require('fs'), PeerSync = require('./lib/PeerSync').class(), + HistoricSync = require('./lib/HistoricSync').class(), mongoose = require('mongoose'); /** @@ -40,14 +41,27 @@ var walk = function(path) { }; walk(models_path); +// historic_sync process +var hs = new HistoricSync(); +hs.init({ + skip_db_connection: true, + networkName: config.network +}, function() { + hs.import_history({ + reverse: 1, + }); +}); + + // p2p_sync process var ps = new PeerSync(); ps.init({ skip_db_connection: true, broadcast_txs: true, broadcast_blocks: true +}, function() { + ps.run(); }); -ps.run(); // express app var app = express(); diff --git a/util/get_addr.js b/util/get_addr.js new file mode 100755 index 00000000..0211189e --- /dev/null +++ b/util/get_addr.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +process.env.NODE_ENV = process.env.NODE_ENV || 'development'; +var + + config = require('../config/config'), + Address = require('../app/models/Address'); + mongoose= require('mongoose'); + + mongoose.connect(config.db); +var a = Address.new(process.argv[2]); +a.update(function(err) { + console.log(a); + mongoose.connection.close(); +}); + diff --git a/util/get_tx.js b/util/get_tx.js new file mode 100644 index 00000000..fbe78268 --- /dev/null +++ b/util/get_tx.js @@ -0,0 +1,62 @@ +#!/usr/bin/env node + +process.env.NODE_ENV = process.env.NODE_ENV || 'development'; + +var GET_TX_VERSION = 1; +var program = require('commander'); +var RpcClient = require('../node_modules/bitcore/RpcClient').class(); +var config = require('../config/config'); +var Transaction = require('../node_modules/bitcore/Transaction').class(); +var rpc = new RpcClient(config.bitcoind); +var buffertools = require('buffertools'); + + +program + .version(GET_TX_VERSION) + .option('-D --dummy', 'dummy', '0') + .parse(process.argv); + + + +var tx_hash = process.argv[2] + || 'f6c2901f39fd07f2f2e503183d76f73ecc1aee9ac9216fde58e867bc29ce674e'; + +// PARSING! + + +rpc.getRawTransaction(tx_hash, 1, function(err, tx) { + + if (err) + console.log(err); + else + showTX(tx.result); + parseTX(tx.result.hex); +}); + + +var showTX = function(txInfo) { + console.log("## Bitcoind Info"); + console.log(require('util').inspect(txInfo, true, 10)); // 10 levels deep + console.log("########################################################################"); +} + + +var parseTX = function(data) { + var b = new Buffer(data,'hex'); + + var tx = new Transaction(); + tx.parse(b); + + +console.log(tx); + + + console.log("## INPUTS"); + tx.inputs().forEach( function(i) { + console.log("\t", typeof i); + console.log("\t", buffertools.toHex(i)); + }); + + +} + diff --git a/util/get_txout.js b/util/get_txout.js new file mode 100755 index 00000000..9790a6dc --- /dev/null +++ b/util/get_txout.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node +process.env.NODE_ENV = process.env.NODE_ENV || 'development'; + +var RpcClient = require('../node_modules/bitcore/RpcClient').class(); + +var config = require('../config/config'); +var util = require('util'); + + +var tx = process.argv[2] || '91800d80bb4c69b238c9bfd94eb5155ab821e6b25cae5c79903d12853bbb4ed5'; +var n = process.argv[3] || 0; + + +var rpc = new RpcClient(config.bitcoind); + + +console.log("ARGS:", tx,n); +var block = rpc.getTxOut(tx, n, function(err, block) { + + console.log("Err:"); + console.log(err); + + + console.log("TX info:"); + console.log(util.inspect(block,true,10)); +}); + + +