사랑하애오
Published 2022. 1. 28. 15:34
블록체인 Curl 명령어 BlockChain

메모 포스팅

1. Blockchain

Method URL Description
GET /blockchain/blocks Get all blocks
GET /blockchain/blocks/{index} Get block by index
GET /blockchain/blocks/{hash} Get block by hash
GET /blockchain/blocks/latest Get the latest block
PUT /blockchain/blocks/latest Update the latest block
GET /blockchain/blocks/transactions/{transactionId} Get a transaction from some block
GET /blockchain/transactions Get unconfirmed transactions
POST /blockchain/transactions Create a transaction
GET /blockchain/transactions/unspent Get unspent transactions

 

2. Operator

Method URL Description
GET /operator/wallets Get all wallets
POST /operator/wallets Create a wallet from a password
GET /operator/wallets/{walletId} Get wallet by id
GET /operator/wallets/{walletId}/addresses Get all addresses of a wallet
POST /operator/wallets/{walletId}/transactions Create a new transaction
POST /operator/wallets/{walletId}/addresses Create a new address
GET /operator/{addressId}/balance Get the balance of a given address

 

3. Node

Method URL Description
GET /node/peers Get all peers connected to node
POST /node/peers Connects a new peer to node
GET /node/transactions/{transactionId}/confirmations Get how many confirmations a block has

 

4. Miner

Method URL Description
POST /miner/mine Mine a new blockOperatorNodeMiner

 


5.  

6.  

7. Get blockchain

<html />
curl http://localhost:3001/blocks or curl http://localhost:3001/blocks | python3 -m json.tool

 

8. Mine a block

<html />
curl -X POST http://localhost:3001/mineBlock

 

9. Send transaction

<html />
curl -H "Content-type: application/json" --data '{"address": "04bfcab8722991ae774db48f934ca79cfb7dd991229153b9f732ba5334aafcd8e7266e47076996b55a14bf9913ee3145ce0cfc1372ada8ada74bd287450313534b", "amount" : 35}' http://localhost:3001/sendTransaction

 

10. Query transaction pool

<html />
curl http://localhost:3001/transactionPool

 

11. Mine transaction

<html />
curl -H "Content-type: application/json" --data '{"address": "04bfcab8722991ae774db48f934ca79cfb7dd991229153b9f732ba5334aafcd8e7266e47076996b55a14bf9913ee3145ce0cfc1372ada8ada74bd287450313534b", "amount" : 35}' http://localhost:3001/mineTransaction

 

12. Get balance

<html />
curl http://localhost:3001/balance

 

13. Query information about a specific address

<html />
curl http://localhost:3001/address/04f72a4541275aeb4344a8b049bfe2734b49fe25c08d56918f033507b96a61f9e3c330c4fcd46d0854a712dc878b9c280abe90c788c47497e06df78b25bf60ae64

 

14. Add peer

<html />
curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6001"}' http://localhost:3001/addPeer

 

15. Query connected peers

<html />
curl http://localhost:3001/peers

 

 

 

포스팅 같은 메모장

16.  

'BlockChain' 카테고리의 다른 글

블록체인 Smart Contract 입문  (0) 2022.02.08
라이트코인 빌드 중 오류  (0) 2022.01.28
블록체인 라이트코인 빌드  (0) 2022.01.24
블록체인 bitcoin build하기(WSL)  (0) 2022.01.04
C++ basic build on Linux(Ubuntu(WSL))  (0) 2022.01.03
profile

사랑하애오

@사랑하애

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!