From 93793cff0bbd7047da4beed6aa00eeb1d18d9806 Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Thu, 20 Sep 2018 12:13:09 +0100 Subject: [PATCH 01/10] Adds the RPC request ID to the context which is passed to called method. Update request/response data structs to include extra fields Refactor the SendTransactionAsync method to just call the SendTransaction method in a goroutine, instead of reimplementing logic for a new transaction. --- internal/ethapi/api.go | 89 ++++++++++++------------------------------ rpc/server.go | 6 ++- 2 files changed, 31 insertions(+), 64 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 65a644e22..bcff5a2f4 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -28,8 +28,6 @@ import ( "encoding/hex" "encoding/json" "net/http" - "sync" - "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" @@ -1069,8 +1067,11 @@ type SendTxArgs struct { Data hexutil.Bytes `json:"data"` Nonce *hexutil.Uint64 `json:"nonce"` + //Quorum PrivateFrom string `json:"privateFrom"` PrivateFor []string `json:"privateFor"` + PrivateTxType string `json:"restriction"` + //End-Quorum } // prepareSendTxArgs is a helper function that fills in default values for unspecified tx fields. @@ -1095,6 +1096,11 @@ func (args *SendTxArgs) setDefaults(ctx context.Context, b Backend) error { } args.Nonce = (*hexutil.Uint64)(&nonce) } + //Quorum + if args.PrivateTxType == "" { + args.PrivateTxType = "restricted" + } + //End-Quorum return nil } @@ -1437,6 +1443,7 @@ func (s *PublicNetAPI) Version() string { return fmt.Sprintf("%d", s.networkVersion) } +// Quorum // Please note: This is a temporary integration to improve performance in high-latency // environments when sending many private transactions. It will be removed at a later // date when account management is handled outside Ethereum. @@ -1447,17 +1454,19 @@ type AsyncSendTxArgs struct { } type AsyncResult struct { - TxHash common.Hash `json:"txHash"` - Error string `json:"error"` + TxHash common.Hash `json:"txHash,omitempty"` + Error string `json:"error,omitempty"` + Id string `json:"id,omitempty"` } -type Async struct { - sync.Mutex - sem chan struct{} -} - -func (a *Async) send(ctx context.Context, s *PublicTransactionPoolAPI, asyncArgs AsyncSendTxArgs) { +func (s *PublicTransactionPoolAPI) send(ctx context.Context, asyncArgs AsyncSendTxArgs) { res := new(AsyncResult) + + //don't need to nil check this since id is required for every geth rpc call + //even though this is stated in the specification as an "optional" parameter + id := ctx.Value("id").(*json.RawMessage) + res.Id = string(*id) + if asyncArgs.CallbackUrl != "" { defer func() { buf := new(bytes.Buffer) @@ -1473,58 +1482,14 @@ func (a *Async) send(ctx context.Context, s *PublicTransactionPoolAPI, asyncArgs } }() } - args := asyncArgs.SendTxArgs - err := args.setDefaults(ctx, s.b) - if err != nil { - log.Info("Async.send: Error doing setDefaults: %v", err) - res.Error = err.Error() - return - } - b, err := private.P.Send([]byte(args.Data), args.PrivateFrom, args.PrivateFor) - if err != nil { - log.Info("Error running Private.P.Send", "err", err) - res.Error = err.Error() - return - } - res.TxHash, err = a.save(ctx, s, args, b) + + var err error + res.TxHash, err = s.SendTransaction(ctx, asyncArgs.SendTxArgs) if err != nil { res.Error = err.Error() } } -func (a *Async) save(ctx context.Context, s *PublicTransactionPoolAPI, args SendTxArgs, data []byte) (common.Hash, error) { - a.Lock() - defer a.Unlock() - if args.Nonce == nil { - nonce, err := s.b.GetPoolNonce(ctx, args.From) - if err != nil { - return common.Hash{}, err - } - args.Nonce = (*hexutil.Uint64)(&nonce) - } - var tx *types.Transaction - if args.To == nil { - tx = types.NewContractCreation((uint64)(*args.Nonce), (*big.Int)(args.Value), (*big.Int)(args.Gas), (*big.Int)(args.GasPrice), data) - } else { - tx = types.NewTransaction((uint64)(*args.Nonce), *args.To, (*big.Int)(args.Value), (*big.Int)(args.Gas), (*big.Int)(args.GasPrice), data) - } - - signed, err := s.sign(args.From, tx) - if err != nil { - return common.Hash{}, err - } - - return submitTransaction(ctx, s.b, signed, args.PrivateFor != nil) -} - -func newAsync(n int) *Async { - a := &Async{ - sem: make(chan struct{}, n), - } - return a -} - -var async = newAsync(100) // SendTransactionAsync creates a transaction for the given argument, signs it, and // submits it to the transaction pool. This call returns immediately to allow sending @@ -1537,12 +1502,9 @@ var async = newAsync(100) // Please note: This is a temporary integration to improve performance in high-latency // environments when sending many private transactions. It will be removed at a later // date when account management is handled outside Ethereum. -func (s *PublicTransactionPoolAPI) SendTransactionAsync(ctx context.Context, args AsyncSendTxArgs) { - async.sem <- struct{}{} - go func() { - async.send(ctx, s, args) - <-async.sem - }() +func (s *PublicTransactionPoolAPI) SendTransactionAsync(ctx context.Context, args AsyncSendTxArgs) (common.Hash, error){ + go s.send(ctx, args) + return common.Hash{}, nil } // GetQuorumPayload returns the contents of a private transaction @@ -1569,3 +1531,4 @@ func (s *PublicBlockChainAPI) GetQuorumPayload(digestHex string) (string, error) } return fmt.Sprintf("0x%x", data), nil } +//End-Quorum \ No newline at end of file diff --git a/rpc/server.go b/rpc/server.go index 30c288349..5111c0e84 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -299,9 +299,13 @@ func (s *Server) handle(ctx context.Context, codec ServerCodec, req *serverReque return codec.CreateErrorResponse(&req.id, rpcErr), nil } + //Quorum + //Pass the request ID to the method as part of the context, in case the method needs it later + contextWithId := context.WithValue(ctx, "id", req.id) + //End-Quorum arguments := []reflect.Value{req.callb.rcvr} if req.callb.hasCtx { - arguments = append(arguments, reflect.ValueOf(ctx)) + arguments = append(arguments, reflect.ValueOf(contextWithId)) } if len(req.args) > 0 { arguments = append(arguments, req.args...) From 237bdbace52d8ae9f61d7e6536eda6a9b55cf771 Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Thu, 20 Sep 2018 13:26:12 +0100 Subject: [PATCH 02/10] Rearrange method to remove unneeded goroutine (since we are already in a goroutine at this point) --- internal/ethapi/api.go | 58 +++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index bcff5a2f4..86e1a955c 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1453,41 +1453,47 @@ type AsyncSendTxArgs struct { CallbackUrl string `json:"callbackUrl"` } -type AsyncResult struct { - TxHash common.Hash `json:"txHash,omitempty"` - Error string `json:"error,omitempty"` +type AsyncResultSuccess struct { Id string `json:"id,omitempty"` + TxHash common.Hash `json:"txHash"` +} + +type AsyncResultFailure struct { + Id string `json:"id,omitempty"` + Error string `json:"error"` } func (s *PublicTransactionPoolAPI) send(ctx context.Context, asyncArgs AsyncSendTxArgs) { - res := new(AsyncResult) - //don't need to nil check this since id is required for every geth rpc call - //even though this is stated in the specification as an "optional" parameter - id := ctx.Value("id").(*json.RawMessage) - res.Id = string(*id) + txHash, err := s.SendTransaction(ctx, asyncArgs.SendTxArgs) if asyncArgs.CallbackUrl != "" { - defer func() { - buf := new(bytes.Buffer) - err := json.NewEncoder(buf).Encode(res) - if err != nil { - log.Info("Error encoding callback JSON: %v", err) - return - } - _, err = http.Post(asyncArgs.CallbackUrl, "application/json", buf) - if err != nil { - log.Info("Error sending callback: %v", err) - return - } - }() + + //don't need to nil check this since id is required for every geth rpc call + //even though this is stated in the specification as an "optional" parameter + jsonId := ctx.Value("id").(*json.RawMessage) + id := string(*jsonId) + + var resultResponse interface{} + if err != nil { + resultResponse = &AsyncResultFailure{Id: id, Error: err.Error()} + } else { + resultResponse = &AsyncResultSuccess{Id: id, TxHash: txHash} + } + + buf := new(bytes.Buffer) + err := json.NewEncoder(buf).Encode(resultResponse) + if err != nil { + log.Info("Error encoding callback JSON: %v", err) + return + } + _, err = http.Post(asyncArgs.CallbackUrl, "application/json", buf) + if err != nil { + log.Info("Error sending callback: %v", err) + return + } } - var err error - res.TxHash, err = s.SendTransaction(ctx, asyncArgs.SendTxArgs) - if err != nil { - res.Error = err.Error() - } } From 5944ff234691e736faabc36c2bf38ba27e9317ee Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Mon, 1 Oct 2018 10:07:50 +0100 Subject: [PATCH 03/10] Added back the async throttling, fixing an issue where it could block when the channel is full. Now it returns immediately with an error indicating the channel is overloaded. --- internal/ethapi/api.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 86e1a955c..c85afd510 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -23,6 +23,7 @@ import ( "math/big" "strings" "time" + "sync" "bytes" "encoding/hex" @@ -1463,6 +1464,11 @@ type AsyncResultFailure struct { Error string `json:"error"` } +type Async struct { + sync.Mutex + sem chan struct{} +} + func (s *PublicTransactionPoolAPI) send(ctx context.Context, asyncArgs AsyncSendTxArgs) { txHash, err := s.SendTransaction(ctx, asyncArgs.SendTxArgs) @@ -1496,6 +1502,14 @@ func (s *PublicTransactionPoolAPI) send(ctx context.Context, asyncArgs AsyncSend } +func newAsync(n int) *Async { + a := &Async{ + sem: make(chan struct{}, n), + } + return a +} + +var async = newAsync(100) // SendTransactionAsync creates a transaction for the given argument, signs it, and // submits it to the transaction pool. This call returns immediately to allow sending @@ -1509,8 +1523,17 @@ func (s *PublicTransactionPoolAPI) send(ctx context.Context, asyncArgs AsyncSend // environments when sending many private transactions. It will be removed at a later // date when account management is handled outside Ethereum. func (s *PublicTransactionPoolAPI) SendTransactionAsync(ctx context.Context, args AsyncSendTxArgs) (common.Hash, error){ - go s.send(ctx, args) - return common.Hash{}, nil + + select { + case async.sem <- struct{}{}: + go func() { + s.send(ctx, args) + <-async.sem + }() + return common.Hash{}, nil + default: + return common.Hash{}, errors.New("too many concurrent requests") + } } // GetQuorumPayload returns the contents of a private transaction From c3f565db34d9c3dc5fc9e1fdd84c2846b63011ba Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Mon, 1 Oct 2018 10:09:14 +0100 Subject: [PATCH 04/10] Updated import order --- internal/ethapi/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index c85afd510..7ac49471a 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -23,12 +23,12 @@ import ( "math/big" "strings" "time" - "sync" - "bytes" "encoding/hex" "encoding/json" "net/http" + "sync" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" From 2474f53efd84c1ea420be3074efa2ad3892fa854 Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Mon, 1 Oct 2018 12:16:31 +0100 Subject: [PATCH 05/10] Add API docs --- docs/api.md | 148 ++++++++++++++++++++++++++++------------- internal/ethapi/api.go | 1 + 2 files changed, 102 insertions(+), 47 deletions(-) diff --git a/docs/api.md b/docs/api.md index 2c2a6c0cf..2923ef9d9 100644 --- a/docs/api.md +++ b/docs/api.md @@ -4,50 +4,103 @@ ## Privacy APIs __To support private transactions in Quorum, the `web3.eth.sendTransaction(object)` API method has been modified.__ - -```js -web3.eth.sendTransaction(transactionObject [, callback]) -``` - -Sends a transaction to the network. - -##### Parameters - -1. `Object` - The transaction object to send: - - `from`: `String` - The address for the sending account. Uses the `web3.eth.defaultAccount` property, if not specified. - - `to`: `String` - (optional) The destination address of the message, left undefined for a contract-creation transaction. - - `value`: `Number|String|BigNumber` - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction. - - `gas`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). - - `gasPrice`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. - - `data`: `String` - (optional) Either a [byte string](https://github.com/ethereum/wiki/wiki/Solidity,-Docs-and-ABI) containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. - - `nonce`: `Number` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. - - `privateFrom`: `String` - (optional) When sending a private transaction, the sending party's base64-encoded public key to use. If not present *and* passing `privateFor`, use the default key as configured in the `TransactionManager`. - - `privateFor`: `List` - (optional) When sending a private transaction, an array of the recipients' base64-encoded public keys. -2. `Function` - (optional) If you pass a callback the HTTP request is made asynchronous. - -##### Returns - -`String` - The 32 Bytes transaction hash as HEX string. - -If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. - -##### Example - -```js -// compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ -var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; - -web3.eth.sendTransaction({ - data: code, - privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] - }, - function(err, address) { - if (!err) { - console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" - } - } -}); -``` + + ```js + web3.eth.sendTransaction(transactionObject [, callback]) + ``` + + Sends a transaction to the network. + + ##### Parameters + + 1. `Object` - The transaction object to send: + - `from`: `String` - The address for the sending account. Uses the `web3.eth.defaultAccount` property, if not specified. + - `to`: `String` - (optional) The destination address of the message, left undefined for a contract-creation transaction. + - `value`: `Number|String|BigNumber` - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction. + - `gas`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). + - `gasPrice`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. + - `data`: `String` - (optional) Either a [byte string](https://github.com/ethereum/wiki/wiki/Solidity,-Docs-and-ABI) containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. + - `nonce`: `Number` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. + - `privateFrom`: `String` - (optional) When sending a private transaction, the sending party's base64-encoded public key to use. If not present *and* passing `privateFor`, use the default key as configured in the `TransactionManager`. + - `privateFor`: `List` - (optional) When sending a private transaction, an array of the recipients' base64-encoded public keys. + 2. `Function` - (optional) If you pass a callback the HTTP request is made asynchronous. + + ##### Returns + + `String` - The 32 Bytes transaction hash as HEX string. + + If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. + + ##### Example + + ```js + // compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ + var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; + + web3.eth.sendTransaction({ + data: code, + privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] + }, + function(err, address) { + if (!err) { + console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" + } + } + }); + ``` + +--- + +##### eth_sendTransactionAsync + + Sends a transaction to the network asynchronously. This will return immediately, potentially + before the transaction has been submitted to the transaction pool. A callback can be provided + to receive the result of submitting the transaction. + + ##### Parameters + + 1. `Object` - The transaction object to send: + - `from`: `String` - The address for the sending account. Uses the `web3.eth.defaultAccount` property, if not specified. + - `to`: `String` - (optional) The destination address of the message, left undefined for a contract-creation transaction. + - `value`: `Number|String|BigNumber` - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction. + - `gas`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). + - `gasPrice`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. + - `data`: `String` - (optional) Either a [byte string](https://github.com/ethereum/wiki/wiki/Solidity,-Docs-and-ABI) containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. + - `nonce`: `Number` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. + - `privateFrom`: `String` - (optional) When sending a private transaction, the sending party's base64-encoded public key to use. If not present *and* passing `privateFor`, use the default key as configured in the `TransactionManager`. + - `privateFor`: `List` - (optional) When sending a private transaction, an array of the recipients' base64-encoded public keys. + - `callbackUrl`: `String` - (optional) the URL to perform a POST request to to post the result of submitted the transaction + + ##### Returns + + 1. `String` - The empty hash, defined as `0x0000000000000000000000000000000000000000000000000000000000000000` + + The callback URL receives the following object: + + 2. `Object` - The result object: + - `id`: `String` - the identifier in the original RPC call, used to match this result to the request + - `txHash`: `String` - the transaction hash that was generated, if successful + - `error`: `String` - the error that occurred whilst submitting the transaction. + + If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. + + ##### Example + + ```js + // compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ + var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; + + web3.eth.sendTransaction({ + data: code, + privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] + }, + function(err, address) { + if (!err) { + console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" + } + } + }); + ``` *** ## JSON RPC Privacy API Reference @@ -61,7 +114,8 @@ Returns the storage root of given address (Contract/Account etc) ##### Parameters -address, block number (hex) +1. `address`: `String` - The address to fetch the storage root for in hex +2. `block`: `String` - (optional) The block number to look at in hex (e.g. `0x15` for block 21). Uses the latest block if not specified. ##### Returns @@ -99,7 +153,7 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc": "2.0", "method": "eth_st // After private state of the contract is changed from '42' to '99' // Request -curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc": "2.0", "method": "eth_storageRoot", "params":["0x1349f3e1b8d71effb47b840594ff27da7e603d17","0x2"], "id": 67}' +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc": "2.0", "method": "eth_storageRoot", "params":["0x1349f3e1b8d71effb47b840594ff27da7e603d17", "0x2"], "id": 67}' // Response { @@ -117,7 +171,7 @@ Returns the unencrypted payload from Tessera/constellation ##### Parameters -Transaction payload hash in Hex format +1. `id`: `String` - the HEX formatted generated Sha3-512 hash of the encrypted payload from the Private Transaction Manager. This is seen in the transaction as the `data` field ##### Returns diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 7ac49471a..df7e5642b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -23,6 +23,7 @@ import ( "math/big" "strings" "time" + "bytes" "encoding/hex" "encoding/json" From 87e852ed0d6ed1a891601a2c96facf7e803ab4cf Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Mon, 1 Oct 2018 13:42:08 +0100 Subject: [PATCH 06/10] Updated API docs from comments --- docs/api.md | 105 ++++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/docs/api.md b/docs/api.md index 2923ef9d9..18482ba1b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -49,58 +49,6 @@ __To support private transactions in Quorum, the `web3.eth.sendTransaction(objec }); ``` ---- - -##### eth_sendTransactionAsync - - Sends a transaction to the network asynchronously. This will return immediately, potentially - before the transaction has been submitted to the transaction pool. A callback can be provided - to receive the result of submitting the transaction. - - ##### Parameters - - 1. `Object` - The transaction object to send: - - `from`: `String` - The address for the sending account. Uses the `web3.eth.defaultAccount` property, if not specified. - - `to`: `String` - (optional) The destination address of the message, left undefined for a contract-creation transaction. - - `value`: `Number|String|BigNumber` - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction. - - `gas`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). - - `gasPrice`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. - - `data`: `String` - (optional) Either a [byte string](https://github.com/ethereum/wiki/wiki/Solidity,-Docs-and-ABI) containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. - - `nonce`: `Number` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. - - `privateFrom`: `String` - (optional) When sending a private transaction, the sending party's base64-encoded public key to use. If not present *and* passing `privateFor`, use the default key as configured in the `TransactionManager`. - - `privateFor`: `List` - (optional) When sending a private transaction, an array of the recipients' base64-encoded public keys. - - `callbackUrl`: `String` - (optional) the URL to perform a POST request to to post the result of submitted the transaction - - ##### Returns - - 1. `String` - The empty hash, defined as `0x0000000000000000000000000000000000000000000000000000000000000000` - - The callback URL receives the following object: - - 2. `Object` - The result object: - - `id`: `String` - the identifier in the original RPC call, used to match this result to the request - - `txHash`: `String` - the transaction hash that was generated, if successful - - `error`: `String` - the error that occurred whilst submitting the transaction. - - If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. - - ##### Example - - ```js - // compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ - var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; - - web3.eth.sendTransaction({ - data: code, - privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] - }, - function(err, address) { - if (!err) { - console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" - } - } - }); - ``` *** ## JSON RPC Privacy API Reference @@ -199,3 +147,56 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_getQ "result": "0x" } ``` + +*** + +#### eth_sendTransactionAsync + + Sends a transaction to the network asynchronously. This will return immediately, potentially + before the transaction has been submitted to the transaction pool. A callback can be provided + to receive the result of submitting the transaction. + + ##### Parameters + + 1. `Object` - The transaction object to send: + - `from`: `String` - The address for the sending account. Uses the `web3.eth.defaultAccount` property, if not specified. + - `to`: `String` - (optional) The destination address of the message, left undefined for a contract-creation transaction. + - `value`: `Number|String|BigNumber` - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction. + - `gas`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). + - `gasPrice`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. + - `data`: `String` - (optional) Either a [byte string](https://github.com/ethereum/wiki/wiki/Solidity,-Docs-and-ABI) containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. + - `nonce`: `Number` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. + - `privateFrom`: `String` - (optional) When sending a private transaction, the sending party's base64-encoded public key to use. If not present *and* passing `privateFor`, use the default key as configured in the `TransactionManager`. + - `privateFor`: `List` - (optional) When sending a private transaction, an array of the recipients' base64-encoded public keys. + - `callbackUrl`: `String` - (optional) the URL to perform a POST request to to post the result of submitted the transaction + + ##### Returns + + 1. `String` - The empty hash, defined as `0x0000000000000000000000000000000000000000000000000000000000000000` + + The callback URL receives the following object: + + 2. `Object` - The result object: + - `id`: `String` - the identifier in the original RPC call, used to match this result to the request + - `txHash`: `String` - the transaction hash that was generated, if successful + - `error`: `String` - the error that occurred whilst submitting the transaction. + + If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. + + ##### Example + + ```js + // compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ + var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; + + web3.eth.sendTransaction({ + data: code, + privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] + }, + function(err, address) { + if (!err) { + console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" + } + } + }); + ``` \ No newline at end of file From f0b629bed8ef726f338d4f938b6d8576bcfb0265 Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Tue, 2 Oct 2018 22:21:14 +0100 Subject: [PATCH 07/10] Updated eth_sendTransactionAsync example --- docs/api.md | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/api.md b/docs/api.md index 18482ba1b..e2675fa85 100644 --- a/docs/api.md +++ b/docs/api.md @@ -183,20 +183,23 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_getQ If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. - ##### Example - - ```js - // compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ - var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; - - web3.eth.sendTransaction({ - data: code, - privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] - }, - function(err, address) { - if (!err) { - console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" - } - } - }); - ``` \ No newline at end of file +##### Example + +``` +// Request + +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xee9d02e382b34818e88b88a309c7fe71e65f419d", "data": "0x603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' + +// Response +{ + "id": 67, + "jsonrpc": "2.0", + "result": "0x0000000000000000000000000000000000000000000000000000000000000000" +} + +// In the callback +{ + "id":67, + "txHash": "0xc3a24a83dc1b4ebb046cc90ffd6b80ac4a6c51d5b810a43f1cabdeabf1dcdc04" +} +``` \ No newline at end of file From d8f3fcad81693315eee5b3077493c8b91cd393db Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Wed, 3 Oct 2018 10:37:46 +0100 Subject: [PATCH 08/10] Add more eth_sendTransactionAsync examples --- docs/api.md | 163 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 109 insertions(+), 54 deletions(-) diff --git a/docs/api.md b/docs/api.md index e2675fa85..50c156d8c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -4,51 +4,50 @@ ## Privacy APIs __To support private transactions in Quorum, the `web3.eth.sendTransaction(object)` API method has been modified.__ - - ```js - web3.eth.sendTransaction(transactionObject [, callback]) - ``` - - Sends a transaction to the network. - - ##### Parameters - - 1. `Object` - The transaction object to send: - - `from`: `String` - The address for the sending account. Uses the `web3.eth.defaultAccount` property, if not specified. - - `to`: `String` - (optional) The destination address of the message, left undefined for a contract-creation transaction. - - `value`: `Number|String|BigNumber` - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction. - - `gas`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). - - `gasPrice`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. - - `data`: `String` - (optional) Either a [byte string](https://github.com/ethereum/wiki/wiki/Solidity,-Docs-and-ABI) containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. - - `nonce`: `Number` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. - - `privateFrom`: `String` - (optional) When sending a private transaction, the sending party's base64-encoded public key to use. If not present *and* passing `privateFor`, use the default key as configured in the `TransactionManager`. - - `privateFor`: `List` - (optional) When sending a private transaction, an array of the recipients' base64-encoded public keys. - 2. `Function` - (optional) If you pass a callback the HTTP request is made asynchronous. - - ##### Returns - - `String` - The 32 Bytes transaction hash as HEX string. - - If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. - - ##### Example - - ```js - // compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ - var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; - - web3.eth.sendTransaction({ - data: code, - privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] - }, - function(err, address) { - if (!err) { - console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" - } - } - }); - ``` - + +```js +web3.eth.sendTransaction(transactionObject [, callback]) +``` + +Sends a transaction to the network. + +##### Parameters + +1. `Object` - The transaction object to send: + - `from`: `String` - The address for the sending account. Uses the `web3.eth.defaultAccount` property, if not specified. + - `to`: `String` - (optional) The destination address of the message, left undefined for a contract-creation transaction. + - `value`: `Number|String|BigNumber` - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction. + - `gas`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). + - `gasPrice`: `Number|String|BigNumber` - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. + - `data`: `String` - (optional) Either a [byte string](https://github.com/ethereum/wiki/wiki/Solidity,-Docs-and-ABI) containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. + - `nonce`: `Number` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. + - `privateFrom`: `String` - (optional) When sending a private transaction, the sending party's base64-encoded public key to use. If not present *and* passing `privateFor`, use the default key as configured in the `TransactionManager`. + - `privateFor`: `List` - (optional) When sending a private transaction, an array of the recipients' base64-encoded public keys. +2. `Function` - (optional) If you pass a callback the HTTP request is made asynchronous. + +##### Returns + +`String` - The 32 Bytes transaction hash as HEX string. + +If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. + +##### Example + +```js +// compiled solidity source code using https://chriseth.github.io/cpp-ethereum/ +var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3"; + +web3.eth.sendTransaction({ + data: code, + privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] + }, + function(err, address) { + if (!err) { + console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385" + } + } +}); +``` *** ## JSON RPC Privacy API Reference @@ -152,9 +151,11 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_getQ #### eth_sendTransactionAsync - Sends a transaction to the network asynchronously. This will return immediately, potentially - before the transaction has been submitted to the transaction pool. A callback can be provided - to receive the result of submitting the transaction. + Sends a transaction to the network asynchronously. This will return + immediately, potentially before the transaction has been submitted to the + transaction pool. A callback can be provided to receive the result of + submitting the transaction; a server must be set up to receive POST requests + at the given URL. ##### Parameters @@ -178,17 +179,23 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_getQ 2. `Object` - The result object: - `id`: `String` - the identifier in the original RPC call, used to match this result to the request - - `txHash`: `String` - the transaction hash that was generated, if successful + - `txHash`: `String` - the transaction hash that was generated, if successful - `error`: `String` - the error that occurred whilst submitting the transaction. If the transaction was a contract creation use `web3.eth.getTransactionReceipt()` to get the contract address, after the transaction was mined. ##### Example +For the sake of brevity, the data used for each of the following calls is the simple storage contract, with the bytecode defined as: +`js +var storageData = "0x6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029000000000000000000000000000000000000000000000000000000000000002a"; +` + +For the RPC call and the immediate response: + ``` // Request - -curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xee9d02e382b34818e88b88a309c7fe71e65f419d", "data": "0x603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xed9d02e382b34818e88b88a309c7fe71e65f419d", "data": storageData", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' // Response { @@ -197,9 +204,57 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_send "result": "0x0000000000000000000000000000000000000000000000000000000000000000" } + +// Request +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xe2e382b3b8871e65f419d", "data": storageData, "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' + +//If a syntactic error occured with the RPC call. +//In this example the wallet address is the wrong length +//so the error is it cannot convert the parameter to the correct type +//it is NOT an error relating the the address not being managed by this node. + +//Response +{ + "id": 67, + "jsonrpc": "2.0", + "error": { + "code": -32602, + "message": "invalid argument 0: json: cannot unmarshal hex string of odd length into Go struct field AsyncSendTxArgs.from of type common.Address" + } +} +``` + +If the callback URL is provided, the following response will be received after +the transaction has been submitted; this example assumes a webserver that can +be accessed by calling http://localhost:8080 has been set up to accept POST +requests: + +``` + + +// Request +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xed9d02e382b34818e88b88a309c7fe71e65f419d", "data": storageData, "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="], "callbackUrl": "http://localhost:8080"}], "id":67}' + +// Response +//Note that the ID is the same in the callback as the request - this can be used to match the request to the response. +{ + "id": 67, + "txHash": "0x75ebbf4fbe29355fc8a4b8d1e14ecddf0228b64ef41e6d2fce56047650e2bf17" +} + + + + +// Request +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xae9bc6cd5145e67fbd1887a5145271fd182f0ee7", "callbackUrl": "http://localhost:8080", "data": storageData, "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' + +//If a semantic error occured with the RPC call. +//In this example the wallet address is not managed by the node +//So the RPC call will succeed (giving the empty hash), but the callback will show a failure + // In the callback { - "id":67, - "txHash": "0xc3a24a83dc1b4ebb046cc90ffd6b80ac4a6c51d5b810a43f1cabdeabf1dcdc04" + "id": 67, + "error":"unknown account" } -``` \ No newline at end of file +``` From 37fdc6b2a4202085ca092881d6a3750fd5aac4bf Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Wed, 3 Oct 2018 11:02:52 +0100 Subject: [PATCH 09/10] Update field name --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 50c156d8c..1e1d7690e 100644 --- a/docs/api.md +++ b/docs/api.md @@ -118,7 +118,7 @@ Returns the unencrypted payload from Tessera/constellation ##### Parameters -1. `id`: `String` - the HEX formatted generated Sha3-512 hash of the encrypted payload from the Private Transaction Manager. This is seen in the transaction as the `data` field +1. `id`: `String` - the HEX formatted generated Sha3-512 hash of the encrypted payload from the Private Transaction Manager. This is seen in the transaction as the `input` field ##### Returns From 7a282ff4339c447a6a2a19b65991988ec28a94c7 Mon Sep 17 00:00:00 2001 From: Peter Fox Date: Fri, 5 Oct 2018 20:20:18 +0100 Subject: [PATCH 10/10] Inline example data --- docs/api.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/api.md b/docs/api.md index 1e1d7690e..d7e2b84d0 100644 --- a/docs/api.md +++ b/docs/api.md @@ -186,16 +186,11 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_getQ ##### Example -For the sake of brevity, the data used for each of the following calls is the simple storage contract, with the bytecode defined as: -`js -var storageData = "0x6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029000000000000000000000000000000000000000000000000000000000000002a"; -` - For the RPC call and the immediate response: ``` // Request -curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xed9d02e382b34818e88b88a309c7fe71e65f419d", "data": storageData", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xed9d02e382b34818e88b88a309c7fe71e65f419d", "data": "0x6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029000000000000000000000000000000000000000000000000000000000000002a", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' // Response { @@ -206,7 +201,7 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_send // Request -curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xe2e382b3b8871e65f419d", "data": storageData, "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xe2e382b3b8871e65f419d", "data": "0x6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029000000000000000000000000000000000000000000000000000000000000002a", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' //If a syntactic error occured with the RPC call. //In this example the wallet address is the wrong length @@ -233,7 +228,7 @@ requests: // Request -curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xed9d02e382b34818e88b88a309c7fe71e65f419d", "data": storageData, "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="], "callbackUrl": "http://localhost:8080"}], "id":67}' +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xed9d02e382b34818e88b88a309c7fe71e65f419d", "data": "0x6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029000000000000000000000000000000000000000000000000000000000000002a", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="], "callbackUrl": "http://localhost:8080"}], "id":67}' // Response //Note that the ID is the same in the callback as the request - this can be used to match the request to the response. @@ -246,7 +241,7 @@ curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_send // Request -curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xae9bc6cd5145e67fbd1887a5145271fd182f0ee7", "callbackUrl": "http://localhost:8080", "data": storageData, "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' +curl -X POST http://127.0.0.1:22000 --data '{"jsonrpc":"2.0", "method":"eth_sendTransactionAsync", "params":[{"from":"0xae9bc6cd5145e67fbd1887a5145271fd182f0ee7", "callbackUrl": "http://localhost:8080", "data": "0x6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029000000000000000000000000000000000000000000000000000000000000002a", "gas": "0x47b760", "privateFor": ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}], "id":67}' //If a semantic error occured with the RPC call. //In this example the wallet address is not managed by the node