github.com/igggame/nebulas-go@v2.1.0+incompatible/rpc/pb/rpc.proto (about) 1 // Copyright (C) 2017 go-nebulas authors 2 // 3 // This file is part of the go-nebulas library. 4 // 5 // the go-nebulas library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // the go-nebulas library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>. 17 // 18 19 //The protobuf golang code is generated with protoc-gen-gogo v1.0.0 20 21 syntax = "proto3"; 22 23 import "google/api/annotations.proto"; 24 import "github.com/nebulasio/go-nebulas/consensus/pb/state.proto"; 25 import "github.com/nebulasio/go-nebulas/neblet/pb/config.proto"; 26 27 package rpcpb; 28 29 // RPC API interface. 30 service ApiService { 31 // Return the state of the neb. 32 rpc GetNebState (NonParamsRequest) returns (GetNebStateResponse) { 33 option (google.api.http) = { 34 get: "/v1/user/nebstate" 35 }; 36 } 37 38 // Return the latest irreversible block. 39 rpc LatestIrreversibleBlock (NonParamsRequest) returns (BlockResponse) { 40 option (google.api.http) = { 41 get: "/v1/user/lib" 42 }; 43 } 44 45 // Return the state of the account. 46 rpc GetAccountState (GetAccountStateRequest) returns (GetAccountStateResponse) { 47 option (google.api.http) = { 48 post: "/v1/user/accountstate" 49 body: "*" 50 }; 51 } 52 53 // Call transaction 54 rpc Call (TransactionRequest) returns (CallResponse) { 55 option (google.api.http) = { 56 post: "/v1/user/call" 57 body: "*" 58 }; 59 } 60 61 // Submit the signed transaction. 62 rpc SendRawTransaction (SendRawTransactionRequest) returns (SendTransactionResponse) { 63 option (google.api.http) = { 64 post: "/v1/user/rawtransaction" 65 body: "*" 66 }; 67 } 68 69 // Get block info by the block hash. 70 rpc GetBlockByHash (GetBlockByHashRequest) returns (BlockResponse) { 71 option (google.api.http) = { 72 post: "/v1/user/getBlockByHash" 73 body: "*" 74 }; 75 } 76 77 // Get block info by the block height. 78 rpc GetBlockByHeight (GetBlockByHeightRequest) returns (BlockResponse) { 79 option (google.api.http) = { 80 post: "/v1/user/getBlockByHeight" 81 body: "*" 82 }; 83 } 84 85 // Get transactionReceipt info by tansaction hash. 86 rpc GetTransactionReceipt (GetTransactionByHashRequest) returns (TransactionResponse) { 87 option (google.api.http) = { 88 post: "/v1/user/getTransactionReceipt" 89 body: "*" 90 }; 91 } 92 93 // Get transactionReceipt info by tansaction hash. 94 rpc GetTransactionByContract (GetTransactionByContractRequest) returns (TransactionResponse) { 95 option (google.api.http) = { 96 post: "/v1/user/getTransactionByContract" 97 body: "*" 98 }; 99 } 100 101 // Subscribe message 102 rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse) { 103 option (google.api.http) = { 104 post: "/v1/user/subscribe" 105 body: "*" 106 }; 107 } 108 109 // Get GasPrice 110 rpc GetGasPrice(NonParamsRequest) returns (GasPriceResponse) { 111 option (google.api.http) = { 112 get: "/v1/user/getGasPrice" 113 }; 114 } 115 116 // EstimateGas 117 rpc EstimateGas(TransactionRequest) returns (GasResponse) { 118 option (google.api.http) = { 119 post: "/v1/user/estimateGas" 120 body: "*" 121 }; 122 } 123 124 rpc GetEventsByHash(HashRequest) returns (EventsResponse) { 125 option (google.api.http) = { 126 post: "/v1/user/getEventsByHash" 127 body: "*" 128 }; 129 } 130 131 rpc GetDynasty (ByBlockHeightRequest) returns (GetDynastyResponse) { 132 option (google.api.http) = { 133 post: "/v1/user/dynasty" 134 body: "*" 135 }; 136 } 137 138 // Verify Signature. 139 rpc VerifySignature (VerifySignatureRequest) returns (VerifySignatureResponse) { 140 option (google.api.http) = { 141 post: "/v1/user/verifySignature" 142 body: "*" 143 }; 144 } 145 } 146 147 service AdminService { 148 // Accounts return account list. 149 rpc Accounts (NonParamsRequest) returns (AccountsResponse) { 150 option (google.api.http) = { 151 get: "/v1/admin/accounts" 152 }; 153 } 154 155 // NewAccount create a new account with passphrase 156 rpc NewAccount(NewAccountRequest) returns (NewAccountResponse) { 157 option (google.api.http) = { 158 post: "/v1/admin/account/new" 159 body: "*" 160 }; 161 } 162 163 // UnlockAccount unlock account with passphrase 164 rpc UnlockAccount(UnlockAccountRequest) returns (UnlockAccountResponse) { 165 option (google.api.http) = { 166 post: "/v1/admin/account/unlock" 167 body: "*" 168 }; 169 } 170 171 // LockAccount lock account 172 rpc LockAccount(LockAccountRequest) returns (LockAccountResponse) { 173 option (google.api.http) = { 174 post: "/v1/admin/account/lock" 175 body: "*" 176 }; 177 } 178 179 // Verify, sign, and send the transaction. 180 rpc SendTransaction (TransactionRequest) returns (SendTransactionResponse) { 181 option (google.api.http) = { 182 post: "/v1/admin/transaction" 183 body: "*" 184 }; 185 } 186 187 // Sign sign msg 188 rpc SignHash(SignHashRequest) returns (SignHashResponse) { 189 option (google.api.http) = { 190 post: "/v1/admin/sign/hash" 191 body: "*" 192 }; 193 } 194 195 rpc GenerateRandomSeed(GenerateRandomSeedRequest) returns (GenerateRandomSeedResponse) { 196 option (google.api.http) = { 197 post: "/v1/admin/generateRandomSeed" 198 body: "*" 199 }; 200 } 201 202 // Sign sign transaction 203 rpc SignTransactionWithPassphrase(SignTransactionPassphraseRequest) returns (SignTransactionPassphraseResponse) { 204 option (google.api.http) = { 205 post: "/v1/admin/sign" 206 body: "*" 207 }; 208 } 209 210 // SendTransactionWithPassphrase send transaction with passphrase 211 rpc SendTransactionWithPassphrase(SendTransactionPassphraseRequest) returns (SendTransactionResponse) { 212 option (google.api.http) = { 213 post: "/v1/admin/transactionWithPassphrase" 214 body: "*" 215 }; 216 } 217 218 rpc StartPprof (PprofRequest) returns (PprofResponse) { 219 option (google.api.http) = { 220 post: "/v1/admin/pprof" 221 body: "*" 222 }; 223 } 224 225 //Get Config 226 rpc GetConfig (NonParamsRequest) returns (GetConfigResponse) { 227 option (google.api.http) = { 228 get: "/v1/admin/getConfig" 229 }; 230 231 } 232 233 // Return the p2p node info. 234 rpc NodeInfo (NonParamsRequest) returns (NodeInfoResponse) { 235 option (google.api.http) = { 236 get: "/v1/admin/nodeinfo" 237 }; 238 } 239 } 240 241 // Request message of Subscribe rpc 242 message SubscribeRequest { 243 repeated string topics = 1; 244 } 245 246 // Request message of Subscribe rpc 247 message SubscribeResponse { 248 string topic = 1; 249 string data = 2; 250 } 251 252 // Request message of non params. 253 message NonParamsRequest { 254 } 255 256 // Response message of node info. 257 message NodeInfoResponse { 258 // the node ID. 259 string id = 1; 260 261 // the block chainID. 262 uint32 chain_id = 2; 263 264 // coinbase 265 string coinbase = 3; 266 267 // Number of peers currenly connected. 268 uint32 peer_count = 4; 269 270 // the node synchronized status. 271 bool synchronized = 5; 272 273 // the node route table bucket size. 274 int32 bucket_size = 6; 275 276 // the network protocol version. 277 string protocol_version = 10; 278 279 repeated RouteTable route_table = 11; 280 } 281 282 283 message RouteTable { 284 string id = 1; 285 repeated string address = 2; 286 } 287 288 // Response message of GetNebState rpc. 289 message GetNebStateResponse { 290 291 // Block chain id 292 uint32 chain_id = 1; 293 294 // Current neb tail hash 295 string tail = 2; 296 297 // Current neb lib hash 298 string lib = 3; 299 300 // Current neb tail block height 301 uint64 height = 4; 302 303 // The current neb protocol version. 304 string protocol_version = 6; 305 306 // The peer sync status. 307 bool synchronized = 7; 308 309 // neb version 310 string version = 8; 311 } 312 313 // Response message of Accounts rpc. 314 message AccountsResponse { 315 // Account list 316 repeated string addresses = 1; 317 } 318 319 // Request message of GetAccountState rpc. 320 message GetAccountStateRequest { 321 // Hex string of the account addresss. 322 string address = 1; 323 324 // block account state with height. If not specified, use 0 as tail height. 325 uint64 height = 2; 326 } 327 328 // Response message of GetAccountState rpc. 329 message GetAccountStateResponse { 330 // Current balance in unit of 1/(10^18) nas. 331 string balance = 1; // uint128, len=16 332 333 // Current transaction count. 334 uint64 nonce = 2; 335 336 // Account type 337 uint32 type = 3; 338 339 // Block height 340 uint64 height = 4; 341 342 // Current sender pending tx count 343 uint64 pending = 5; 344 } 345 346 // Response message of Call rpc. 347 message CallResponse { 348 // result of smart contract method call. 349 string result = 1; 350 351 //execute error 352 string execute_err = 2; 353 354 //estimate gas used 355 string estimate_gas = 3; 356 } 357 358 // ByBlockHeightRequest message 359 message ByBlockHeightRequest { 360 uint64 height = 1; 361 } 362 363 // Response message of GetDynastyRequest rpc 364 message GetDynastyResponse { 365 repeated string miners = 1; 366 } 367 368 // Request message of SendTransaction rpc. 369 message TransactionRequest { 370 // Hex string of the sender account addresss. 371 string from = 1; 372 373 // Hex string of the receiver account addresss. 374 string to = 2; 375 376 // Amount of value sending with this transaction. 377 string value = 3; // uint128, len=16 378 379 // Transaction nonce. 380 uint64 nonce = 4; 381 382 // gasPrice sending with this transaction. 383 string gas_price = 5; // uint128, len=16 384 385 // gasLimit sending with this transaction. 386 string gas_limit = 6; // uint128, len=16 387 388 // contract sending with this transaction 389 ContractRequest contract = 7; 390 391 // binary data for transaction 392 bytes binary = 10; 393 394 // protocol data for transaction 395 bytes protocol = 11; 396 397 // transaction payload type, enum:binary, deploy, call, protocol 398 string type = 20; 399 } 400 401 message ContractRequest { 402 // contract source code. 403 string source = 1; 404 405 // contract source type, support javascript and typescript 406 string source_type = 2; 407 408 // call contract function name 409 string function = 3; 410 411 // the params of contract. 412 string args = 4; 413 } 414 415 // Request message of SendRawTransactionRequest rpc. 416 message SendRawTransactionRequest { 417 418 // Signed data of transaction 419 bytes data = 1; 420 } 421 422 // Response message of SendTransaction rpc. 423 message SendTransactionResponse { 424 // Hex string of transaction hash. 425 string txhash = 1; 426 427 // Hex string of contract address if transaction is deploy type 428 string contract_address = 2; 429 } 430 431 // Request message of GetBlockByHash rpc. 432 message GetBlockByHashRequest { 433 // Hex string of block hash. 434 string hash = 1; 435 436 // If true it returns the full transaction objects, if false only the hashes of the transactions. 437 bool full_fill_transaction = 2; 438 } 439 440 // Request message of GetBlockByHeight rpc. 441 message GetBlockByHeightRequest { 442 // block height. 443 uint64 height = 1; 444 445 // If true it returns the full transaction objects, if false only the hashes of the transactions. 446 bool full_fill_transaction = 2; 447 } 448 449 // Request message of GetTransactionByHash rpc. 450 message GetTransactionByHashRequest { 451 // Hex string of transaction hash. 452 string hash = 1; 453 } 454 455 // Request message of GetTransactionByContract rpc. 456 message GetTransactionByContractRequest { 457 // string of contract address. 458 string address = 1; 459 } 460 461 // Response message of Block. 462 message BlockResponse { 463 464 // Hex string of block hash. 465 string hash = 1; 466 467 // Hex string of block parent hash. 468 string parent_hash = 2; 469 470 // block height 471 uint64 height = 3; 472 473 // block nonce 474 uint64 nonce = 4; 475 476 // Hex string of coinbase address. 477 string coinbase = 5; 478 479 // block timestamp. 480 int64 timestamp = 6; 481 482 // block chain id 483 uint32 chain_id = 7; 484 485 // Hex string of state root. 486 string state_root = 8; 487 488 // Hex string of txs root. 489 string txs_root = 9; 490 491 // Hex string of event root. 492 string events_root = 10; 493 494 // Hex string of consensus root. 495 consensuspb.ConsensusRoot consensus_root = 11; 496 497 // Miner 498 string miner = 12; 499 500 // Random seed 501 string randomSeed = 13; 502 503 // Random proof 504 string randomProof = 14; 505 506 // is finaliy 507 bool is_finality = 15; 508 509 // transaction slice 510 repeated TransactionResponse transactions = 100; 511 } 512 513 // Response message of TransactionReceipt. 514 message TransactionResponse { 515 516 // Hex string of tx hash. 517 string hash = 1; 518 519 uint32 chainId = 2; 520 521 // Hex string of the sender account addresss. 522 string from = 3; 523 524 // Hex string of the receiver account addresss. 525 string to = 4; 526 527 string value = 5; 528 529 // Transaction nonce. 530 uint64 nonce = 6; 531 532 int64 timestamp = 7; 533 534 string type = 8; 535 536 bytes data = 9; 537 538 string gas_price = 10; 539 540 string gas_limit = 11; 541 542 string contract_address = 12; 543 544 // transaction status 0 failed, 1 success, 2 pending 545 int32 status = 13; 546 547 // transaction gas used 548 string gas_used = 14; 549 550 // contract execute error 551 string execute_error = 15; 552 553 // contract execute result 554 string execute_result = 16; 555 556 // transaction's block height 557 uint64 block_height = 17; 558 } 559 560 message NewAccountRequest { 561 string passphrase = 1; 562 } 563 564 message NewAccountResponse { 565 string address = 1; 566 } 567 568 message UnlockAccountRequest { 569 string address = 1; 570 string passphrase = 2; 571 uint64 duration = 3; 572 } 573 574 message UnlockAccountResponse { 575 bool result = 1; 576 } 577 578 message LockAccountRequest { 579 string address = 1; 580 } 581 582 message LockAccountResponse { 583 bool result = 1; 584 } 585 586 message SignHashRequest { 587 588 // sign address 589 string address = 1; 590 591 // sign msg 592 bytes hash = 2; 593 594 // sign algorithm 595 uint32 alg = 3; 596 } 597 598 message SignHashResponse { 599 bytes data = 1; 600 } 601 602 message GenerateRandomSeedRequest { 603 // miner address 604 string address = 1; 605 // parent seed of new block 606 bytes parent_seed = 2; 607 // hash of new block's ancestor 608 bytes ancestor_hash = 3; 609 } 610 611 message GenerateRandomSeedResponse { 612 bytes vrf_seed = 1; 613 bytes vrf_proof = 2; 614 } 615 616 message SignTransactionPassphraseRequest { 617 // transaction struct 618 TransactionRequest transaction = 1; 619 620 // from account passphrase 621 string passphrase = 2; 622 } 623 624 message SignTransactionPassphraseResponse { 625 bytes data = 1; 626 } 627 628 message SendTransactionPassphraseRequest { 629 // transaction struct 630 TransactionRequest transaction = 1; 631 632 // from account passphrase 633 string passphrase = 2; 634 } 635 636 message GasPriceResponse { 637 string gas_price = 1; 638 } 639 640 // Request message of GetTransactionByHash rpc. 641 message HashRequest { 642 // Hex string of block/transaction hash. 643 string hash = 1; 644 } 645 646 message GasResponse { 647 string gas = 1; 648 string err = 2; 649 } 650 651 message EventsResponse { 652 repeated Event events = 1; 653 } 654 655 message Event { 656 string topic = 1; 657 string data = 2; 658 } 659 660 message PprofRequest { 661 string listen = 1; 662 } 663 664 message PprofResponse { 665 bool result = 1; 666 } 667 668 message GetConfigResponse { 669 // Config 670 nebletpb.Config config = 1; 671 } 672 673 message VerifySignatureRequest { 674 string msg = 1; 675 string signature = 2; 676 string address = 3; 677 uint32 alg = 4; 678 } 679 680 message VerifySignatureResponse { 681 bool result = 1; 682 string address = 2; 683 } 684 685 message GetNRByAddressRequest { 686 // nr address 687 string address = 1; 688 } 689 690 message GetNRHandleRequest { 691 // start block height of nr calculate interval 692 uint64 start = 1; 693 694 // end block height of nr calculate interval. If not specified, use 0 as tail height. 695 uint64 end = 2; 696 697 // nr version 698 uint64 version = 3; 699 } 700 701 message GetNRHandleResponse { 702 string handle = 1; 703 } 704 705 message GetNRListByHandleRequest { 706 // nr handle 707 string handle = 1; 708 } 709 710 message GetNRListResponse { 711 712 // nr algorithm version 713 uint64 version = 1; 714 715 // start block height of nr calculate interval 716 uint64 start = 2; 717 718 // end block height of nr calculate interval. If not specified, use 0 as tail height. 719 uint64 end = 3; 720 721 // nr data list 722 repeated NRItem data = 4; 723 } 724 725 message NRItem { 726 // nr address 727 string address = 1; 728 729 // score of nr. 730 string score = 2; 731 732 string median = 3; 733 734 string weight = 4; 735 } 736 737 message GetDIPListRequest { 738 // height 739 uint64 height = 1; 740 } 741 742 message GetDIPListResponse { 743 // dip algorithm version 744 uint64 version = 1; 745 746 // start block height of dip calculate interval 747 uint64 start = 2; 748 749 // end block height of dip calculate interval. 750 uint64 end = 3; 751 752 // dip data list 753 repeated DIPItem data = 4; 754 } 755 756 message DIPItem { 757 // dip address 758 string address = 1; 759 760 // dip contract address 761 string contract = 2; 762 763 // value of dip reward. 764 string value = 3; 765 }