├── .gitignore ├── LICENCE ├── README.md ├── bin ├── header.png └── how-it-works.png ├── composer.json ├── docker ├── Dockerfile └── start.sh ├── etc └── config.ini.php.dist ├── run.php ├── sql └── createTables.sql └── src └── PCSG └── SteemBlockchainParser ├── Block.php ├── Config.php ├── Database.php ├── Log.php ├── Output.php ├── Parser.php ├── RPCClient.php └── Types ├── AbstractType.php ├── AccountCreate.php ├── AccountCreateWithDelegation.php ├── AccountUpdate.php ├── AccountWitnessProxy.php ├── AccountWitnessVote.php ├── CancelTransferFromSavings.php ├── ClaimRewardBalance.php ├── Comment.php ├── CommentOptions.php ├── Convert.php ├── CustomJSON.php ├── DelegateVestingShares.php ├── DeleteComment.php ├── FeedPublish.php ├── LimitOrderCancel.php ├── LimitOrderCreate.php ├── Pow.php ├── Pow2.php ├── Transfer.php ├── TransferFromSavings.php ├── TransferToSavings.php ├── TransferToVesting.php ├── Vote.php ├── WithdrawVesting.php ├── WithdrawVestingRoutes.php └── WitnessUpdate.php /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | /vendor/ 3 | /etc/config.ini.php 4 | /test.php 5 | operations.txt 6 | composer.lock 7 | log.txt 8 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | STEEM to Database 2 | ====== 3 | 4 | ![STEEM to Database](bin/header.png) 5 | 6 | Description 7 | ------ 8 | 9 | STEEM to Database will parse the STEEM Blockchain and insert the data into a Database. 10 | It is possible to parse either a single block, a range of blocks or run a continuous loop to parse all available blocks. 11 | 12 | *Currently only MySQL is supported* 13 | 14 | Features 15 | ------ 16 | 17 | * [x] Parse a single block 18 | * [x] Parse a range of Blocks 19 | * [ ] Verify the Database (Check all blocks and insert missing data) 20 | * [x] Parse latest blocks 21 | * [ ] Highly configurable 22 | * [x] Easily readable output 23 | 24 | Installation 25 | ------ 26 | 27 | ### Needles 28 | 29 | ``` 30 | php-mbstring 31 | php-mysql 32 | ``` 33 | 34 | ### Manually 35 | 36 | **Step 1** Clone the repository 37 | ``` 38 | git clone git@dev.quiqqer.com:pcsg/steem-blockchain-parser.git 39 | ``` 40 | 41 | **Step 2** Edit the config file 42 | ``` 43 | mv etc/config.ini.php.dist etc/config.ini.php 44 | nano etc/config.ini.php 45 | ``` 46 | 47 | **Step 3** Create Database 48 | * Create the Database 49 | * Import the SQL File `sql/createTables.sql` 50 | 51 | **Step 4** Run composer 52 | ``` 53 | composer install 54 | ``` 55 | 56 | **Step 5** Run the parser 57 | ``` 58 | php run.php 59 | ``` 60 | 61 | ### Docker 62 | 63 | **Step 1** Database 64 | 65 | Create a database on a database server (your docker containers must be able to connect to it) 66 | Execute the `sql/createTables.sql` SQL-Queries to create the databases table structure 67 | 68 | 69 | **Step 2** Docker container 70 | 71 | We provide a docker container for ease of use. 72 | Change the environment variables and run the following command to get the container up and running. 73 | ``` 74 | docker run --name steemit-parser \ 75 | -e DB_HOST= \ 76 | -e DB_PORT= \ 77 | -e DB_USER= \ 78 | -e DB_PASSWORD= \ 79 | -e DB_NAME= \ 80 | --restart=unless-stopped \ 81 | bogner/steem-blockchain-parser 82 | ``` 83 | 84 | **Hint**: To run the container in the background you need to add the `-d` flag to the `docker run` command. 85 | 86 | Additional steps 87 | ------ 88 | 89 | ### Keep the parser running (For manual installations) 90 | 91 | #### Supervisor 92 | 93 | ``` 94 | apt-get install supervisor 95 | ``` 96 | 97 | ``` 98 | nano /etc/supervisor/conf.d/steem-blockchain-parser.conf 99 | mkdir /logs/ 100 | ``` 101 | 102 | ``` 103 | [program:blockchain-parser] 104 | command=/usr/bin/php run.php 105 | process_name = %(program_name)s-80%(process_num)02d 106 | stdout_logfile = /logs/blockchain-parser%(process_num)02d.log 107 | stdout_logfile_maxbytes=100MB 108 | stdout_logfile_backups=10 109 | stderr_logfile= /home/s2db/logs/error-blockchain-parser%(process_num)02d.log 110 | numprocs=1 111 | directory= 112 | stopwaitsecs=10 113 | user= 114 | autostart=true 115 | autorestart=true 116 | ``` 117 | 118 | ``` 119 | service supervisor restart 120 | ``` 121 | 122 | 123 | How it works 124 | ----- 125 | 126 | ![How it works](bin/how-it-works.png) 127 | -------------------------------------------------------------------------------- /bin/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsg/pcsg-steem-blockchain-parser/0d3bfa6e4b89930f795e6d7d861b1a36ecda3b8c/bin/header.png -------------------------------------------------------------------------------- /bin/how-it-works.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsg/pcsg-steem-blockchain-parser/0d3bfa6e4b89930f795e6d7d861b1a36ecda3b8c/bin/how-it-works.png -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pcsg\/steemit-php-parser", 3 | "description": "A Steemit Blockchain to MySql Parser", 4 | "version": "dev-master", 5 | "type": "project", 6 | "licence": "GPL-3.0+", 7 | "authors": [ 8 | { 9 | "name": "Florian Bogner", 10 | "email": "f.bogner@pcsg.de" 11 | } 12 | ], 13 | "minimum-stability": "dev", 14 | "require": { 15 | "fguillot\/json-rpc": "^1.2.4", 16 | "quiqqer\/utils": "1.11.0", 17 | "graze\/guzzle-jsonrpc": "^3.0" 18 | }, 19 | "repositories": [ 20 | { 21 | "type": "composer", 22 | "url": "https:\/\/update.quiqqer.com" 23 | } 24 | ], 25 | "autoload": { 26 | "psr-4": { 27 | "PCSG\\SteemBlockchainParser\\": "src\/PCSG\/SteemBlockchainParser" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:xenial 2 | 3 | ENV LOG_LEVEL "DEBUG" 4 | ENV DB_HOST "localhost" 5 | ENV DB_PORT "3306" 6 | ENV DB_USER "root" 7 | ENV DB_PASSWORD "" 8 | ENV DB_NAME "steem" 9 | 10 | 11 | WORKDIR /app 12 | 13 | RUN set -ex; \ 14 | apt-get update && apt-get dist-upgrade -y --no-install-recommends; \ 15 | apt-get install -y wget nano git; \ 16 | apt-get install -y --no-install-recommends php7.0-cli php7.0-zip php7.0-mcrypt php7.0-mbstring php7.0-intl php7.0-bz2 php7.0-bcmath php7.0-xml php7.0-mysql php7.0-json php7.0-gd php7.0-curl; \ 17 | apt-get install -y --no-install-recommends language-pack-en; 18 | 19 | RUN git clone https://dev.quiqqer.com/pcsg/steem-blockchain-parser.git /app/ 20 | 21 | RUN mv /app/etc/config.ini.php.dist /app/etc/config.ini.php 22 | 23 | RUN wget -O /usr/local/bin/composer https://getcomposer.org/download/1.6.3/composer.phar 24 | RUN chmod +x /usr/local/bin/composer 25 | 26 | RUN composer install 27 | 28 | ADD start.sh /app/ 29 | RUN chmod +x /app/start.sh 30 | 31 | CMD ["/app/start.sh"] 32 | -------------------------------------------------------------------------------- /docker/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ ! -f /app/.initalized ]; then 4 | sed -i "s/message_level=debug/message_level='$LOG_LEVEL'/g" /app/etc/config.ini.php 5 | sed -i "s/host='localhost'/host='$DB_HOST'/g" /app/etc/config.ini.php 6 | sed -i "s/port='3306'/port='$DB_PORT'/g" /app/etc/config.ini.php 7 | sed -i "s/user=''/user='$DB_USER'/g" /app/etc/config.ini.php 8 | sed -i "s/password=''/password='$DB_PASSWORD'/g" /app/etc/config.ini.php 9 | sed -i "s/dbname='steem'/dbname='$DB_NAME'/g" /app/etc/config.ini.php 10 | 11 | touch .initialized 12 | fi 13 | 14 | while true 15 | do 16 | php /app/run.php 17 | sleep 5; 18 | done -------------------------------------------------------------------------------- /etc/config.ini.php.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | [steem] 4 | blockchainurl='https://api.steemit.com/' 5 | rpcurls[]='https://api.steemit.com/' 6 | ;rpcurls[]='https://api.steem.house/' 7 | 8 | [block] 9 | start=22000000 10 | save_raw_block=0 11 | 12 | [requests] 13 | concurrent_requests=10 14 | 15 | [messages] 16 | log_level= 17 | message_level=debug 18 | message_timestamp_format='H:i:s' 19 | 20 | [database] 21 | host='localhost' 22 | port='3306' 23 | user='' 24 | password='' 25 | dbname='steem' 26 | 27 | [observe] 28 | vote=1 29 | comment=1 30 | claim_reward_balance=1 31 | transfer=1 32 | custom_json=1 33 | comment_options=1 34 | account_update=1 35 | delete_comment=1 36 | transfer_to_vesting=1 37 | limit_order_create=1 38 | delegate_vesting_shares=1 39 | limit_order_cancel=1 40 | feed_publish=1 41 | account_create_with_delegation=1 42 | account_witness_vote=1 43 | convert=1 44 | pow=1 45 | pow2=1 46 | account_create=1 47 | witness_update=1 48 | set_withdraw_vesting_route=1 49 | transfer_to_savings=1 50 | cancel_transfer_from_savings=1 51 | withdraw_vesting=1 52 | transfer_from_savings=1 53 | account_witness_proxy=1 54 | -------------------------------------------------------------------------------- /run.php: -------------------------------------------------------------------------------- 1 | getMessage(); 10 | echo PHP_EOL; 11 | exit; 12 | } 13 | 14 | // db test 15 | try { 16 | $Parser->getDatabase(); 17 | } catch (\Exception $Exception) { 18 | echo $Exception->getMessage(); 19 | echo PHP_EOL; 20 | exit; 21 | } 22 | 23 | 24 | $lastBlock = $Parser->getLatestBlockFromDatabase(); 25 | 26 | if ($lastBlock === 0) { 27 | try { 28 | $lastBlock = $Config->get('block', 'start'); 29 | } catch (\Exception $Exception) { 30 | } 31 | } 32 | 33 | try { 34 | $Parser->parseBlockRangeAsync( 35 | $lastBlock + 1, 36 | false, 37 | \PCSG\SteemBlockchainParser\Config::getInstance()->get("requests", "concurrent_requests") 38 | ); 39 | } catch (\Exception $Exception) { 40 | echo $Exception->getMessage(); 41 | echo PHP_EOL; 42 | exit; 43 | } 44 | 45 | // this delay is for the supervisor 46 | // if the process breaks to fast, the supervisor kills it 47 | sleep(1); 48 | -------------------------------------------------------------------------------- /sql/createTables.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Host: 127.0.0.1 3 | -- Server Version: 5.7.21-0ubuntu0.16.04.1 - (Ubuntu) 4 | -- Server Betriebssystem: Linux 5 | -- HeidiSQL Version: 9.4.0.5125 6 | -- -------------------------------------------------------- 7 | 8 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 9 | /*!40101 SET NAMES utf8 */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 12 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 13 | 14 | -- Exportiere Struktur von Tabelle steem.sbds_core_blocks 15 | CREATE TABLE IF NOT EXISTS `sbds_core_blocks` ( 16 | `raw` mediumtext, 17 | `block_num` int(11) NOT NULL, 18 | `previous` varchar(50) DEFAULT NULL, 19 | `timestamp` datetime DEFAULT NULL, 20 | `witness` varchar(50) DEFAULT NULL, 21 | `witness_signature` varchar(150) DEFAULT NULL, 22 | `transaction_merkle_root` varchar(50) DEFAULT NULL, 23 | PRIMARY KEY (`block_num`), 24 | KEY `ix_sbds_core_blocks_timestamp` (`timestamp`) 25 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 26 | 27 | -- Daten Export vom Benutzer nicht ausgewählt 28 | -- Exportiere Struktur von Tabelle steem.sbds_tx_account_creates 29 | CREATE TABLE IF NOT EXISTS `sbds_tx_account_creates` ( 30 | `block_num` int(11) NOT NULL, 31 | `transaction_num` smallint(6) NOT NULL, 32 | `operation_num` smallint(6) NOT NULL, 33 | `timestamp` datetime DEFAULT NULL, 34 | `fee` decimal(15,6) NOT NULL, 35 | `creator` varchar(50) NOT NULL, 36 | `new_account_name` varchar(50) DEFAULT NULL, 37 | `owner_key` varchar(80) NOT NULL, 38 | `active_key` varchar(80) NOT NULL, 39 | `posting_key` varchar(80) NOT NULL, 40 | `memo_key` varchar(250) NOT NULL, 41 | `json_metadata` text, 42 | `operation_type` enum('account_create') NOT NULL, 43 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 44 | KEY `ix_sbds_tx_account_creates_operation_type` (`operation_type`), 45 | KEY `ix_sbds_tx_account_creates_creator` (`creator`), 46 | KEY `ix_sbds_tx_account_creates_timestamp` (`timestamp`), 47 | KEY `ix_sbds_tx_account_creates_block_num` (`block_num`) 48 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 49 | 50 | -- Daten Export vom Benutzer nicht ausgewählt 51 | -- Exportiere Struktur von Tabelle steem.sbds_tx_account_create_with_delegations 52 | CREATE TABLE IF NOT EXISTS `sbds_tx_account_create_with_delegations` ( 53 | `block_num` int(11) NOT NULL, 54 | `transaction_num` smallint(6) NOT NULL, 55 | `operation_num` smallint(6) NOT NULL, 56 | `timestamp` datetime DEFAULT NULL, 57 | `fee` decimal(15,6) NOT NULL, 58 | `delegation` decimal(15,6) NOT NULL, 59 | `creator` varchar(50) NOT NULL, 60 | `new_account_name` varchar(50) DEFAULT NULL, 61 | `owner_key` varchar(80) NOT NULL, 62 | `active_key` varchar(80) NOT NULL, 63 | `posting_key` varchar(80) NOT NULL, 64 | `memo_key` varchar(250) NOT NULL, 65 | `json_metadata` text, 66 | `operation_type` enum('account_create_with_delegation') NOT NULL, 67 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 68 | KEY `ix_sbds_tx_account_create_with_delegations_new_account_name` (`new_account_name`), 69 | KEY `ix_sbds_tx_account_create_with_delegations_timestamp` (`timestamp`), 70 | KEY `ix_sbds_tx_account_create_with_delegations_block_num` (`block_num`), 71 | KEY `ix_sbds_tx_account_create_with_delegations_operation_type` (`operation_type`), 72 | KEY `ix_sbds_tx_account_create_with_delegations_creator` (`creator`) 73 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 74 | 75 | -- Daten Export vom Benutzer nicht ausgewählt 76 | -- Exportiere Struktur von Tabelle steem.sbds_tx_account_updates 77 | CREATE TABLE IF NOT EXISTS `sbds_tx_account_updates` ( 78 | `block_num` int(11) NOT NULL, 79 | `transaction_num` smallint(6) NOT NULL, 80 | `operation_num` smallint(6) NOT NULL, 81 | `timestamp` datetime DEFAULT NULL, 82 | `account` varchar(50) DEFAULT NULL, 83 | `key_auth1` varchar(80) DEFAULT NULL, 84 | `key_auth2` varchar(80) DEFAULT NULL, 85 | `memo_key` varchar(250) DEFAULT NULL, 86 | `json_metadata` text, 87 | `operation_type` enum('account_update') NOT NULL, 88 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 89 | KEY `ix_sbds_tx_account_updates_block_num` (`block_num`), 90 | KEY `ix_sbds_tx_account_updates_operation_type` (`operation_type`), 91 | KEY `ix_sbds_tx_account_updates_timestamp` (`timestamp`) 92 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 93 | 94 | -- Daten Export vom Benutzer nicht ausgewählt 95 | -- Exportiere Struktur von Tabelle steem.sbds_tx_account_witness_proxies 96 | CREATE TABLE IF NOT EXISTS `sbds_tx_account_witness_proxies` ( 97 | `block_num` int(11) NOT NULL, 98 | `transaction_num` smallint(6) NOT NULL, 99 | `operation_num` smallint(6) NOT NULL, 100 | `timestamp` datetime DEFAULT NULL, 101 | `account` varchar(50) NOT NULL, 102 | `Proxy` varchar(50) NOT NULL, 103 | `operation_type` enum('account_witness_proxy') NOT NULL, 104 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 105 | KEY `ix_sbds_tx_account_witness_proxies_timestamp` (`timestamp`), 106 | KEY `ix_sbds_tx_account_witness_proxies_block_num` (`block_num`), 107 | KEY `ix_sbds_tx_account_witness_proxies_operation_type` (`operation_type`) 108 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 109 | 110 | -- Daten Export vom Benutzer nicht ausgewählt 111 | -- Exportiere Struktur von Tabelle steem.sbds_tx_account_witness_votes 112 | CREATE TABLE IF NOT EXISTS `sbds_tx_account_witness_votes` ( 113 | `block_num` int(11) NOT NULL, 114 | `transaction_num` smallint(6) NOT NULL, 115 | `operation_num` smallint(6) NOT NULL, 116 | `timestamp` datetime DEFAULT NULL, 117 | `account` varchar(50) NOT NULL, 118 | `witness` varchar(50) NOT NULL, 119 | `approve` tinyint(1) DEFAULT NULL, 120 | `operation_type` enum('account_witness_vote') NOT NULL, 121 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 122 | KEY `ix_sbds_tx_account_witness_votes_block_num` (`block_num`), 123 | KEY `ix_sbds_tx_account_witness_votes_timestamp` (`timestamp`), 124 | KEY `ix_sbds_tx_account_witness_votes_operation_type` (`operation_type`) 125 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 126 | 127 | -- Daten Export vom Benutzer nicht ausgewählt 128 | -- Exportiere Struktur von Tabelle steem.sbds_tx_cancel_transfer_from_savings 129 | CREATE TABLE IF NOT EXISTS `sbds_tx_cancel_transfer_from_savings` ( 130 | `block_num` int(11) NOT NULL, 131 | `transaction_num` smallint(6) NOT NULL, 132 | `operation_num` smallint(6) NOT NULL, 133 | `timestamp` datetime DEFAULT NULL, 134 | `from` varchar(50) DEFAULT NULL, 135 | `request_id` int(11) DEFAULT NULL, 136 | `operation_type` enum('cancel_transfer_from_savings') NOT NULL, 137 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 138 | KEY `ix_sbds_tx_cancel_transfer_from_savings_block_num` (`block_num`), 139 | KEY `ix_sbds_tx_cancel_transfer_from_savings_operation_type` (`operation_type`), 140 | KEY `ix_sbds_tx_cancel_transfer_from_savings_from` (`from`), 141 | KEY `ix_sbds_tx_cancel_transfer_from_savings_timestamp` (`timestamp`) 142 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 143 | 144 | -- Daten Export vom Benutzer nicht ausgewählt 145 | -- Exportiere Struktur von Tabelle steem.sbds_tx_change_recovery_accounts 146 | CREATE TABLE IF NOT EXISTS `sbds_tx_change_recovery_accounts` ( 147 | `block_num` int(11) NOT NULL, 148 | `transaction_num` smallint(6) NOT NULL, 149 | `operation_num` smallint(6) NOT NULL, 150 | `timestamp` datetime DEFAULT NULL, 151 | `account_to_recover` varchar(50) DEFAULT NULL, 152 | `new_recovery_account` varchar(50) DEFAULT NULL, 153 | `operation_type` enum('change_recovery_account') NOT NULL, 154 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 155 | KEY `ix_sbds_tx_change_recovery_accounts_timestamp` (`timestamp`), 156 | KEY `ix_sbds_tx_change_recovery_accounts_block_num` (`block_num`), 157 | KEY `ix_sbds_tx_change_recovery_accounts_operation_type` (`operation_type`) 158 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 159 | 160 | -- Daten Export vom Benutzer nicht ausgewählt 161 | -- Exportiere Struktur von Tabelle steem.sbds_tx_claim_reward_balances 162 | CREATE TABLE IF NOT EXISTS `sbds_tx_claim_reward_balances` ( 163 | `block_num` int(11) NOT NULL, 164 | `transaction_num` smallint(6) NOT NULL, 165 | `operation_num` smallint(6) NOT NULL, 166 | `timestamp` datetime DEFAULT NULL, 167 | `account` varchar(50) NOT NULL, 168 | `reward_steem` decimal(15,6) DEFAULT NULL, 169 | `reward_sbd` decimal(15,6) DEFAULT NULL, 170 | `reward_vests` decimal(15,6) DEFAULT NULL, 171 | `operation_type` enum('claim_reward_balance') NOT NULL, 172 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 173 | KEY `ix_sbds_tx_claim_reward_balances_operation_type` (`operation_type`), 174 | KEY `ix_sbds_tx_claim_reward_balances_account` (`account`), 175 | KEY `ix_sbds_tx_claim_reward_balances_timestamp` (`timestamp`), 176 | KEY `ix_sbds_tx_claim_reward_balances_block_num` (`block_num`) 177 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 178 | 179 | -- Daten Export vom Benutzer nicht ausgewählt 180 | -- Exportiere Struktur von Tabelle steem.sbds_tx_comments 181 | CREATE TABLE IF NOT EXISTS `sbds_tx_comments` ( 182 | `block_num` int(11) NOT NULL, 183 | `transaction_num` smallint(6) NOT NULL, 184 | `operation_num` smallint(6) NOT NULL, 185 | `timestamp` datetime DEFAULT NULL, 186 | `author` varchar(50) NOT NULL, 187 | `permlink` varchar(512) NOT NULL, 188 | `parent_author` varchar(50) DEFAULT NULL, 189 | `parent_permlink` varchar(512) DEFAULT NULL, 190 | `title` varchar(512) DEFAULT NULL, 191 | `body` text, 192 | `json_metadata` text, 193 | `operation_type` enum('comment') NOT NULL, 194 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 195 | KEY `ix_sbds_tx_comments_block_num` (`block_num`), 196 | KEY `ix_sbds_tx_comments_author` (`author`), 197 | KEY `ix_sbds_tx_comments_permlink` (`permlink`), 198 | KEY `ix_sbds_tx_comments_parent_author` (`parent_author`), 199 | KEY `ix_sbds_tx_comments_timestamp` (`timestamp`), 200 | KEY `ix_sbds_tx_comments_operation_type` (`operation_type`) 201 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 202 | 203 | -- Daten Export vom Benutzer nicht ausgewählt 204 | -- Exportiere Struktur von Tabelle steem.sbds_tx_comments_options 205 | CREATE TABLE IF NOT EXISTS `sbds_tx_comments_options` ( 206 | `block_num` int(11) NOT NULL, 207 | `transaction_num` smallint(6) NOT NULL, 208 | `operation_num` smallint(6) NOT NULL, 209 | `timestamp` datetime DEFAULT NULL, 210 | `author` varchar(50) NOT NULL, 211 | `permlink` varchar(512) NOT NULL, 212 | `max_accepted_payout` decimal(15,6) NOT NULL, 213 | `percent_steem_dollars` int(6) DEFAULT NULL, 214 | `allow_votes` tinyint(1) NOT NULL, 215 | `allow_curation_rewards` tinyint(1) NOT NULL, 216 | `operation_type` enum('comment_options') NOT NULL, 217 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 218 | KEY `ix_sbds_tx_comments_options_timestamp` (`timestamp`), 219 | KEY `ix_sbds_tx_comments_options_operation_type` (`operation_type`), 220 | KEY `ix_sbds_tx_comments_options_block_num` (`block_num`) 221 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 222 | 223 | -- Daten Export vom Benutzer nicht ausgewählt 224 | -- Exportiere Struktur von Tabelle steem.sbds_tx_converts 225 | CREATE TABLE IF NOT EXISTS `sbds_tx_converts` ( 226 | `block_num` int(11) NOT NULL, 227 | `transaction_num` smallint(6) NOT NULL, 228 | `operation_num` smallint(6) NOT NULL, 229 | `timestamp` datetime DEFAULT NULL, 230 | `owner` varchar(50) NOT NULL, 231 | `requestid` bigint(20) NOT NULL, 232 | `amount` decimal(15,6) NOT NULL, 233 | `operation_type` enum('convert') NOT NULL, 234 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 235 | KEY `ix_sbds_tx_converts_timestamp` (`timestamp`), 236 | KEY `ix_sbds_tx_converts_block_num` (`block_num`), 237 | KEY `ix_sbds_tx_converts_operation_type` (`operation_type`) 238 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 239 | 240 | -- Daten Export vom Benutzer nicht ausgewählt 241 | -- Exportiere Struktur von Tabelle steem.sbds_tx_customs 242 | CREATE TABLE IF NOT EXISTS `sbds_tx_customs` ( 243 | `block_num` int(11) NOT NULL, 244 | `transaction_num` smallint(6) NOT NULL, 245 | `operation_num` smallint(6) NOT NULL, 246 | `timestamp` datetime DEFAULT NULL, 247 | `tid` varchar(50) NOT NULL, 248 | `required_auths` varchar(250) DEFAULT NULL, 249 | `data` text, 250 | `operation_type` enum('custom') NOT NULL, 251 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 252 | KEY `ix_sbds_tx_customs_timestamp` (`timestamp`), 253 | KEY `ix_sbds_tx_customs_block_num` (`block_num`), 254 | KEY `ix_sbds_tx_customs_operation_type` (`operation_type`) 255 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 256 | 257 | -- Daten Export vom Benutzer nicht ausgewählt 258 | -- Exportiere Struktur von Tabelle steem.sbds_tx_custom_jsons 259 | CREATE TABLE IF NOT EXISTS `sbds_tx_custom_jsons` ( 260 | `block_num` int(11) NOT NULL, 261 | `transaction_num` smallint(6) NOT NULL, 262 | `operation_num` smallint(6) NOT NULL, 263 | `timestamp` datetime DEFAULT NULL, 264 | `tid` varchar(50) NOT NULL, 265 | `required_auths` varchar(250) DEFAULT NULL, 266 | `required_posting_auths` varchar(250) DEFAULT NULL, 267 | `json` text, 268 | `operation_type` enum('custom_json') NOT NULL, 269 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 270 | KEY `ix_sbds_tx_custom_jsons_timestamp` (`timestamp`), 271 | KEY `ix_sbds_tx_custom_jsons_operation_type` (`operation_type`), 272 | KEY `ix_sbds_tx_custom_jsons_tid` (`tid`), 273 | KEY `ix_sbds_tx_custom_jsons_block_num` (`block_num`) 274 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 275 | 276 | -- Daten Export vom Benutzer nicht ausgewählt 277 | -- Exportiere Struktur von Tabelle steem.sbds_tx_decline_voting_rights 278 | CREATE TABLE IF NOT EXISTS `sbds_tx_decline_voting_rights` ( 279 | `block_num` int(11) NOT NULL, 280 | `transaction_num` smallint(6) NOT NULL, 281 | `operation_num` smallint(6) NOT NULL, 282 | `timestamp` datetime DEFAULT NULL, 283 | `account` varchar(50) NOT NULL, 284 | `decline` tinyint(1) DEFAULT NULL, 285 | `operation_type` enum('decline_voting_rights') NOT NULL, 286 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 287 | KEY `ix_sbds_tx_decline_voting_rights_timestamp` (`timestamp`), 288 | KEY `ix_sbds_tx_decline_voting_rights_block_num` (`block_num`), 289 | KEY `ix_sbds_tx_decline_voting_rights_operation_type` (`operation_type`) 290 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 291 | 292 | -- Daten Export vom Benutzer nicht ausgewählt 293 | -- Exportiere Struktur von Tabelle steem.sbds_tx_delegate_vesting_shares 294 | CREATE TABLE IF NOT EXISTS `sbds_tx_delegate_vesting_shares` ( 295 | `block_num` int(11) NOT NULL, 296 | `transaction_num` smallint(6) NOT NULL, 297 | `operation_num` smallint(6) NOT NULL, 298 | `timestamp` datetime DEFAULT NULL, 299 | `delegator` varchar(50) DEFAULT NULL, 300 | `delegatee` varchar(50) DEFAULT NULL, 301 | `vesting_shares` decimal(15,6) DEFAULT NULL, 302 | `operation_type` enum('delegate_vesting_shares') NOT NULL, 303 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 304 | KEY `ix_sbds_tx_delegate_vesting_shares_block_num` (`block_num`), 305 | KEY `ix_sbds_tx_delegate_vesting_shares_operation_type` (`operation_type`), 306 | KEY `ix_sbds_tx_delegate_vesting_shares_delegatee` (`delegatee`), 307 | KEY `ix_sbds_tx_delegate_vesting_shares_delegator` (`delegator`), 308 | KEY `ix_sbds_tx_delegate_vesting_shares_timestamp` (`timestamp`) 309 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 310 | 311 | -- Daten Export vom Benutzer nicht ausgewählt 312 | -- Exportiere Struktur von Tabelle steem.sbds_tx_delete_comments 313 | CREATE TABLE IF NOT EXISTS `sbds_tx_delete_comments` ( 314 | `block_num` int(11) NOT NULL, 315 | `transaction_num` smallint(6) NOT NULL, 316 | `operation_num` smallint(6) NOT NULL, 317 | `timestamp` datetime DEFAULT NULL, 318 | `author` varchar(50) NOT NULL, 319 | `permlink` varchar(256) NOT NULL, 320 | `operation_type` enum('delete_comment') NOT NULL, 321 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 322 | KEY `ix_sbds_tx_delete_comments_block_num` (`block_num`), 323 | KEY `ix_sbds_tx_delete_comments_operation_type` (`operation_type`), 324 | KEY `ix_sbds_tx_delete_comments_timestamp` (`timestamp`) 325 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 326 | 327 | -- Daten Export vom Benutzer nicht ausgewählt 328 | -- Exportiere Struktur von Tabelle steem.sbds_tx_escrow_approves 329 | CREATE TABLE IF NOT EXISTS `sbds_tx_escrow_approves` ( 330 | `block_num` int(11) NOT NULL, 331 | `transaction_num` smallint(6) NOT NULL, 332 | `operation_num` smallint(6) NOT NULL, 333 | `timestamp` datetime DEFAULT NULL, 334 | `from` varchar(50) DEFAULT NULL, 335 | `agent` varchar(50) DEFAULT NULL, 336 | `to` varchar(50) DEFAULT NULL, 337 | `who` varchar(50) DEFAULT NULL, 338 | `escrow_id` int(11) DEFAULT NULL, 339 | `approve` tinyint(1) DEFAULT NULL, 340 | `operation_type` enum('escrow_approve') NOT NULL, 341 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 342 | KEY `ix_sbds_tx_escrow_approves_operation_type` (`operation_type`), 343 | KEY `ix_sbds_tx_escrow_approves_block_num` (`block_num`), 344 | KEY `ix_sbds_tx_escrow_approves_from` (`from`), 345 | KEY `ix_sbds_tx_escrow_approves_agent` (`agent`), 346 | KEY `ix_sbds_tx_escrow_approves_to` (`to`), 347 | KEY `ix_sbds_tx_escrow_approves_timestamp` (`timestamp`), 348 | KEY `ix_sbds_tx_escrow_approves_who` (`who`) 349 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 350 | 351 | -- Daten Export vom Benutzer nicht ausgewählt 352 | -- Exportiere Struktur von Tabelle steem.sbds_tx_escrow_disputes 353 | CREATE TABLE IF NOT EXISTS `sbds_tx_escrow_disputes` ( 354 | `block_num` int(11) NOT NULL, 355 | `transaction_num` smallint(6) NOT NULL, 356 | `operation_num` smallint(6) NOT NULL, 357 | `timestamp` datetime DEFAULT NULL, 358 | `from` varchar(50) DEFAULT NULL, 359 | `agent` varchar(50) DEFAULT NULL, 360 | `to` varchar(50) DEFAULT NULL, 361 | `who` varchar(50) DEFAULT NULL, 362 | `escrow_id` int(11) DEFAULT NULL, 363 | `approve` tinyint(1) DEFAULT NULL, 364 | `operation_type` enum('escrow_dispute') NOT NULL, 365 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 366 | KEY `ix_sbds_tx_escrow_disputes_operation_type` (`operation_type`), 367 | KEY `ix_sbds_tx_escrow_disputes_block_num` (`block_num`), 368 | KEY `ix_sbds_tx_escrow_disputes_from` (`from`), 369 | KEY `ix_sbds_tx_escrow_disputes_agent` (`agent`), 370 | KEY `ix_sbds_tx_escrow_disputes_to` (`to`), 371 | KEY `ix_sbds_tx_escrow_disputes_timestamp` (`timestamp`), 372 | KEY `ix_sbds_tx_escrow_disputes_who` (`who`) 373 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 374 | 375 | -- Daten Export vom Benutzer nicht ausgewählt 376 | -- Exportiere Struktur von Tabelle steem.sbds_tx_escrow_releases 377 | CREATE TABLE IF NOT EXISTS `sbds_tx_escrow_releases` ( 378 | `block_num` int(11) NOT NULL, 379 | `transaction_num` smallint(6) NOT NULL, 380 | `operation_num` smallint(6) NOT NULL, 381 | `timestamp` datetime DEFAULT NULL, 382 | `from` varchar(50) DEFAULT NULL, 383 | `agent` varchar(50) DEFAULT NULL, 384 | `to` varchar(50) DEFAULT NULL, 385 | `escrow_id` int(11) DEFAULT NULL, 386 | `steem_amount` decimal(15,6) DEFAULT NULL, 387 | `sbd_amount` decimal(15,6) DEFAULT NULL, 388 | `who` varchar(50) DEFAULT NULL, 389 | `receiver` varchar(50) DEFAULT NULL, 390 | `operation_type` enum('escrow_release') NOT NULL, 391 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 392 | KEY `ix_sbds_tx_escrow_releases_to` (`to`), 393 | KEY `ix_sbds_tx_escrow_releases_timestamp` (`timestamp`), 394 | KEY `ix_sbds_tx_escrow_releases_who` (`who`), 395 | KEY `ix_sbds_tx_escrow_releases_receiver` (`receiver`), 396 | KEY `ix_sbds_tx_escrow_releases_block_num` (`block_num`), 397 | KEY `ix_sbds_tx_escrow_releases_from` (`from`), 398 | KEY `ix_sbds_tx_escrow_releases_operation_type` (`operation_type`), 399 | KEY `ix_sbds_tx_escrow_releases_agent` (`agent`) 400 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 401 | 402 | -- Daten Export vom Benutzer nicht ausgewählt 403 | -- Exportiere Struktur von Tabelle steem.sbds_tx_escrow_transfers 404 | CREATE TABLE IF NOT EXISTS `sbds_tx_escrow_transfers` ( 405 | `block_num` int(11) NOT NULL, 406 | `transaction_num` smallint(6) NOT NULL, 407 | `operation_num` smallint(6) NOT NULL, 408 | `timestamp` datetime DEFAULT NULL, 409 | `from` varchar(50) DEFAULT NULL, 410 | `agent` varchar(50) DEFAULT NULL, 411 | `to` varchar(50) DEFAULT NULL, 412 | `escrow_id` int(11) DEFAULT NULL, 413 | `steem_amount` decimal(15,6) DEFAULT NULL, 414 | `sbd_amount` decimal(15,6) DEFAULT NULL, 415 | `json_metadata` text, 416 | `fee_amount` decimal(15,6) DEFAULT NULL, 417 | `fee_amount_symbol` varchar(5) DEFAULT NULL, 418 | `escrow_expiration` datetime DEFAULT NULL, 419 | `ratification_deadline` datetime DEFAULT NULL, 420 | `operation_type` enum('escrow_transfer') NOT NULL, 421 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 422 | KEY `ix_sbds_tx_escrow_transfers_agent` (`agent`), 423 | KEY `ix_sbds_tx_escrow_transfers_to` (`to`), 424 | KEY `ix_sbds_tx_escrow_transfers_timestamp` (`timestamp`), 425 | KEY `ix_sbds_tx_escrow_transfers_escrow_expiration` (`escrow_expiration`), 426 | KEY `ix_sbds_tx_escrow_transfers_operation_type` (`operation_type`), 427 | KEY `ix_sbds_tx_escrow_transfers_ratification_deadline` (`ratification_deadline`), 428 | KEY `ix_sbds_tx_escrow_transfers_block_num` (`block_num`), 429 | KEY `ix_sbds_tx_escrow_transfers_from` (`from`) 430 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 431 | 432 | -- Daten Export vom Benutzer nicht ausgewählt 433 | -- Exportiere Struktur von Tabelle steem.sbds_tx_feed_publishes 434 | CREATE TABLE IF NOT EXISTS `sbds_tx_feed_publishes` ( 435 | `block_num` int(11) NOT NULL, 436 | `transaction_num` smallint(6) NOT NULL, 437 | `operation_num` smallint(6) NOT NULL, 438 | `timestamp` datetime DEFAULT NULL, 439 | `publisher` varchar(50) NOT NULL, 440 | `exchange_rate_base` decimal(15,6) NOT NULL, 441 | `exchange_rate_quote` decimal(15,6) NOT NULL, 442 | `operation_type` enum('feed_publish') NOT NULL, 443 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 444 | KEY `ix_sbds_tx_feed_publishes_block_num` (`block_num`), 445 | KEY `ix_sbds_tx_feed_publishes_operation_type` (`operation_type`), 446 | KEY `ix_sbds_tx_feed_publishes_timestamp` (`timestamp`) 447 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 448 | 449 | -- Daten Export vom Benutzer nicht ausgewählt 450 | -- Exportiere Struktur von Tabelle steem.sbds_tx_limit_order_cancels 451 | CREATE TABLE IF NOT EXISTS `sbds_tx_limit_order_cancels` ( 452 | `block_num` int(11) NOT NULL, 453 | `transaction_num` smallint(6) NOT NULL, 454 | `operation_num` smallint(6) NOT NULL, 455 | `timestamp` datetime DEFAULT NULL, 456 | `owner` varchar(50) NOT NULL, 457 | `orderid` bigint(20) NOT NULL, 458 | `operation_type` enum('limit_order_cancel') NOT NULL, 459 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 460 | KEY `ix_sbds_tx_limit_order_cancels_operation_type` (`operation_type`), 461 | KEY `ix_sbds_tx_limit_order_cancels_timestamp` (`timestamp`), 462 | KEY `ix_sbds_tx_limit_order_cancels_block_num` (`block_num`) 463 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 464 | 465 | -- Daten Export vom Benutzer nicht ausgewählt 466 | -- Exportiere Struktur von Tabelle steem.sbds_tx_limit_order_creates 467 | CREATE TABLE IF NOT EXISTS `sbds_tx_limit_order_creates` ( 468 | `block_num` int(11) NOT NULL, 469 | `transaction_num` smallint(6) NOT NULL, 470 | `operation_num` smallint(6) NOT NULL, 471 | `timestamp` datetime DEFAULT NULL, 472 | `owner` varchar(50) NOT NULL, 473 | `orderid` bigint(20) NOT NULL, 474 | `cancel` tinyint(1) DEFAULT NULL, 475 | `amount_to_sell` decimal(15,6) DEFAULT NULL, 476 | `min_to_receive` decimal(15,6) DEFAULT NULL, 477 | `fill_or_kill` tinyint(1) DEFAULT NULL, 478 | `expiration` datetime DEFAULT NULL, 479 | `operation_type` enum('limit_order_create') NOT NULL, 480 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 481 | KEY `ix_sbds_tx_limit_order_creates_timestamp` (`timestamp`), 482 | KEY `ix_sbds_tx_limit_order_creates_operation_type` (`operation_type`), 483 | KEY `ix_sbds_tx_limit_order_creates_block_num` (`block_num`) 484 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 485 | 486 | -- Daten Export vom Benutzer nicht ausgewählt 487 | -- Exportiere Struktur von Tabelle steem.sbds_tx_pow2s 488 | CREATE TABLE IF NOT EXISTS `sbds_tx_pow2s` ( 489 | `block_num` int(11) NOT NULL, 490 | `transaction_num` smallint(6) NOT NULL, 491 | `operation_num` smallint(6) NOT NULL, 492 | `timestamp` datetime DEFAULT NULL, 493 | `worker_account` varchar(50) NOT NULL, 494 | `block_id` varchar(40) NOT NULL, 495 | `operation_type` enum('pow2') NOT NULL, 496 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 497 | KEY `ix_sbds_tx_pow2s_worker_account` (`worker_account`), 498 | KEY `ix_sbds_tx_pow2s_timestamp` (`timestamp`), 499 | KEY `ix_sbds_tx_pow2s_block_num` (`block_num`), 500 | KEY `ix_sbds_tx_pow2s_operation_type` (`operation_type`) 501 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 502 | 503 | -- Daten Export vom Benutzer nicht ausgewählt 504 | -- Exportiere Struktur von Tabelle steem.sbds_tx_pows 505 | CREATE TABLE IF NOT EXISTS `sbds_tx_pows` ( 506 | `block_num` int(11) NOT NULL, 507 | `transaction_num` smallint(6) NOT NULL, 508 | `operation_num` smallint(6) NOT NULL, 509 | `timestamp` datetime DEFAULT NULL, 510 | `worker_account` varchar(50) NOT NULL, 511 | `block_id` varchar(40) NOT NULL, 512 | `operation_type` enum('pow') NOT NULL, 513 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 514 | KEY `ix_sbds_tx_pows_block_num` (`block_num`), 515 | KEY `ix_sbds_tx_pows_operation_type` (`operation_type`), 516 | KEY `ix_sbds_tx_pows_worker_account` (`worker_account`), 517 | KEY `ix_sbds_tx_pows_timestamp` (`timestamp`) 518 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 519 | 520 | -- Daten Export vom Benutzer nicht ausgewählt 521 | -- Exportiere Struktur von Tabelle steem.sbds_tx_recover_accounts 522 | CREATE TABLE IF NOT EXISTS `sbds_tx_recover_accounts` ( 523 | `block_num` int(11) NOT NULL, 524 | `transaction_num` smallint(6) NOT NULL, 525 | `operation_num` smallint(6) NOT NULL, 526 | `timestamp` datetime DEFAULT NULL, 527 | `recovery_account` varchar(50) DEFAULT NULL, 528 | `account_to_recover` varchar(50) NOT NULL, 529 | `recovered` tinyint(1) DEFAULT NULL, 530 | `operation_type` enum('recover_account') NOT NULL, 531 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 532 | KEY `ix_sbds_tx_recover_accounts_timestamp` (`timestamp`), 533 | KEY `ix_sbds_tx_recover_accounts_block_num` (`block_num`), 534 | KEY `ix_sbds_tx_recover_accounts_operation_type` (`operation_type`) 535 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 536 | 537 | -- Daten Export vom Benutzer nicht ausgewählt 538 | -- Exportiere Struktur von Tabelle steem.sbds_tx_request_account_recoveries 539 | CREATE TABLE IF NOT EXISTS `sbds_tx_request_account_recoveries` ( 540 | `block_num` int(11) NOT NULL, 541 | `transaction_num` smallint(6) NOT NULL, 542 | `operation_num` smallint(6) NOT NULL, 543 | `timestamp` datetime DEFAULT NULL, 544 | `recovery_account` varchar(50) DEFAULT NULL, 545 | `account_to_recover` varchar(50) NOT NULL, 546 | `recovered` tinyint(1) DEFAULT NULL, 547 | `operation_type` enum('request_account_recovery') NOT NULL, 548 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 549 | KEY `ix_sbds_tx_request_account_recoveries_block_num` (`block_num`), 550 | KEY `ix_sbds_tx_request_account_recoveries_operation_type` (`operation_type`), 551 | KEY `ix_sbds_tx_request_account_recoveries_timestamp` (`timestamp`) 552 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 553 | 554 | -- Daten Export vom Benutzer nicht ausgewählt 555 | -- Exportiere Struktur von Tabelle steem.sbds_tx_transfers 556 | CREATE TABLE IF NOT EXISTS `sbds_tx_transfers` ( 557 | `block_num` int(11) NOT NULL, 558 | `transaction_num` smallint(6) NOT NULL, 559 | `operation_num` smallint(6) NOT NULL, 560 | `timestamp` datetime DEFAULT NULL, 561 | `from` varchar(50) DEFAULT NULL, 562 | `to` varchar(50) DEFAULT NULL, 563 | `amount` decimal(15,6) DEFAULT NULL, 564 | `amount_symbol` varchar(5) DEFAULT NULL, 565 | `memo` varchar(2048) DEFAULT NULL, 566 | `operation_type` enum('transfer') NOT NULL, 567 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 568 | KEY `ix_sbds_tx_transfers_timestamp` (`timestamp`), 569 | KEY `ix_sbds_tx_transfers_operation_type` (`operation_type`), 570 | KEY `ix_sbds_tx_transfers_to` (`to`), 571 | KEY `ix_sbds_tx_transfers_from` (`from`), 572 | KEY `ix_sbds_tx_transfers_block_num` (`block_num`) 573 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 574 | 575 | -- Daten Export vom Benutzer nicht ausgewählt 576 | -- Exportiere Struktur von Tabelle steem.sbds_tx_transfer_from_savings 577 | CREATE TABLE IF NOT EXISTS `sbds_tx_transfer_from_savings` ( 578 | `block_num` int(11) NOT NULL, 579 | `transaction_num` smallint(6) NOT NULL, 580 | `operation_num` smallint(6) NOT NULL, 581 | `timestamp` datetime DEFAULT NULL, 582 | `from` varchar(50) DEFAULT NULL, 583 | `to` varchar(50) DEFAULT NULL, 584 | `amount` decimal(15,6) DEFAULT NULL, 585 | `amount_symbol` varchar(5) DEFAULT NULL, 586 | `memo` varchar(2048) DEFAULT NULL, 587 | `request_id` int(11) DEFAULT NULL, 588 | `operation_type` enum('transfer_from_savings') NOT NULL, 589 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 590 | KEY `ix_sbds_tx_transfer_from_savings_to` (`to`), 591 | KEY `ix_sbds_tx_transfer_from_savings_from` (`from`), 592 | KEY `ix_sbds_tx_transfer_from_savings_timestamp` (`timestamp`), 593 | KEY `ix_sbds_tx_transfer_from_savings_block_num` (`block_num`), 594 | KEY `ix_sbds_tx_transfer_from_savings_operation_type` (`operation_type`) 595 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 596 | 597 | -- Daten Export vom Benutzer nicht ausgewählt 598 | -- Exportiere Struktur von Tabelle steem.sbds_tx_transfer_to_savings 599 | CREATE TABLE IF NOT EXISTS `sbds_tx_transfer_to_savings` ( 600 | `block_num` int(11) NOT NULL, 601 | `transaction_num` smallint(6) NOT NULL, 602 | `operation_num` smallint(6) NOT NULL, 603 | `timestamp` datetime DEFAULT NULL, 604 | `from` varchar(50) DEFAULT NULL, 605 | `to` varchar(50) DEFAULT NULL, 606 | `amount` decimal(15,6) DEFAULT NULL, 607 | `amount_symbol` varchar(5) DEFAULT NULL, 608 | `memo` varchar(2048) DEFAULT NULL, 609 | `operation_type` enum('transfer_to_savings') NOT NULL, 610 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 611 | KEY `ix_sbds_tx_transfer_to_savings_operation_type` (`operation_type`), 612 | KEY `ix_sbds_tx_transfer_to_savings_to` (`to`), 613 | KEY `ix_sbds_tx_transfer_to_savings_from` (`from`), 614 | KEY `ix_sbds_tx_transfer_to_savings_timestamp` (`timestamp`), 615 | KEY `ix_sbds_tx_transfer_to_savings_block_num` (`block_num`) 616 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 617 | 618 | -- Daten Export vom Benutzer nicht ausgewählt 619 | -- Exportiere Struktur von Tabelle steem.sbds_tx_transfer_to_vestings 620 | CREATE TABLE IF NOT EXISTS `sbds_tx_transfer_to_vestings` ( 621 | `block_num` int(11) NOT NULL, 622 | `transaction_num` smallint(6) NOT NULL, 623 | `operation_num` smallint(6) NOT NULL, 624 | `timestamp` datetime DEFAULT NULL, 625 | `from` varchar(50) DEFAULT NULL, 626 | `to` varchar(50) DEFAULT NULL, 627 | `amount` decimal(15,6) DEFAULT NULL, 628 | `amount_symbol` varchar(5) DEFAULT NULL, 629 | `operation_type` enum('transfer_to_vesting') NOT NULL, 630 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 631 | KEY `ix_sbds_tx_transfer_to_vestings_timestamp` (`timestamp`), 632 | KEY `ix_sbds_tx_transfer_to_vestings_to` (`to`), 633 | KEY `ix_sbds_tx_transfer_to_vestings_from` (`from`), 634 | KEY `ix_sbds_tx_transfer_to_vestings_block_num` (`block_num`), 635 | KEY `ix_sbds_tx_transfer_to_vestings_operation_type` (`operation_type`) 636 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 637 | 638 | -- Daten Export vom Benutzer nicht ausgewählt 639 | -- Exportiere Struktur von Tabelle steem.sbds_tx_votes 640 | CREATE TABLE IF NOT EXISTS `sbds_tx_votes` ( 641 | `block_num` int(11) NOT NULL, 642 | `transaction_num` smallint(6) NOT NULL, 643 | `operation_num` smallint(6) NOT NULL, 644 | `timestamp` datetime DEFAULT NULL, 645 | `voter` varchar(50) NOT NULL, 646 | `author` varchar(50) NOT NULL, 647 | `permlink` varchar(512) NOT NULL, 648 | `weight` int(11) DEFAULT NULL, 649 | `operation_type` enum('vote') NOT NULL, 650 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 651 | KEY `ix_sbds_tx_votes_block_num` (`block_num`), 652 | KEY `ix_sbds_tx_votes_operation_type` (`operation_type`), 653 | KEY `ix_sbds_tx_votes_author` (`author`), 654 | KEY `ix_sbds_tx_votes_voter` (`voter`), 655 | KEY `ix_sbds_tx_votes_timestamp` (`timestamp`) 656 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 657 | 658 | -- Daten Export vom Benutzer nicht ausgewählt 659 | -- Exportiere Struktur von Tabelle steem.sbds_tx_withdraw_vestings 660 | CREATE TABLE IF NOT EXISTS `sbds_tx_withdraw_vestings` ( 661 | `block_num` int(11) NOT NULL, 662 | `transaction_num` smallint(6) NOT NULL, 663 | `operation_num` smallint(6) NOT NULL, 664 | `timestamp` datetime DEFAULT NULL, 665 | `account` varchar(50) NOT NULL, 666 | `vesting_shares` decimal(25,6) NOT NULL, 667 | `operation_type` enum('withdraw_vesting') NOT NULL, 668 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 669 | KEY `ix_sbds_tx_withdraw_vestings_operation_type` (`operation_type`), 670 | KEY `ix_sbds_tx_withdraw_vestings_timestamp` (`timestamp`), 671 | KEY `ix_sbds_tx_withdraw_vestings_block_num` (`block_num`) 672 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 673 | 674 | -- Daten Export vom Benutzer nicht ausgewählt 675 | -- Exportiere Struktur von Tabelle steem.sbds_tx_withdraw_vesting_routes 676 | CREATE TABLE IF NOT EXISTS `sbds_tx_withdraw_vesting_routes` ( 677 | `block_num` int(11) NOT NULL, 678 | `transaction_num` smallint(6) NOT NULL, 679 | `operation_num` smallint(6) NOT NULL, 680 | `timestamp` datetime DEFAULT NULL, 681 | `from_account` varchar(50) NOT NULL, 682 | `to_account` varchar(50) NOT NULL, 683 | `percent` smallint(6) NOT NULL, 684 | `auto_vest` tinyint(1) DEFAULT NULL, 685 | `operation_type` enum('set_withdraw_vesting_route') NOT NULL, 686 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 687 | KEY `ix_sbds_tx_withdraw_vesting_routes_timestamp` (`timestamp`), 688 | KEY `ix_sbds_tx_withdraw_vesting_routes_operation_type` (`operation_type`), 689 | KEY `ix_sbds_tx_withdraw_vesting_routes_block_num` (`block_num`) 690 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 691 | 692 | -- Daten Export vom Benutzer nicht ausgewählt 693 | -- Exportiere Struktur von Tabelle steem.sbds_tx_witness_updates 694 | CREATE TABLE IF NOT EXISTS `sbds_tx_witness_updates` ( 695 | `block_num` int(11) NOT NULL, 696 | `transaction_num` smallint(6) NOT NULL, 697 | `operation_num` smallint(6) NOT NULL, 698 | `timestamp` datetime DEFAULT NULL, 699 | `owner` varchar(50) NOT NULL, 700 | `url` varchar(250) NOT NULL, 701 | `block_signing_key` varchar(64) NOT NULL, 702 | `props_account_creation_fee` decimal(15,6) NOT NULL, 703 | `props_maximum_block_size` int(11) NOT NULL, 704 | `props_sbd_interest_rate` int(11) NOT NULL, 705 | `fee` decimal(15,6) NOT NULL, 706 | `operation_type` enum('witness_update') NOT NULL, 707 | PRIMARY KEY (`block_num`,`transaction_num`,`operation_num`), 708 | KEY `ix_sbds_tx_witness_updates_block_num` (`block_num`), 709 | KEY `ix_sbds_tx_witness_updates_operation_type` (`operation_type`), 710 | KEY `ix_sbds_tx_witness_updates_timestamp` (`timestamp`) 711 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 712 | 713 | -- Daten Export vom Benutzer nicht ausgewählt 714 | /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; 715 | /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; 716 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 717 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Block.php: -------------------------------------------------------------------------------- 1 | blockNumber = $blockNumber; 61 | } 62 | 63 | // region getter 64 | 65 | /** 66 | * Return the block number 67 | * 68 | * @return mixed 69 | */ 70 | public function getBlockNumber() 71 | { 72 | return $this->blockNumber; 73 | } 74 | 75 | /** 76 | * @return mixed 77 | */ 78 | public function getDateTime() 79 | { 80 | return $this->dateTime; 81 | } 82 | 83 | // endregion 84 | 85 | /** 86 | * Parses the given array into the block object and inserts all data into the database 87 | * 88 | * @param array $blockData 89 | * @throws \Exception 90 | */ 91 | public function parseArray(array $blockData) 92 | { 93 | $this->loadDataFromArray($blockData); 94 | Parser::getDatabase()->getPDO()->beginTransaction(); 95 | 96 | // Insert the raw block data into the database 97 | try { 98 | $this->insertBlockIntoDatabase(); 99 | } catch (\Exception $Exception) { 100 | switch ($Exception->getCode()) { 101 | case 23000: 102 | if (strpos($Exception->getMessage(), "1062 Duplicate entry") !== false) { 103 | Output::warning("Skipped Block ".$this->blockNumber.": Already in Database"); 104 | Parser::getDatabase()->getPDO()->rollBack(); 105 | 106 | return; 107 | } 108 | break; 109 | } 110 | 111 | Output::error("MySql Error -".$Exception->getMessage()."(Code: ".$Exception->getCode().")"); 112 | Parser::getDatabase()->getPDO()->rollBack(); 113 | 114 | return; 115 | } 116 | 117 | // Insert the blocks operations into the database 118 | if (is_array($this->transactions)) { 119 | foreach ($this->transactions as $transactionIndex => $transactionData) { 120 | $transactionNum = $transactionIndex + 1; 121 | $operations = $transactionData['operations']; 122 | 123 | foreach ($operations as $operationIndex => $operationDetails) { 124 | $operationNum = $operationIndex + 1; 125 | $opType = $operationDetails[0]; 126 | $opData = $operationDetails[1]; 127 | 128 | try { 129 | $this->insertOperation($transactionNum, $operationNum, $opType, $opData); 130 | } catch (\Exception $Exception) { 131 | Output::error("MySql Error -".$Exception->getMessage()."(Code: ".$Exception->getCode().")"); 132 | Parser::getDatabase()->getPDO()->rollBack(); 133 | 134 | return; 135 | } 136 | } 137 | } 138 | } 139 | 140 | Parser::getDatabase()->getPDO()->commit(); 141 | } 142 | 143 | /** 144 | * @throws \Exception 145 | */ 146 | public function parseFromBlockChain() 147 | { 148 | Output::info("Parsing Block ".$this->blockNumber); 149 | $this->loadDataFromChain(); 150 | 151 | Parser::getDatabase()->getPDO()->beginTransaction(); 152 | 153 | try { 154 | $this->insertBlockIntoDatabase(); 155 | } catch (\Exception $Exception) { 156 | switch ($Exception->getCode()) { 157 | case 23000: 158 | if (strpos($Exception->getMessage(), "1062 Duplicate entry") !== false) { 159 | Output::warning("Skipped Block ".$this->blockNumber.": Already in Database"); 160 | Parser::getDatabase()->getPDO()->rollBack(); 161 | 162 | return; 163 | } 164 | break; 165 | } 166 | 167 | Output::error("MySql Error -".$Exception->getMessage()."(Code: ".$Exception->getCode().")"); 168 | Parser::getDatabase()->getPDO()->rollBack(); 169 | 170 | return; 171 | } 172 | 173 | foreach ($this->transactions as $transationIndex => $transactionData) { 174 | $transactionNum = $transationIndex + 1; 175 | $operations = $transactionData['operations']; 176 | 177 | foreach ($operations as $operationIndex => $operationDetails) { 178 | $operationNum = $operationIndex + 1; 179 | $opType = $operationDetails[0]; 180 | $opData = $operationDetails[1]; 181 | 182 | try { 183 | $this->insertOperation($transactionNum, $operationNum, $opType, $opData); 184 | } catch (\Exception $Exception) { 185 | Output::error("MySql Error -".$Exception->getMessage()."(Code: ".$Exception->getCode().")"); 186 | Parser::getDatabase()->getPDO()->rollBack(); 187 | 188 | return; 189 | } 190 | } 191 | } 192 | 193 | Parser::getDatabase()->getPDO()->commit(); 194 | } 195 | 196 | /** 197 | * Return, if the block is in the database 198 | */ 199 | public function isBlockInDatabase() 200 | { 201 | // TODO 202 | } 203 | 204 | /** 205 | * Inserts the blocks raw meta data into the database 206 | * 207 | * @throws \Exception 208 | */ 209 | protected function insertBlockIntoDatabase() 210 | { 211 | Parser::getDatabase()->insert("sbds_core_blocks", [ 212 | "raw" => $this->raw, 213 | "block_num" => $this->blockNumber, 214 | "previous" => $this->previous, 215 | "timestamp" => $this->dateTime, 216 | "witness" => $this->witness, 217 | "witness_signature" => $this->witness_signature, 218 | "transaction_merkle_root" => $this->transaction_merkle_root 219 | ]); 220 | } 221 | 222 | /** 223 | * Inserts the given operation into the database 224 | * 225 | * @param $transNum 226 | * @param $opNum 227 | * @param $type 228 | * @param $data 229 | * 230 | * @throws \Exception 231 | */ 232 | protected function insertOperation($transNum, $opNum, $type, $data) 233 | { 234 | try { 235 | $observe = Config::getInstance()->get("observe"); 236 | 237 | if (isset($observe[$type]) && (int)$observe[$type] === 0) { 238 | return; 239 | } 240 | } catch (\Exception $Exception) { 241 | if ($Exception->getCode() !== 404) { 242 | Output::debug($Exception->getTraceAsString()); 243 | } 244 | } 245 | 246 | Output::debug(" Inserting Operation b:{$this->blockNumber} t:{$transNum} o:{$opNum} of type ".$type); 247 | 248 | switch ($type) { 249 | case 'vote': 250 | $Type = new Vote(); 251 | break; 252 | 253 | case 'comment': 254 | $Type = new Comment(); 255 | break; 256 | 257 | case 'claim_reward_balance': 258 | $Type = new ClaimRewardBalance(); 259 | break; 260 | 261 | case 'transfer': 262 | $Type = new Transfer(); 263 | break; 264 | 265 | case 'custom_json': 266 | $Type = new CustomJSON(); 267 | break; 268 | 269 | case 'comment_options': 270 | $Type = new CommentOptions(); 271 | break; 272 | 273 | case 'account_update': 274 | $Type = new AccountUpdate(); 275 | break; 276 | 277 | case 'delete_comment': 278 | $Type = new DeleteComment(); 279 | break; 280 | 281 | case 'transfer_to_vesting': 282 | $Type = new TransferToVesting(); 283 | break; 284 | 285 | case 'limit_order_create': 286 | $Type = new LimitOrderCreate(); 287 | break; 288 | 289 | case 'delegate_vesting_shares': 290 | $Type = new DelegateVestingShares(); 291 | break; 292 | 293 | case 'limit_order_cancel': 294 | $Type = new LimitOrderCancel(); 295 | break; 296 | 297 | case 'feed_publish': 298 | $Type = new FeedPublish(); 299 | break; 300 | 301 | case 'account_create_with_delegation': 302 | $Type = new AccountCreateWithDelegation(); 303 | break; 304 | 305 | case 'account_witness_vote': 306 | $Type = new AccountWitnessVote(); 307 | break; 308 | 309 | case 'convert': 310 | $Type = new Convert(); 311 | break; 312 | 313 | case 'pow': 314 | $Type = new Pow(); 315 | break; 316 | 317 | case 'pow2': 318 | $Type = new Pow2(); 319 | break; 320 | 321 | case 'account_create': 322 | $Type = new AccountCreate(); 323 | break; 324 | 325 | case 'witness_update': 326 | $Type = new WitnessUpdate(); 327 | break; 328 | 329 | case 'set_withdraw_vesting_route': 330 | $Type = new WithdrawVestingRoutes(); 331 | break; 332 | 333 | case 'transfer_to_savings': 334 | $Type = new TransferToSavings(); 335 | break; 336 | 337 | case 'cancel_transfer_from_savings': 338 | $Type = new CancelTransferFromSavings(); 339 | break; 340 | 341 | case 'withdraw_vesting': 342 | $Type = new WithdrawVesting(); 343 | break; 344 | 345 | case 'transfer_from_savings': 346 | $Type = new TransferFromSavings(); 347 | break; 348 | 349 | case 'account_witness_proxy': 350 | $Type = new AccountWitnessProxy(); 351 | break; 352 | 353 | default: 354 | file_put_contents( 355 | dirname(dirname(dirname(dirname(__FILE__))))."/missingOperations.txt", 356 | $type.PHP_EOL, 357 | FILE_APPEND 358 | ); 359 | 360 | Output::warning(" -> Unknown operation type '".$type."' in b:{$this->blockNumber} t:{$transNum} o:{$opNum}"); 361 | 362 | return; 363 | } 364 | 365 | $Type->process($this, $transNum, $opNum, $data); 366 | } 367 | 368 | /** 369 | * Loads the data from the blockchain into the object 370 | * 371 | * @throws \Exception 372 | */ 373 | protected function loadDataFromChain() 374 | { 375 | $RPCClient = new RPCClient(); 376 | $blockData = $RPCClient->execute("get_block", [$this->blockNumber]); 377 | $saveRawBlock = Config::getInstance()->get("block", "save_raw_block"); 378 | 379 | if (isset($saveRawBlock) && (int)$saveRawBlock === 1) { 380 | $this->raw = json_encode($blockData); 381 | } else { 382 | $this->raw = ""; 383 | } 384 | 385 | $this->blockID = $blockData['block_id']; 386 | $this->dateTime = $blockData['timestamp']; 387 | $this->transactions = $blockData['transactions']; 388 | $this->previous = $blockData['previous']; 389 | $this->witness = $blockData['witness']; 390 | $this->witness_signature = $blockData['witness_signature']; 391 | $this->transaction_merkle_root = $blockData['transaction_merkle_root']; 392 | } 393 | 394 | /** 395 | * Loads the data from the given array into the object. 396 | * This can be used for mass imports, when you want to run parallel guzzle requests to enter a lot of blocks simultaneously 397 | * 398 | * @param array $blockData 399 | */ 400 | protected function loadDataFromArray(array $blockData) 401 | { 402 | try { 403 | $saveRawBlock = Config::getInstance()->get("block", "save_raw_block"); 404 | } catch (\Exception $Exception) { 405 | // @todo log error 406 | } 407 | 408 | if (isset($saveRawBlock) && (int)$saveRawBlock === 1) { 409 | $this->raw = json_encode($blockData); 410 | } else { 411 | $this->raw = ""; 412 | } 413 | 414 | $this->blockID = $blockData['block_id']; 415 | $this->dateTime = $blockData['timestamp']; 416 | $this->transactions = $blockData['transactions']; 417 | $this->previous = $blockData['previous']; 418 | $this->witness = $blockData['witness']; 419 | $this->witness_signature = $blockData['witness_signature']; 420 | $this->transaction_merkle_root = $blockData['transaction_merkle_root']; 421 | } 422 | 423 | /** 424 | * Validates the block data. 425 | * Throws an exception if the validation fails 426 | * 427 | * @param array $blockData 428 | * 429 | * 430 | * @return true - Returns true on success. 431 | * @throws \Exception 432 | */ 433 | protected function validateBlockData(array $blockData) 434 | { 435 | if (!is_array($blockData)) { 436 | throw new \Exception("The Blockdata has the wrong format. Expected: array Received ".gettype($blockData)); 437 | } 438 | 439 | if (!isset($blockData['block_id'])) { 440 | throw new \Exception("Missing key in block data: 'block_id'"); 441 | } 442 | 443 | if (!isset($blockData['timestamp'])) { 444 | throw new \Exception("Missing key in block data: 'block_id'"); 445 | } 446 | 447 | if (!isset($blockData['transactions'])) { 448 | throw new \Exception("Missing key in block data: 'block_id'"); 449 | } 450 | 451 | if (!is_array($blockData['transactions'])) { 452 | throw new \Exception("The Transactions have the wrong format. Expected: array Received ".gettype($blockData['transactions'])); 453 | } 454 | 455 | if (!isset($blockData['previous'])) { 456 | throw new \Exception("Missing key in block data: 'block_id'"); 457 | } 458 | 459 | if (!isset($blockData['witness'])) { 460 | throw new \Exception("Missing key in block data: 'block_id'"); 461 | } 462 | 463 | if (!isset($blockData['witness_signature'])) { 464 | throw new \Exception("Missing key in block data: 'block_id'"); 465 | } 466 | 467 | if (!isset($blockData['transaction_merkle_root'])) { 468 | throw new \Exception("Missing key in block data: 'block_id'"); 469 | } 470 | 471 | return true; 472 | } 473 | } 474 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Config.php: -------------------------------------------------------------------------------- 1 | load(); 26 | } 27 | 28 | /** 29 | * Returns the value of the setting in the given section 30 | * 31 | * @param $section 32 | * @param $config - optional 33 | * 34 | * @return mixed 35 | * @throws \Exception 36 | */ 37 | public function get($section, $config = false) 38 | { 39 | if (!isset($this->config[$section])) { 40 | throw new \Exception("Invalid section '".$section."'", 404); 41 | } 42 | 43 | if ($config === false) { 44 | return $this->config[$section]; 45 | } 46 | 47 | if (!isset($this->config[$section][$config])) { 48 | throw new \Exception("Invalid setting '".$config."' in '".$section."'", 404); 49 | } 50 | 51 | return $this->config[$section][$config]; 52 | } 53 | 54 | /** 55 | * Loads the config file into the config field. 56 | * 57 | * @throws \Exception 58 | */ 59 | protected function load() 60 | { 61 | $configFile = dirname(dirname(dirname(dirname(__FILE__))))."/etc/config.ini.php"; 62 | 63 | if (!file_exists($configFile)) { 64 | throw new \Exception("Configfile '".$configFile."' was not found!"); 65 | } 66 | 67 | $config = parse_ini_file($configFile, true); 68 | 69 | if ($config === false) { 70 | throw new \Exception("Error while parsing the config file!"); 71 | } 72 | 73 | $this->config = $config; 74 | } 75 | 76 | /** 77 | * @return Config 78 | * 79 | * @throws \Exception 80 | */ 81 | public static function getInstance() 82 | { 83 | if (is_null(self::$Instance)) { 84 | self::$Instance = new Config(); 85 | } 86 | 87 | return self::$Instance; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Database.php: -------------------------------------------------------------------------------- 1 | "mysql", 27 | "host" => Config::getInstance()->get("database", "host"), 28 | "dbname" => Config::getInstance()->get("database", "dbname"), 29 | "port" => Config::getInstance()->get("database", "port"), 30 | "user" => Config::getInstance()->get("database", "user"), 31 | "password" => Config::getInstance()->get("database", "password"), 32 | ]; 33 | 34 | parent::__construct($attributes); 35 | 36 | $this->setAttribute('options', [ 37 | \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4" 38 | ]); 39 | 40 | $this->PDO = $this->getNewPDO(); 41 | $this->PDO->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Log.php: -------------------------------------------------------------------------------- 1 | self::LEVEL_CRITICAL) { 27 | return; 28 | } 29 | 30 | $msg = self::buildMessage($msg, [ 31 | "timestamp" => self::getTimestamp(), 32 | "level" => "critical" 33 | ]); 34 | 35 | $msg = "\e[91m".$msg."\e[0m"; 36 | 37 | self::writeLn($msg); 38 | } 39 | 40 | /** 41 | * Issues an error message to the output 42 | * 43 | * @param $msg 44 | * @throws \Exception 45 | */ 46 | public static function error($msg) 47 | { 48 | if (self::getConfiguredLoglevel() > self::LEVEL_ERROR) { 49 | return; 50 | } 51 | 52 | $msg = self::buildMessage($msg, [ 53 | "timestamp" => self::getTimestamp(), 54 | "level" => "error" 55 | ]); 56 | 57 | $msg = "\e[91m".$msg."\e[0m"; 58 | 59 | self::writeLn($msg); 60 | } 61 | 62 | /** 63 | * Issues a warning message to the output 64 | * 65 | * @param $msg 66 | * @throws \Exception 67 | */ 68 | public static function warning($msg) 69 | { 70 | if (self::getConfiguredLoglevel() > self::LEVEL_WARNING) { 71 | return; 72 | } 73 | 74 | $msg = self::buildMessage($msg, [ 75 | "timestamp" => self::getTimestamp(), 76 | "level" => "warning" 77 | ]); 78 | 79 | $msg = "\e[93m".$msg."\e[0m"; 80 | 81 | self::writeLn($msg); 82 | } 83 | 84 | /** 85 | * Issues an info message to the output 86 | * 87 | * @param $msg 88 | * @throws \Exception 89 | */ 90 | public static function info($msg) 91 | { 92 | if (self::getConfiguredLoglevel() > self::LEVEL_INFO) { 93 | return; 94 | } 95 | 96 | $msg = self::buildMessage($msg, [ 97 | "timestamp" => self::getTimestamp(), 98 | "level" => "info" 99 | ]); 100 | 101 | $msg = "\e[1;37m".$msg."\e[0m"; 102 | 103 | self::writeLn($msg); 104 | } 105 | 106 | /** 107 | * Issues a debug message to the output 108 | * 109 | * @param $msg 110 | * @throws \Exception 111 | */ 112 | public static function debug($msg) 113 | { 114 | if (self::getConfiguredLoglevel() > self::LEVEL_DEBUG) { 115 | return; 116 | } 117 | 118 | $msg = self::buildMessage($msg, [ 119 | "timestamp" => self::getTimestamp(), 120 | "level" => "debug" 121 | ]); 122 | 123 | self::writeLn($msg); 124 | } 125 | 126 | /** 127 | * Prints one line to the output 128 | * 129 | * @param $msg 130 | */ 131 | protected static function writeLn($msg) 132 | { 133 | echo $msg.PHP_EOL; 134 | } 135 | 136 | /** 137 | * Returns the timestamp from the 138 | * 139 | * @return false|string 140 | */ 141 | protected static function getTimestamp() 142 | { 143 | try { 144 | $format = Config::getInstance()->get("messages", "message_timestamp_format"); 145 | } catch (\Exception $Exception) { 146 | $format = "H:i:s"; 147 | } 148 | 149 | return date($format); 150 | } 151 | 152 | /** 153 | * Builds the message in a unified way. 154 | * Adds timestamps, levels etc 155 | * 156 | * @param $msg 157 | * @param array $params 158 | * 159 | * @return string 160 | */ 161 | protected static function buildMessage($msg, array $params) 162 | { 163 | $timestamp = isset($params['timestamp']) ? $params['timestamp'] : ""; 164 | $level = isset($params['level']) ? $params['level'] : ""; 165 | 166 | $prfx = ""; 167 | 168 | if (!empty($timestamp)) { 169 | $prfx = $timestamp; 170 | } 171 | 172 | if (!empty($level)) { 173 | $prfx = $prfx." | ".str_pad(strtoupper($level), 8, " ", STR_PAD_RIGHT); 174 | } 175 | 176 | return $prfx." - ".$msg; 177 | } 178 | 179 | /** 180 | * Returns the configured output level 181 | * 182 | * @return int 183 | * @throws \Exception 184 | */ 185 | protected static function getConfiguredLoglevel() 186 | { 187 | $configValue = Config::getInstance()->get("messages", "message_level"); 188 | $configValue = trim(strtolower($configValue)); 189 | 190 | switch ($configValue) { 191 | // Debug 192 | case self::LEVEL_DEBUG: 193 | case "debug": 194 | return self::LEVEL_DEBUG; 195 | break; 196 | 197 | // Info 198 | case self::LEVEL_INFO: 199 | case "info": 200 | return self::LEVEL_INFO; 201 | break; 202 | 203 | // Warning 204 | case self::LEVEL_WARNING: 205 | case "warning": 206 | return self::LEVEL_WARNING; 207 | break; 208 | 209 | // Error 210 | case self::LEVEL_ERROR: 211 | case "error": 212 | return self::LEVEL_ERROR; 213 | break; 214 | 215 | // Critical 216 | case self::LEVEL_CRITICAL: 217 | case "critical": 218 | return self::LEVEL_CRITICAL; 219 | break; 220 | 221 | //Default: 222 | default: 223 | return self::LEVEL_INFO; 224 | } 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Parser.php: -------------------------------------------------------------------------------- 1 | RPCClient = new RPCClient(); 29 | 30 | $rpcUrls = Config::getInstance()->get("steem", "rpcurls"); 31 | 32 | foreach ($rpcUrls as $url) { 33 | $this->RPCClients[] = \Graze\GuzzleHttp\JsonRpc\Client::factory($url); 34 | } 35 | 36 | // TODO Test DB connectivity 37 | } 38 | 39 | /** 40 | * @param $blockID 41 | * @throws \Exception 42 | */ 43 | public function parseSingleBlock($blockID) 44 | { 45 | $Block = new Block($blockID); 46 | $Block->parseFromBlockChain(); 47 | } 48 | 49 | /** 50 | * @param $startBlock 51 | * @param $endBlock 52 | */ 53 | public function parseBlockRange($startBlock, $endBlock) 54 | { 55 | } 56 | 57 | /** 58 | * Parses a ranger of blocks asynchronously 59 | * 60 | * @param $startBlockNumber - The blocknumber which should be parsed first 61 | * @param $endBlockNumber - The last block number that should be parsed. If set to false, the end of the blockchain will be used 62 | * @param $concurrentRequestNumber - The amount of concurrent requests that should be sent 63 | * 64 | * @throws \Exception 65 | */ 66 | public function parseBlockRangeAsync($startBlockNumber, $endBlockNumber = false, $concurrentRequestNumber = 4) 67 | { 68 | $endOfBlockchain = false; 69 | 70 | while ($endBlockNumber == false || $startBlockNumber < $endBlockNumber) { 71 | // Select a random node to query data from 72 | $GuzzleRPC = $this->selectRandomClient(); 73 | 74 | if ($endBlockNumber !== false) { 75 | $concurrentRequestNumber = min($endBlockNumber - $startBlockNumber, $concurrentRequestNumber); 76 | } 77 | 78 | Output::info("Requesting Blocks ".$startBlockNumber." - ".($startBlockNumber + $concurrentRequestNumber)); 79 | $Requests = []; 80 | 81 | for ($i = 0; $i < $concurrentRequestNumber; $i++) { 82 | $Requests[] = $GuzzleRPC->request($startBlockNumber, "get_block", [$startBlockNumber]); 83 | $startBlockNumber++; 84 | } 85 | 86 | $Responses = $GuzzleRPC->sendAllAsync($Requests)->wait(true); 87 | 88 | /** @var Response $Response */ 89 | foreach ($Responses as $Response) { 90 | $json = $Response->getBody()->getContents(); 91 | $data = json_decode($json, true); 92 | 93 | $id = $data['id']; 94 | $blockData = []; 95 | 96 | if (isset($data['result'])) { 97 | $blockData = $data['result']; 98 | } 99 | 100 | if (empty($blockData)) { 101 | $endOfBlockchain = $id; 102 | break; 103 | } 104 | 105 | $Block = new Block($id); 106 | $Block->parseArray($blockData); 107 | } 108 | 109 | if ($endOfBlockchain !== false) { 110 | Output::info("Reached end of Blockchain at Blocknumber: ".$endOfBlockchain); 111 | 112 | return; 113 | } 114 | } 115 | } 116 | 117 | /** 118 | * Returns the last block from the database 119 | * 120 | * @return int 121 | */ 122 | public function getLatestBlockFromDatabase() 123 | { 124 | try { 125 | $result = self::getDatabase()->fetch([ 126 | "from" => "sbds_core_blocks", 127 | "limit" => 1, 128 | "order" => [ 129 | "block_num" => "desc" 130 | ] 131 | ]); 132 | } catch (\Exception $Exception) { 133 | return 0; 134 | } 135 | 136 | if (empty($result)) { 137 | return 0; 138 | } 139 | 140 | if (!isset($result[0]['block_num'])) { 141 | return 0; 142 | } 143 | 144 | return (int)$result[0]['block_num']; 145 | } 146 | 147 | /** 148 | * Returns the database handler 149 | * 150 | * @return Database 151 | * @throws \Exception 152 | */ 153 | public static function getDatabase() 154 | { 155 | if (is_null(self::$Database)) { 156 | self::$Database = new Database(); 157 | } 158 | 159 | return self::$Database; 160 | } 161 | 162 | /** 163 | * Selects a random RPC Client. 164 | * Each client will request data from a different RPC Steemit Node 165 | * 166 | * @return \Graze\GuzzleHttp\JsonRpc\Client 167 | */ 168 | protected function selectRandomClient() 169 | { 170 | $index = rand(0, count($this->RPCClients) - 1); 171 | 172 | return $this->RPCClients[$index]; 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/RPCClient.php: -------------------------------------------------------------------------------- 1 | get("steem", "blockchainurl"); 25 | $this->Client = new Client($rpcURL); 26 | } 27 | 28 | /** 29 | * Executes the given function via RPC 30 | * @param $function 31 | * @param $parameter 32 | * 33 | * @return mixed 34 | */ 35 | public function execute($function, $parameter) 36 | { 37 | $result = $this->Client->execute($function, $parameter); 38 | 39 | return $result; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/AbstractType.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_account_creates", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'account_create', 40 | 41 | // Data 42 | "fee" => floatval($data['fee']), 43 | "creator" => $data['creator'], 44 | "new_account_name" => $data['new_account_name'], 45 | "owner_key" => $data['owner']['key_auths'][0][0], 46 | "active_key" => $data['active']['key_auths'][0][0], 47 | "posting_key" => $data['posting']['key_auths'][0][0], 48 | "memo_key" => $data['memo_key'], 49 | "json_metadata" => $data['json_metadata'] 50 | ]); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/AccountCreateWithDelegation.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_account_create_with_delegations", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'account_create_with_delegation', 40 | 41 | // Data 42 | "fee" => floatval($data['fee']), 43 | "delegation" => floatval($data['delegation']), 44 | "creator" => $data['creator'], 45 | "new_account_name" => $data['new_account_name'], 46 | "owner_key" => $data['owner']['key_auths'][0][0], 47 | "active_key" => $data['active']['key_auths'][0][0], 48 | "posting_key" => $data['posting']['key_auths'][0][0], 49 | "memo_key" => $data['memo_key'], 50 | "json_metadata" => $data['json_metadata'] 51 | ]); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/AccountUpdate.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_account_updates", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'account_update', 40 | 41 | // Data 42 | "account" => $data['account'], 43 | "memo_key" => $data['memo_key'], 44 | "json_metadata" => $data['json_metadata'] 45 | ]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/AccountWitnessProxy.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_account_witness_proxies", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'account_witness_proxy', 40 | 41 | // Data 42 | "account" => $data['account'], 43 | "Proxy" => $data['proxy'] 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/AccountWitnessVote.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_account_witness_votes", [ 38 | // Meta 39 | "block_num" => $Block->getBlockNumber(), 40 | "transaction_num" => $transNum, 41 | "operation_num" => $opNum, 42 | "timestamp" => $Block->getDateTime(), 43 | "operation_type" => 'account_witness_vote', 44 | 45 | // Data 46 | "account" => $data['account'], 47 | "witness" => $data['witness'], 48 | "approve" => $data['approve'] 49 | ]); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/CancelTransferFromSavings.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_cancel_transfer_from_savings", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'cancel_transfer_from_savings', 40 | 41 | // Data 42 | "from" => $data['from'], 43 | "request_id" => $data['request_id'] 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/ClaimRewardBalance.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_claim_reward_balances", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'claim_reward_balance', 40 | 41 | // Data 42 | "account" => $data['account'], 43 | "reward_steem" => floatval(str_replace(" STEEM", "", $data['reward_steem'])), 44 | "reward_sbd" => floatval(str_replace(" SBD", "", $data['reward_sbd'])), 45 | "reward_vests" => floatval(str_replace(" VESTS", "", $data['reward_vests'])), 46 | ]); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/Comment.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_comments", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "operation_type" => "comment", 39 | 40 | // Data 41 | "timestamp" => $Block->getDateTime(), 42 | "author" => $data['author'], 43 | "permlink" => $data['permlink'], 44 | "parent_author" => $data['parent_author'], 45 | "parent_permlink" => $data['parent_permlink'], 46 | "title" => $data['title'], 47 | "body" => $data['body'], 48 | "json_metadata" => $data['json_metadata'] 49 | ]); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/CommentOptions.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_comments_options", [ 41 | // Meta 42 | "block_num" => $Block->getBlockNumber(), 43 | "transaction_num" => $transNum, 44 | "operation_num" => $opNum, 45 | "timestamp" => $Block->getDateTime(), 46 | "operation_type" => 'comment_options', 47 | 48 | // Data 49 | "author" => $data['author'], 50 | "permlink" => $data['permlink'], 51 | "max_accepted_payout" => floatval($data['max_accepted_payout']), 52 | "percent_steem_dollars" => $data['percent_steem_dollars'], 53 | "allow_votes" => $data['allow_votes'], 54 | "allow_curation_rewards" => $curationRewards 55 | ]); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/Convert.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_converts", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'convert', 40 | 41 | // Data 42 | "owner" => $data['owner'], 43 | "requestid" => $data['requestid'], 44 | "amount" => floatval($data['amount']) 45 | ]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/CustomJSON.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_custom_jsons", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => "custom_json", 40 | 41 | // Data 42 | "tid" => $data['id'], 43 | "required_auths" => json_encode($data['required_auths']), 44 | "required_posting_auths" => json_encode($data['required_posting_auths']), 45 | "json" => $data['json'] 46 | ]); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/DelegateVestingShares.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_delegate_vesting_shares", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'delegate_vesting_shares', 40 | 41 | // Data 42 | "delegator" => $data['delegator'], 43 | "delegatee" => $data['delegatee'], 44 | "vesting_shares" => floatval($data['vesting_shares']) 45 | ]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/DeleteComment.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_delete_comments", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'delete_comment', 40 | 41 | // Data 42 | "author" => $data['author'], 43 | "permlink" => $data['permlink'] 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/FeedPublish.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_feed_publishes", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'feed_publish', 40 | 41 | // Data 42 | "publisher" => $data['publisher'], 43 | "exchange_rate_base" => floatval($data['exchange_rate']['base']), 44 | "exchange_rate_quote" => floatval($data['exchange_rate']['quote']) 45 | ]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/LimitOrderCancel.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_limit_order_cancels", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'limit_order_cancel', 40 | 41 | // Data 42 | "owner" => $data['owner'], 43 | "orderid" => $data['orderid'] 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/LimitOrderCreate.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_limit_order_creates", [ 40 | // Meta 41 | "block_num" => $Block->getBlockNumber(), 42 | "transaction_num" => $transNum, 43 | "operation_num" => $opNum, 44 | "timestamp" => $Block->getDateTime(), 45 | "operation_type" => 'limit_order_create', 46 | 47 | // Data 48 | "owner" => $data['owner'], 49 | "orderid" => $data['orderid'], 50 | 51 | // TODO Check again for cancel value in limit_order_create 52 | //"cancel" => $data[''], 53 | "amount_to_sell" => floatval($data['amount_to_sell']), 54 | "min_to_receive" => floatval($data['min_to_receive']), 55 | "fill_or_kill" => $fillOrKill, 56 | "expiration" => $data['expiration'] 57 | ]); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/Pow.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_pows", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'pow', 40 | 41 | // Data 42 | "worker_account" => $data['worker_account'], 43 | "block_id" => $data['block_id'] 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/Pow2.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_pow2s", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'pow2', 40 | 41 | // Data 42 | "worker_account" => $data['work'][1]['input']['worker_account'], 43 | "block_id" => $data['work'][1]['input']['nonce'] 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/Transfer.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_transfers", [ 38 | // Meta 39 | "block_num" => $Block->getBlockNumber(), 40 | "transaction_num" => $transNum, 41 | "operation_num" => $opNum, 42 | "timestamp" => $Block->getDateTime(), 43 | "operation_type" => "transfer", 44 | 45 | // Data 46 | "from" => $data['from'], 47 | "to" => $data['to'], 48 | "amount" => floatval($amount), 49 | "amount_symbol" => $currency, 50 | "memo" => $data['memo'] 51 | ]); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/TransferFromSavings.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_transfer_from_savings", [ 41 | // Meta 42 | "block_num" => $Block->getBlockNumber(), 43 | "transaction_num" => $transNum, 44 | "operation_num" => $opNum, 45 | "timestamp" => $Block->getDateTime(), 46 | "operation_type" => 'transfer_from_savings', 47 | 48 | // Data 49 | "from" => $data['from'], 50 | "to" => $data['to'], 51 | "amount" => floatval($amount), 52 | "amount_symbol" => $currency, 53 | "memo" => $data['memo'], 54 | "request_id" => $data['request_id'] 55 | ]); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/TransferToSavings.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_transfer_to_savings", [ 37 | // Meta 38 | "block_num" => $Block->getBlockNumber(), 39 | "transaction_num" => $transNum, 40 | "operation_num" => $opNum, 41 | "timestamp" => $Block->getDateTime(), 42 | "operation_type" => 'transfer_to_savings', 43 | 44 | // Data 45 | "from" => $data['from'], 46 | "to" => $data['to'], 47 | "amount" => floatval($amount), 48 | "amount_symbol" => $currency, 49 | "memo" => $data['memo'] 50 | ]); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/TransferToVesting.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_transfer_to_vestings", [ 37 | // Meta 38 | "block_num" => $Block->getBlockNumber(), 39 | "transaction_num" => $transNum, 40 | "operation_num" => $opNum, 41 | "timestamp" => $Block->getDateTime(), 42 | "operation_type" => 'transfer_to_vesting', 43 | 44 | // Data 45 | "from" => $data['from'], 46 | "to" => $data['to'], 47 | "amount" => floatval($amount), 48 | "amount_symbol" => $currency 49 | ]); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/Vote.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_votes", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "operation_type" => "vote", 39 | 40 | // Data 41 | "timestamp" => $Block->getDateTime(), 42 | "voter" => $data['voter'], 43 | "author" => $data['author'], 44 | "permlink" => $data['permlink'], 45 | "weight" => $data['weight'] 46 | ]); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/WithdrawVesting.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_withdraw_vestings", [ 34 | // Meta 35 | "block_num" => $Block->getBlockNumber(), 36 | "transaction_num" => $transNum, 37 | "operation_num" => $opNum, 38 | "timestamp" => $Block->getDateTime(), 39 | "operation_type" => 'withdraw_vesting', 40 | 41 | // Data 42 | "account" => $data['account'], 43 | "vesting_shares" => floatval($data['vesting_shares']) 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/WithdrawVestingRoutes.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_withdraw_vesting_routes", [ 40 | // Meta 41 | "block_num" => $Block->getBlockNumber(), 42 | "transaction_num" => $transNum, 43 | "operation_num" => $opNum, 44 | "timestamp" => $Block->getDateTime(), 45 | "operation_type" => 'set_withdraw_vesting_route', 46 | 47 | // Data 48 | "from_account" => $data['from_account'], 49 | "to_account" => $data['to_account'], 50 | "percent" => $data['percent'], 51 | "auto_vest" => $autoVest 52 | ]); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/PCSG/SteemBlockchainParser/Types/WitnessUpdate.php: -------------------------------------------------------------------------------- 1 | getDatabase()->insert("sbds_tx_witness_updates", [ 36 | // Meta 37 | "block_num" => $Block->getBlockNumber(), 38 | "transaction_num" => $transNum, 39 | "operation_num" => $opNum, 40 | "timestamp" => $Block->getDateTime(), 41 | "operation_type" => 'witness_update', 42 | 43 | // Data 44 | "owner" => $data['owner'], 45 | "url" => $data['url'], 46 | "block_signing_key" => $data['block_signing_key'], 47 | "props_account_creation_fee" => $amount, 48 | "props_maximum_block_size" => $data['props']['maximum_block_size'], 49 | "props_sbd_interest_rate" => $data['props']['sbd_interest_rate'], 50 | "fee" => floatval($data['fee']) 51 | ]); 52 | } 53 | } 54 | --------------------------------------------------------------------------------