Skip to content

Commit

Permalink
Merge pull request #116 from ElrondNetwork/development
Browse files Browse the repository at this point in the history
Merge Development into Main
  • Loading branch information
andreibancioiu authored Dec 17, 2020
2 parents 271ab18 + 0bff8b4 commit 0f88dd9
Show file tree
Hide file tree
Showing 120 changed files with 5,276 additions and 1,764 deletions.
5 changes: 3 additions & 2 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ COPY . .
# Proxy
WORKDIR /elrond/cmd/proxy
RUN go build
# $(ls /go/pkg/mod/github.com/!elrond!network/ | grep arwen-wasm-vm | sed 's/.* //' | head -1) this command is required to be able to extract the full name of the directory that starts with 'arwen-wasm-wm'
RUN cp /go/pkg/mod/github.com/!elrond!network/$(ls /go/pkg/mod/github.com/!elrond!network/ | grep arwen-wasm-vm | sed 's/.* //' | head -1)/wasmer/libwasmer_linux_amd64.so /lib/libwasmer_linux_amd64.so

# ===== SECOND STAGE ======
FROM ubuntu:18.04
COPY --from=builder /elrond/cmd/proxy /elrond/cmd/proxy
##Config the proxy config.toml file
#Mount /data/config/
COPY --from=builder "/lib/libwasmer_linux_amd64.so" "/lib/libwasmer_linux_amd64.so"

WORKDIR /elrond/cmd/proxy/
EXPOSE 8079
Expand Down
79 changes: 48 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,78 @@ For more details, go to [docs.elrond.com](https://docs.elrond.com/sdk-and-tools/

## Rest API endpoints

# V1.0

### address

- `/address/:address` (GET) --> returns the account's data in JSON format for the given :address.
- `/address/:address/balance` (GET) --> returns the balance of a given :address.
- `/address/:address/nonce` (GET) --> returns the nonce of an :address.
- `/address/:address/shard` (GET) --> returns the shard of an :address based on current proxy's configuration.
- `/address/:address/storage/:key` (GET) --> returns the value for a given key for an account.
- `/address/:address/transactions` (GET) --> returns the transactions stored in indexer for a given :address.
- `/v1.0/address/:address` (GET) --> returns the account's data in JSON format for the given :address.
- `/v1.0/address/:address/balance` (GET) --> returns the balance of a given :address.
- `/v1.0/address/:address/nonce` (GET) --> returns the nonce of an :address.
- `/v1.0/address/:address/shard` (GET) --> returns the shard of an :address based on current proxy's configuration.
- `/v1.0/address/:address/storage/:key` (GET) --> returns the value for a given key for an account.
- `/v1.0/address/:address/transactions` (GET) --> returns the transactions stored in indexer for a given :address.
- `/v1.0/address/:address/esdt` (GET) --> returns the account's ESDT tokens list for the given :address.
- `/v1.0/address/:address/esdt/:tokenIdentifier` (GET) --> returns the token data for a given :address and ESDT token, such as balance and properties

### transaction

- `/transaction/send` (POST) --> receives a single transaction in JSON format and forwards it to an observer in the same shard as the sender's shard ID. Returns the transaction's hash if successful or the interceptor error otherwise.
- `/transaction/simulate` (POST) --> same as /transaction/send but does not execute it. will output simulation results
- `/transaction/send-multiple` (POST) --> receives a bulk of transactions in JSON format and will forward them to observers in the rights shards. Will return the number of transactions which were accepted by the interceptor and forwarded on the p2p topic.
- `/transaction/send-user-funds` (POST) --> receives a request containing `address`, `numOfTxs` and `value` and will select a random account from the PEM file in the same shard as the address received. Will return the transaction's hash if successful or the interceptor error otherwise.
- `/transaction/cost` (POST) --> receives a single transaction in JSON format and returns it's cost
- `/transaction/:txHash` (GET) --> returns the transaction which corresponds to the hash
- `/transaction/:txHash?sender=senderAddress` (GET) --> returns the transaction which corresponds to the hash (faster because will ask for transaction from observer which is in the shard in which the address is part)
- `/transaction/:txHash/status` (GET) --> returns the status of the transaction which corresponds to the hash
- `/transaction/:txHash/status?sender=senderAddress` (GET) --> returns the status of the transaction which corresponds to the hash (faster because will ask for transaction status from observer which is in the shard in which the address is part)
- `/v1.0/transaction/send` (POST) --> receives a single transaction in JSON format and forwards it to an observer in the same shard as the sender's shard ID. Returns the transaction's hash if successful or the interceptor error otherwise.
- `/v1.0/transaction/simulate` (POST) --> same as /transaction/send but does not execute it. will output simulation results
- `/v1.0/transaction/send-multiple` (POST) --> receives a bulk of transactions in JSON format and will forward them to observers in the rights shards. Will return the number of transactions which were accepted by the interceptor and forwarded on the p2p topic.
- `/v1.0/transaction/send-user-funds` (POST) --> receives a request containing `address`, `numOfTxs` and `value` and will select a random account from the PEM file in the same shard as the address received. Will return the transaction's hash if successful or the interceptor error otherwise.
- `/v1.0/transaction/cost` (POST) --> receives a single transaction in JSON format and returns it's cost
- `/v1.0/transaction/:txHash` (GET) --> returns the transaction which corresponds to the hash
- `/v1.0/transaction/:txHash?withResults=true` (GET) --> returns the transaction and results which correspond to the hash
- `/v1.0/transaction/:txHash?sender=senderAddress` (GET) --> returns the transaction which corresponds to the hash (faster because will ask for transaction from the observer which is in the shard in which the address is part).
- `/v1.0/transaction/:txHash?sender=senderAddress&withResults=true` (GET) --> returns the transaction and results which correspond to the hash (faster because will ask for transaction from observer which is in the shard in which the address is part)
- `/v1.0/transaction/:txHash/status` (GET) --> returns the status of the transaction which corresponds to the hash
- `/v1.0/transaction/:txHash/status?sender=senderAddress` (GET) --> returns the status of the transaction which corresponds to the hash (faster because will ask for transaction status from the observer which is in the shard in which the address is part).

### vm-values

- `/vm-values/hex` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query in hex encoded string format
- `/vm-values/string` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query in string format
- `/vm-values/int` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query in integer format
- `/vm-values/query` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query
- `/v1.0/vm-values/hex` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query in hex encoded string format
- `/v1.0/vm-values/string` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query in string format
- `/v1.0/vm-values/int` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query in integer format
- `/v1.0/vm-values/query` (POST) --> receives a VM Request (`scAddress` string, `funcName` string and `args` []string) and returns the result of the VM Query

### network

- `/network/status/:shard` (GET) --> returns the status metrics from an observer in the given shard
- `/network/config` (GET) --> returns the configuration of the network from any observer
- `/network/economics` (GET) --> returns the economics data metric from the last epoch
- `/v1.0/network/status/:shard` (GET) --> returns the status metrics from an observer in the given shard
- `/v1.0/network/config` (GET) --> returns the configuration of the network from any observer
- `/v1.0/network/economics` (GET) --> returns the economics data metric from the last epoch

### node

- `/node/heartbeatstatus` (GET) --> returns the heartbeat data from an observer from any shard. Has a cache to avoid many requests
- `/v1.0/node/heartbeatstatus` (GET) --> returns the heartbeat data from an observer from any shard. Has a cache to avoid many requests

### validator

- `/validator/statistics` (GET) --> returns the validator statistics data from an observer from any shard. Has a cache to avoid many requests
- `/v1.0/validator/statistics` (GET) --> returns the validator statistics data from an observer from any shard. Has a cache to avoid many requests

### block

- `/block/:shardID/by-nonce/:nonce` (GET) --> returns a block by nonce
- `/block/:shardID/by-nonce/:nonce?withTxs=true` (GET) --> returns a block by nonce, with transactions included
- `/block/:shardID/by-hash/:hash` (GET) --> returns a block by hash
- `/block/:shardID/by-hash/:hash?withTxs=true` (GET) --> returns a block by hash, with transactions included
- `/v1.0/block/:shardID/by-nonce/:nonce` (GET) --> returns a block by nonce
- `/v1.0/block/:shardID/by-nonce/:nonce?withTxs=true` (GET) --> returns a block by nonce, with transactions included
- `/v1.0/block/:shardID/by-hash/:hash` (GET) --> returns a block by hash
- `/v1.0/block/:shardID/by-hash/:hash?withTxs=true` (GET) --> returns a block by hash, with transactions included

### block-atlas

- `block-atlas/:shard/:nonce` (GET) --> returns a block by nonce, as required by Block Atlas
- `/v1.0/block-atlas/:shard/:nonce` (GET) --> returns a block by nonce, as required by Block Atlas


### hyperblock

- `hyperblock/by-nonce/:nonce` (GET) --> returns a hyperblock by nonce, with transactions included
- `hyperblock/by-hash/:hash` (GET) --> returns a hyperblock by hash, with transactions included
- `/v1.0/hyperblock/by-nonce/:nonce` (GET) --> returns a hyperblock by nonce, with transactions included
- `/v1.0/hyperblock/by-hash/:hash` (GET) --> returns a hyperblock by hash, with transactions included

# V_next

This serves as a placeholder for further versions in order to provide a real use-case example of how performing
CRUD operations over endpoints works.
What is different from `v1_0`:
- `/v_next/address/:address/shard` is updated and returns a hardcoded `37` as shard ID
- `/v_next/address/:address/new-endpoint` is added a returns a hardcoded `"test"` as data field
- `/v_next/address/:address/nonce` is removed

The rest of endpoints remain the same.
13 changes: 0 additions & 13 deletions api/address/interface.go

This file was deleted.

190 changes: 0 additions & 190 deletions api/address/routes.go

This file was deleted.

Loading

0 comments on commit 0f88dd9

Please sign in to comment.