├── bin ├── .gitignore ├── run_tests.bat ├── run_tests.sh ├── build_docs.sh ├── make_and_install_gem.bat ├── run_gen_methods.bat ├── run_geth.sh └── run_testrpc.bat ├── .rspec ├── Gemfile ├── lib ├── generated_web3_methods.rb ├── txpool_calls.rb ├── web3_calls.rb ├── net_calls.rb ├── test_personal.rb ├── miner_calls.rb ├── shh_calls.rb ├── personal_calls.rb ├── abi_tools.rb ├── web3.rb └── eth_calls.rb ├── docs ├── images │ ├── add.png │ ├── bug.png │ ├── brick.png │ ├── date.png │ ├── delete.png │ ├── find.png │ ├── plugin.png │ ├── ruby.png │ ├── wrench.png │ ├── zoom.png │ ├── arrow_up.png │ ├── package.png │ ├── tag_blue.png │ ├── brick_link.png │ ├── macFFBgHack.png │ ├── page_green.png │ ├── tag_green.png │ ├── transparent.png │ ├── bullet_black.png │ ├── wrench_orange.png │ ├── loadingAnimation.gif │ ├── page_white_text.png │ ├── page_white_width.png │ ├── bullet_toggle_plus.png │ └── bullet_toggle_minus.png ├── js │ ├── searcher.js.gz │ ├── navigation.js.gz │ ├── search_index.js.gz │ ├── search.js │ ├── navigation.js │ ├── darkfish.js │ └── searcher.js ├── fonts │ ├── Lato-Light.ttf │ ├── Lato-Regular.ttf │ ├── Lato-LightItalic.ttf │ ├── Lato-RegularItalic.ttf │ ├── SourceCodePro-Bold.ttf │ └── SourceCodePro-Regular.ttf ├── created.rid ├── fr_class_index.html ├── fr_file_index.html ├── files │ ├── eth_calls_rb.html │ ├── net_calls_rb.html │ ├── shh_calls_rb.html │ ├── web3_calls_rb.html │ ├── test_personal_rb.html │ ├── txpool_calls_rb.html │ ├── personal_calls_rb.html │ ├── generated_web3_methods_rb.html │ └── web3_rb.html ├── classes │ ├── GeneratedWeb3Methods.html │ └── Web3 │ │ ├── TxpoolCalls.html │ │ ├── Web3Calls.html │ │ ├── NetCalls.html │ │ └── PersonalCalls.html ├── GeneratedWeb3Methods.html ├── KeyValueStore_abi.html ├── test_abi.html ├── index.html ├── Integer.html ├── Web3 │ ├── TxpoolCalls.html │ ├── Web3Calls.html │ ├── NetCalls.html │ └── MinerCalls.html ├── String.html ├── Object.html ├── css │ ├── fonts.css │ ├── style.css │ └── rdoc.css └── ContractModel.html ├── spec ├── KeyValueStore.abi ├── KeyValueStore_spec.rb └── spec_helper.rb ├── gen ├── gen_test_stubs.py ├── gen_methods.py └── funcs.txt ├── contracts └── greeter.sol ├── web3.gemspec └── README.md /bin/.gitignore: -------------------------------------------------------------------------------- 1 | password.txt 2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper web3 3 | -------------------------------------------------------------------------------- /bin/run_tests.bat: -------------------------------------------------------------------------------- 1 | rspec -I . --format doc spec/web3_spec.rb 2 | -------------------------------------------------------------------------------- /bin/run_tests.sh: -------------------------------------------------------------------------------- 1 | rspec -I . --format doc spec/vtada_rpc_web3.rb 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # Gemfile 2 | source "https://rubygems.org" 3 | 4 | gemspec 5 | -------------------------------------------------------------------------------- /lib/generated_web3_methods.rb: -------------------------------------------------------------------------------- 1 | module GeneratedWeb3Methods 2 | 3 | 4 | end 5 | -------------------------------------------------------------------------------- /bin/build_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../lib 4 | rdoc -f hanna --output ../docs 5 | cd ../bin 6 | -------------------------------------------------------------------------------- /docs/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/add.png -------------------------------------------------------------------------------- /docs/images/bug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/bug.png -------------------------------------------------------------------------------- /docs/images/brick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/brick.png -------------------------------------------------------------------------------- /docs/images/date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/date.png -------------------------------------------------------------------------------- /docs/images/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/delete.png -------------------------------------------------------------------------------- /docs/images/find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/find.png -------------------------------------------------------------------------------- /docs/images/plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/plugin.png -------------------------------------------------------------------------------- /docs/images/ruby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/ruby.png -------------------------------------------------------------------------------- /docs/images/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/wrench.png -------------------------------------------------------------------------------- /docs/images/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/zoom.png -------------------------------------------------------------------------------- /docs/js/searcher.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/js/searcher.js.gz -------------------------------------------------------------------------------- /bin/make_and_install_gem.bat: -------------------------------------------------------------------------------- 1 | cd .. 2 | gem build web3.gemspec 3 | gem install web3-0.4.0.gem 4 | cd bin 5 | -------------------------------------------------------------------------------- /docs/images/arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/arrow_up.png -------------------------------------------------------------------------------- /docs/images/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/package.png -------------------------------------------------------------------------------- /docs/images/tag_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/tag_blue.png -------------------------------------------------------------------------------- /docs/js/navigation.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/js/navigation.js.gz -------------------------------------------------------------------------------- /bin/run_gen_methods.bat: -------------------------------------------------------------------------------- 1 | cd ../gen 2 | python gen_methods.py > ../lib/generated_web3_methods.rb 3 | cd ../bin 4 | -------------------------------------------------------------------------------- /docs/fonts/Lato-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/fonts/Lato-Light.ttf -------------------------------------------------------------------------------- /docs/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /docs/images/brick_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/brick_link.png -------------------------------------------------------------------------------- /docs/images/macFFBgHack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/macFFBgHack.png -------------------------------------------------------------------------------- /docs/images/page_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/page_green.png -------------------------------------------------------------------------------- /docs/images/tag_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/tag_green.png -------------------------------------------------------------------------------- /docs/images/transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/transparent.png -------------------------------------------------------------------------------- /docs/js/search_index.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/js/search_index.js.gz -------------------------------------------------------------------------------- /docs/images/bullet_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/bullet_black.png -------------------------------------------------------------------------------- /docs/images/wrench_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/wrench_orange.png -------------------------------------------------------------------------------- /docs/fonts/Lato-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/fonts/Lato-LightItalic.ttf -------------------------------------------------------------------------------- /docs/images/loadingAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/loadingAnimation.gif -------------------------------------------------------------------------------- /docs/images/page_white_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/page_white_text.png -------------------------------------------------------------------------------- /docs/images/page_white_width.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/page_white_width.png -------------------------------------------------------------------------------- /docs/fonts/Lato-RegularItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/fonts/Lato-RegularItalic.ttf -------------------------------------------------------------------------------- /docs/fonts/SourceCodePro-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/fonts/SourceCodePro-Bold.ttf -------------------------------------------------------------------------------- /docs/images/bullet_toggle_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/bullet_toggle_plus.png -------------------------------------------------------------------------------- /docs/fonts/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/fonts/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /docs/images/bullet_toggle_minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spikewilliams/vtada-ethereum/HEAD/docs/images/bullet_toggle_minus.png -------------------------------------------------------------------------------- /bin/run_geth.sh: -------------------------------------------------------------------------------- 1 | geth --rpc --datadir "C:\Users\spike\AppData\Roaming\Ethereum" --light --cache 4096 --unlock 0x14226aD04625ED4930787D87C82c6c72a5B690a1 --password password.txt 2 | -------------------------------------------------------------------------------- /bin/run_testrpc.bat: -------------------------------------------------------------------------------- 1 | SET RPCPORT=8545 2 | SET IMAGE_NAME=vtada/testrpc 3 | SET MNEMONIC="the magic rat drove his sleek machine over the jersey state line" 4 | 5 | docker run --rm -it -p %RPCPORT%:8545 %IMAGE_NAME% -m %MNEMONIC% 6 | -------------------------------------------------------------------------------- /lib/txpool_calls.rb: -------------------------------------------------------------------------------- 1 | module Web3::TxpoolCalls 2 | 3 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#txpool_status 4 | def txpool_status() 5 | response = do_request("txpool_status") 6 | response["result"] 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /spec/KeyValueStore.abi: -------------------------------------------------------------------------------- 1 | ======= KeyValueStore.sol:KeyValueStore ======= 2 | Contract JSON ABI 3 | [{"constant":false,"inputs":[{"name":"_key","type":"bytes32"}],"name":"get","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_key","type":"bytes32"},{"name":"_value","type":"string"}],"name":"put","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"}] 4 | -------------------------------------------------------------------------------- /lib/web3_calls.rb: -------------------------------------------------------------------------------- 1 | module Web3::Web3Calls 2 | 3 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion 4 | def web3_clientVersion() 5 | response = do_request("web3_clientVersion") 6 | response["result"] 7 | end 8 | 9 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3 10 | def web3_sha3(data) 11 | response = do_request("web3_sha3",[data]) 12 | response["result"] 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /gen/gen_test_stubs.py: -------------------------------------------------------------------------------- 1 | funcs = open("funcs.txt") 2 | 3 | patterns = {-1:""" %s % s""", 4 | 0:""" 5 | context "request for %s " do 6 | it "returns ___" do 7 | vt = VtadaRPC. new 8 | value = vt. %s 9 | expect(value).to eq "__" 10 | end 11 | end""" 12 | } 13 | 14 | print('require "vtada_rpc"') 15 | print("RSpec.describe VtadaRPC do") 16 | for line in funcs.readlines(): 17 | tokes = line.strip().split("|") 18 | name = tokes.pop(0) 19 | pattern_index = 0 20 | args = [name,name] 21 | print(patterns[pattern_index] % tuple(args)) 22 | print("end") 23 | -------------------------------------------------------------------------------- /lib/net_calls.rb: -------------------------------------------------------------------------------- 1 | module Web3::NetCalls 2 | 3 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version 4 | def net_version() 5 | response = do_request("net_version") 6 | response["result"] 7 | end 8 | 9 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount 10 | def net_peerCount() 11 | response = do_request("net_peerCount") 12 | to_decimal response["result"] 13 | end 14 | 15 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#net_listening 16 | def net_listening() 17 | response = do_request("net_listening") 18 | response["result"] 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /docs/created.rid: -------------------------------------------------------------------------------- 1 | Thu, 08 Jun 2017 03:51:44 +0000 2 | ./abi_tools.rb Sat, 27 May 2017 03:26:27 +0000 3 | ./eth_calls.rb Thu, 18 May 2017 04:41:46 +0000 4 | ./generated_web3_methods.rb Tue, 02 May 2017 05:13:35 +0000 5 | ./KeyValueStore.abi Thu, 25 May 2017 01:19:20 +0000 6 | ./miner_calls.rb Thu, 08 Jun 2017 01:10:05 +0000 7 | ./net_calls.rb Thu, 18 May 2017 03:52:56 +0000 8 | ./personal_calls.rb Thu, 18 May 2017 03:57:03 +0000 9 | ./shh_calls.rb Thu, 18 May 2017 03:56:00 +0000 10 | ./test.abi Wed, 24 May 2017 04:03:17 +0000 11 | ./test_personal.rb Thu, 04 May 2017 05:19:51 +0000 12 | ./txpool_calls.rb Thu, 18 May 2017 03:57:57 +0000 13 | ./web3.rb Thu, 08 Jun 2017 01:10:37 +0000 14 | ./web3_calls.rb Thu, 18 May 2017 03:45:54 +0000 15 | -------------------------------------------------------------------------------- /contracts/greeter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.0; 2 | 3 | 4 | contract mortal { 5 | /* Define variable owner of the type address*/ 6 | address owner; 7 | 8 | /* this function is executed at initialization and sets the owner of the contract */ 9 | function mortal() { owner = msg.sender; } 10 | 11 | /* Function to recover the funds on the contract */ 12 | function kill() { if (msg.sender == owner) selfdestruct(owner); } 13 | } 14 | 15 | contract greeter is mortal { 16 | /* define variable greeting of the type string */ 17 | string greeting; 18 | 19 | /* this runs when the contract is executed */ 20 | function greeter(string _greeting) public { 21 | greeting = _greeting; 22 | } 23 | 24 | /* main function */ 25 | function greet() constant returns (string) { 26 | return greeting; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/test_personal.rb: -------------------------------------------------------------------------------- 1 | require_relative "web3" 2 | 3 | w3 = Web3.new "http://brindigo.com:8545" 4 | 5 | signAndSend = true 6 | testpassword = "testpassword" 7 | accounts = w3.personal_listAccounts 8 | puts w3.eth_getBalance accounts[0] 9 | transaction = {"from"=> accounts[0], "to" => accounts[1], "value" => w3.ether_to_0xwei(0.001)} 10 | if signAndSend 11 | #w3.personal_signAndSendTransaction(transaction, testpassword) 12 | w3.sendEther(accounts[0], "0xAF73160759A70eB6DE64038dE09ab90c1428C459",0.5, "testpassword") 13 | else 14 | w3.personal_unlockAccount(accounts[0], "testpassword", 60); 15 | w3.eth_sendTransaction(transaction) 16 | t2 = w3.eth_pendingTransactions()[0] 17 | w3.eth_resend(t2, w3.to_0x(100000), w3.to_0x(3333333)) 18 | w3.eth_pendingTransactions() 19 | w3.personal_lockAccount(accounts[0]) 20 | end 21 | puts w3.eth_getBalance accounts[0] 22 | puts w3.eth_getBalance accounts[1] 23 | -------------------------------------------------------------------------------- /web3.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = 'web3' 3 | s.version = '0.4.1' 4 | s.date = '2017-06-07' 5 | s.summary = "A client library for connecting to an Ethereum Web3 JSON RPC service" 6 | s.description = s.summary 7 | s.authors = ["Spike Williams"] 8 | s.email = 'spikewilliams@gmail.com' 9 | s.files = ["lib/web3.rb", 10 | "lib/eth_calls.rb", 11 | "lib/miner_calls.rb", 12 | "lib/net_calls.rb", 13 | "lib/personal_calls.rb", 14 | "lib/shh_calls.rb", 15 | "lib/txpool_calls.rb", 16 | "lib/web3_calls.rb" 17 | ] 18 | s.homepage = 'https://github.com/spikewilliams/vtada-ethereum' 19 | s.license = 'MIT' 20 | 21 | s.add_development_dependency "hanna-nouveau", '~> 1.0' 22 | s.add_runtime_dependency "httparty", '~> 0.14' 23 | s.add_runtime_dependency "json", '~> 2' 24 | end 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vdata-ethereum 2 | Ruby library for accessing the Ethereum blockchain via JSON RPC 3 | 4 | # A simple example 5 | 6 | This code lists the accounts at the default JSON RPC endpoint and prints the balance of the first account. It then sends a small amount of ether from the first account to the second. 7 | 8 | ``` 9 | w3 = Web3.new 10 | accounts = w3.personal_listAccounts 11 | puts w3.eth_getBalance accounts[0] 12 | amount_to_send = 0.0001 13 | w3.sendEther(accounts[0], accounts[1], amount_to_send, "mypassword") 14 | ``` 15 | 16 | NOTE: For the above code to work, the Web3 endpoint needs to be running the "personal" API, which is turned off in geth by default. Visit https://github.com/ethereum/go-ethereum/wiki/Management-APIs for details. 17 | 18 | # Docs 19 | 20 | Auto generated docs can be found at https://spikewilliams.github.io/vtada-ethereum/ 21 | 22 | # Configuration 23 | Use environment variables to configure the vdata-ethereum client. 24 | 25 | To set the endpoint (default is http://localhost:8545): 26 | 27 | SET ETH_ENDPOINT=http://hostname:port 28 | 29 | To set the client id (default is 999): 30 | 31 | SET ETH_DEFAULT_CLIENT_ID=### 32 | 33 | For debug mode: 34 | 35 | SET ETH_DEBUG=true 36 | -------------------------------------------------------------------------------- /docs/fr_class_index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Class Index

11 |
    12 |
  1. GeneratedWeb3Methods 13 |
      14 |
  2. Web3 15 |
    1. Web3::EthCalls 16 |
        17 |
    2. Web3::NetCalls 18 |
        19 |
    3. Web3::PersonalCalls 20 |
        21 |
    4. Web3::ShhCalls 22 |
        23 |
    5. Web3::TxpoolCalls 24 |
        25 |
    6. Web3::Web3Calls 26 |
        27 |
    7. 28 |
  3. 29 |
30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/fr_file_index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

File Index

11 |
    12 |
  1. eth_calls.rb
  2. 13 |
  3. generated_web3_methods.rb
  4. 14 |
  5. net_calls.rb
  6. 15 |
  7. personal_calls.rb
  8. 16 |
  9. shh_calls.rb
  10. 17 |
  11. test_personal.rb
  12. 18 |
  13. txpool_calls.rb
  14. 19 |
  15. web3.rb
  16. 20 |
  17. web3_calls.rb
  18. 21 |
  19. 22 | show all 23 |
  20. 24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /lib/miner_calls.rb: -------------------------------------------------------------------------------- 1 | module Web3::MinerCalls 2 | 3 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#miner_makedag 4 | def miner_makeDAG(number) 5 | response = do_request("miner_makeDAG",[number]) 6 | response["result"] 7 | end 8 | 9 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#miner_setextra 10 | def miner_setExtra(extra) 11 | response = do_request("miner_setExtra",[extra]) 12 | response["result"] 13 | end 14 | 15 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#miner_setgasprice 16 | def miner_setGasPrice(gasPrice) 17 | response = do_request("miner_setGasPrice",[gasPrice]) 18 | response["result"] 19 | end 20 | 21 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#miner_start 22 | def miner_start(threads) 23 | response = do_request("miner_start",[threads]) 24 | response["result"] 25 | end 26 | 27 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#miner_startautodag 28 | def miner_startAutoDAG(number) 29 | response = do_request("miner_startAutoDAG",[number]) 30 | response["result"] 31 | end 32 | 33 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#miner_stop 34 | def miner_stop() 35 | response = do_request("miner_stop") 36 | response["result"] 37 | end 38 | 39 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#miner_stopautodag 40 | def miner_stopAutoDAG() 41 | response = do_request("miner_stopAutoDAG") 42 | response["result"] 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /docs/files/eth_calls_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | eth_calls.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

eth_calls.rb 27 |

28 |
29 | eth_calls.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/files/net_calls_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net_calls.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

net_calls.rb 27 |

28 |
29 | net_calls.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/files/shh_calls_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | shh_calls.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

shh_calls.rb 27 |

28 |
29 | shh_calls.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/files/web3_calls_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | web3_calls.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

web3_calls.rb 27 |

28 |
29 | web3_calls.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/files/test_personal_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test_personal.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

test_personal.rb 27 |

28 |
29 | test_personal.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/files/txpool_calls_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | txpool_calls.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

txpool_calls.rb 27 |

28 |
29 | txpool_calls.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/files/personal_calls_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | personal_calls.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

personal_calls.rb 27 |

28 |
29 | personal_calls.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/files/generated_web3_methods_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | generated_web3_methods.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

generated_web3_methods.rb 27 |

28 |
29 | generated_web3_methods.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/classes/GeneratedWeb3Methods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GeneratedWeb3Methods 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

module 27 | GeneratedWeb3Methods 28 |

29 |
    30 |
  1. 31 | generated_web3_methods.rb 32 |
  2. 33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | 43 |
44 |
45 | 46 | 47 |
48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/files/web3_rb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | web3.rb 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

web3.rb 27 |

28 |
29 | web3.rb 30 |
31 |
32 | Last Update: 33 | 2017-05-18 12:23:51 +0000 34 |
35 |
36 |
37 |
38 |
39 |

A client to Ethereum JSON-RPC github.com/ethereum/wiki/wiki/JSON-RPC

41 |
42 |
43 |
44 |

Required files

45 |
    46 |
  1. httparty
  2. 47 |
  3. json
  4. 48 |
49 |
50 |
51 | 52 |
53 |
54 | 55 | 56 |
57 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /gen/gen_methods.py: -------------------------------------------------------------------------------- 1 | funcs = open("funcs.txt") 2 | 3 | patterns = {-1:""" 4 | %s 5 | def %s() 6 | raise NotImplementedError.new "JSON-RPC call to %s is not currently supported" 7 | end""", 8 | 0:""" 9 | %s 10 | def %s() 11 | response = do_request("%s") 12 | %s 13 | end""", 14 | 1:""" 15 | %s 16 | def %s(%s) 17 | response = do_request("%s",%s) 18 | %s 19 | end""" 20 | } 21 | 22 | comments = {"personal_unlockAccount": """ 23 | # Be careful with this method. Do not leave an account unlocked, as that creates 24 | # an opportunity for an attacker to make transactions from that account. In general 25 | # personal_signAndSendTransaction is a better option than unlock -> send -> lock 26 | """} 27 | 28 | 29 | def buildComment(name): 30 | comment = "" 31 | if name in comments: 32 | comment = comments[name] 33 | 34 | if name.startswith("personal_"): 35 | return(comment + " # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#%s" % (name.lower())) 36 | return(comment + " # See https://github.com/ethereum/wiki/wiki/JSON-RPC#%s" % (name.lower())) 37 | 38 | print("module GeneratedWeb3Methods") 39 | for line in funcs.readlines(): 40 | tokes = line.strip().split("|") 41 | name = tokes.pop(0) 42 | comment = buildComment(name) 43 | pattern_index = 0 44 | return_line = 'response["result"]' 45 | args = [comment,name,name] 46 | if len(tokes) > 0: 47 | pattern_index = int(tokes.pop(0).strip()) 48 | if len(tokes) > 0 and tokes[0] == "D": 49 | return_line = "to_decimal " + return_line 50 | tokes.pop(0) 51 | if len(tokes) > 0: 52 | args = [comment] + tokes 53 | args = [name if x=="$NAME" else x for x in args] 54 | 55 | if pattern_index >= 0: 56 | args = args + [return_line] 57 | print(patterns[pattern_index] % tuple(args)) 58 | print("end") 59 | -------------------------------------------------------------------------------- /spec/KeyValueStore_spec.rb: -------------------------------------------------------------------------------- 1 | require "web3" 2 | require "abi_tools" 3 | 4 | RSpec.describe "KeyValueStore" do 5 | 6 | KVETH_ACCOUNT = ENV["KVETH_ACCOUNT"] || "0x034e7c56c10e9fd79bd089ec0849ec69ee23cebb" 7 | KVETH_CONTRACT_ADDRESS = ENV["KVETH_ACCOUNT"] || "0xf8ff3fd84d4270423ce4a999c6bd8e722e026ff7" 8 | 9 | context "Connect to chain" do 10 | it "connect to a node and have it return the web3 client version" do 11 | vt = Web3. new 12 | value = vt. web3_clientVersion 13 | expect(value).to be_a String 14 | end 15 | end 16 | 17 | context "ABI Tools " do 18 | it "integers pad correctly" do 19 | padded = 32.to_padded_hex_string 16 20 | expect(padded).to eq("0000000000000020") 21 | padded = (-123456789).to_padded_hex_string 16 22 | expect(padded).to eq("fffffffff8a432eb") 23 | end 24 | it "correctly encodes a method signature" do 25 | sig = "baz(uint32,bool)".signature() 26 | expect(sig).to eq("cdcd77c0") 27 | end 28 | it "encodes byte array" do 29 | bytes = "Hello, world!".bytes 30 | encoded = ContractModel.encode_byte_arrays(bytes) 31 | hw = "000000000000000000000000000000000000000000000000000000000000000d" + 32 | "48656c6c6f2c20776f726c642100000000000000000000000000000000000000" 33 | # expect(encoded.length).to eq hw.length 34 | expect(encoded).to eq(hw) 35 | end 36 | it "load ABI from JSON file" do 37 | path = "../../smart_tulips/dev/kveth/kveth/build/contracts/KeyValueStore.json" 38 | model = loadJSONFile path 39 | # puts model 40 | # value = model.call("put(bytes32,string)",["0xAAAAAA","This is a test"]) 41 | # puts value 42 | end 43 | it "load ABI from ABI file" do 44 | path = "spec/test.abi" 45 | # puts File.basename(Dir.getwd) 46 | model = loadAbiFile path 47 | # puts model 48 | # value = model.call("put(bytes32,string)",["0xAAAAAA","This is a test"]) 49 | # puts value 50 | end 51 | 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /lib/shh_calls.rb: -------------------------------------------------------------------------------- 1 | module Web3::ShhCalls 2 | 3 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_version 4 | def shh_version() 5 | response = do_request("shh_version") 6 | response["result"] 7 | end 8 | 9 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post 10 | def shh_post(post_object) 11 | response = do_request("shh_post",[post_object]) 12 | response["result"] 13 | end 14 | 15 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newidentity 16 | def shh_newIdentity() 17 | response = do_request("shh_newIdentity") 18 | response["result"] 19 | end 20 | 21 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_hasidentity 22 | def shh_hasIdentity(address) 23 | response = do_request("shh_hasIdentity",[address]) 24 | response["result"] 25 | end 26 | 27 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newgroup 28 | def shh_newGroup() 29 | response = do_request("shh_newGroup") 30 | response["result"] 31 | end 32 | 33 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_addtogroup 34 | def shh_addToGroup(address) 35 | response = do_request("shh_addToGroup",[address]) 36 | response["result"] 37 | end 38 | 39 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter 40 | def shh_newFilter(filter_object) 41 | response = do_request("shh_newFilter",[filter_object]) 42 | to_decimal response["result"] 43 | end 44 | 45 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_uninstallfilter 46 | def shh_uninstallFilter(id) 47 | response = do_request("shh_uninstallFilter",[id]) 48 | response["result"] 49 | end 50 | 51 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getfilterchanges 52 | def shh_getFilterChanges(id) 53 | response = do_request("shh_getFilterChanges",[id]) 54 | response["result"] 55 | end 56 | 57 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getmessages 58 | def shh_getMessages(id) 59 | response = do_request("shh_getMessages",[id]) 60 | response["result"] 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /lib/personal_calls.rb: -------------------------------------------------------------------------------- 1 | module Web3::PersonalCalls 2 | 3 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_listaccounts 4 | def personal_listAccounts() 5 | response = do_request("personal_listAccounts") 6 | response["result"] 7 | end 8 | 9 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_importrawkey 10 | def personal_importRawKey(key, passphrase) 11 | response = do_request("personal_importRawKey",[key, passphrase]) 12 | response["result"] 13 | end 14 | 15 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_newaccount 16 | def personal_newAccount(password) 17 | response = do_request("personal_newAccount",[password]) 18 | response["result"] 19 | end 20 | 21 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_signandsendtransaction 22 | def personal_signAndSendTransaction(transaction, passphrase) 23 | response = do_request("personal_signAndSendTransaction",[transaction, passphrase]) 24 | response["result"] 25 | end 26 | 27 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_lockaccount 28 | def personal_lockAccount(account) 29 | response = do_request("personal_lockAccount",[account]) 30 | response["result"] 31 | end 32 | 33 | 34 | # Be careful with this method. Do not leave an account unlocked, as that creates 35 | # an opportunity for an attacker to make transactions from that account. In general 36 | # personal_signAndSendTransaction is a better option than unlock -> send -> lock 37 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_unlockaccount 38 | def personal_unlockAccount(account, passphrase, duration) 39 | response = do_request("personal_unlockAccount",[account, passphrase, duration]) 40 | response["result"] 41 | end 42 | 43 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign 44 | def personal_sign(message, account, password) 45 | response = do_request("personal_sign",[message, account, password]) 46 | response["result"] 47 | end 48 | 49 | # See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecrecover 50 | def personal_ecRecover(message, signature) 51 | response = do_request("personal_ecRecover",[message, signature]) 52 | response["result"] 53 | end 54 | 55 | end 56 | -------------------------------------------------------------------------------- /docs/GeneratedWeb3Methods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module GeneratedWeb3Methods - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 64 | 65 |
66 |

67 | module GeneratedWeb3Methods 68 |

69 | 70 |
71 | 72 |
73 | 74 | 75 | 76 | 77 |
78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 |
88 |
89 | 90 | 91 | 96 | 97 | -------------------------------------------------------------------------------- /docs/classes/Web3/TxpoolCalls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web3::TxpoolCalls 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

module 27 | Web3::TxpoolCalls 28 |

29 |
    30 |
  1. 31 | txpool_calls.rb 32 |
  2. 33 |
34 |
35 |
36 |
37 |
38 |
39 |

Methods

40 |

Public Instance

41 |
    42 |
  1. txpool_status
  2. 43 |
44 |
45 |
46 |
47 |
48 |
49 |

Public Instance methods

50 |
51 | 52 |
53 | txpool_status 54 | () 55 | 56 |
57 | 63 |
64 | 65 | [show source] 66 | 67 |
# File txpool_calls.rb, line 4
def txpool_status()
response = do_request("txpool_status")
response["result"]
end
68 |
69 |
70 |
71 |
72 | 73 |
74 |
75 | 76 | 77 |
78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/KeyValueStore_abi.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | KeyValueStore.abi - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 71 | 72 |
73 | 74 |
KeyValueStore.sol:KeyValueStore =======
75 | 76 |

Contract JSON ABI

77 |
{“constant”:false,“inputs”:,“name”:“get”,“outputs”:,“payable”:false,“type”:“function”},{“constant”:false,“inputs”:,“name”:“put”,“outputs”:,“payable”:false,“type”:“function”} 78 |
79 |
80 | 81 | 82 | 83 | 88 | 89 | -------------------------------------------------------------------------------- /docs/js/search.js: -------------------------------------------------------------------------------- 1 | Search = function(data, input, result) { 2 | this.data = data; 3 | this.$input = $(input); 4 | this.$result = $(result); 5 | 6 | this.$current = null; 7 | this.$view = this.$result.parent(); 8 | this.searcher = new Searcher(data.index); 9 | this.init(); 10 | } 11 | 12 | Search.prototype = $.extend({}, Navigation, new function() { 13 | var suid = 1; 14 | 15 | this.init = function() { 16 | var _this = this; 17 | var observer = function(e) { 18 | switch(e.originalEvent.keyCode) { 19 | case 38: // Event.KEY_UP 20 | case 40: // Event.KEY_DOWN 21 | return; 22 | } 23 | _this.search(_this.$input[0].value); 24 | }; 25 | this.$input.keyup(observer); 26 | this.$input.click(observer); // mac's clear field 27 | 28 | this.searcher.ready(function(results, isLast) { 29 | _this.addResults(results, isLast); 30 | }) 31 | 32 | this.initNavigation(); 33 | this.setNavigationActive(false); 34 | } 35 | 36 | this.search = function(value, selectFirstMatch) { 37 | value = jQuery.trim(value).toLowerCase(); 38 | if (value) { 39 | this.setNavigationActive(true); 40 | } else { 41 | this.setNavigationActive(false); 42 | } 43 | 44 | if (value == '') { 45 | this.lastQuery = value; 46 | this.$result.empty(); 47 | this.$result.attr('aria-expanded', 'false'); 48 | this.setNavigationActive(false); 49 | } else if (value != this.lastQuery) { 50 | this.lastQuery = value; 51 | this.$result.attr('aria-busy', 'true'); 52 | this.$result.attr('aria-expanded', 'true'); 53 | this.firstRun = true; 54 | this.searcher.find(value); 55 | } 56 | } 57 | 58 | this.addResults = function(results, isLast) { 59 | var target = this.$result.get(0); 60 | if (this.firstRun && (results.length > 0 || isLast)) { 61 | this.$current = null; 62 | this.$result.empty(); 63 | } 64 | 65 | for (var i=0, l = results.length; i < l; i++) { 66 | var item = this.renderItem.call(this, results[i]); 67 | item.setAttribute('id', 'search-result-' + target.childElementCount); 68 | target.appendChild(item); 69 | }; 70 | 71 | if (this.firstRun && results.length > 0) { 72 | this.firstRun = false; 73 | this.$current = $(target.firstChild); 74 | this.$current.addClass('search-selected'); 75 | } 76 | if (jQuery.browser.msie) this.$element[0].className += ''; 77 | 78 | if (isLast) this.$result.attr('aria-busy', 'false'); 79 | } 80 | 81 | this.move = function(isDown) { 82 | if (!this.$current) return; 83 | var $next = this.$current[isDown ? 'next' : 'prev'](); 84 | if ($next.length) { 85 | this.$current.removeClass('search-selected'); 86 | $next.addClass('search-selected'); 87 | this.$input.attr('aria-activedescendant', $next.attr('id')); 88 | this.scrollIntoView($next[0], this.$view[0]); 89 | this.$current = $next; 90 | this.$input.val($next[0].firstChild.firstChild.text); 91 | this.$input.select(); 92 | } 93 | return true; 94 | } 95 | 96 | this.hlt = function(html) { 97 | return this.escapeHTML(html). 98 | replace(/\u0001/g, ''). 99 | replace(/\u0002/g, ''); 100 | } 101 | 102 | this.escapeHTML = function(html) { 103 | return html.replace(/[&<>]/g, function(c) { 104 | return '&#' + c.charCodeAt(0) + ';'; 105 | }); 106 | } 107 | 108 | }); 109 | 110 | -------------------------------------------------------------------------------- /gen/funcs.txt: -------------------------------------------------------------------------------- 1 | web3_clientVersion 2 | web3_sha3|1|$NAME|data|$NAME|[data] 3 | net_version 4 | net_peerCount|0|D 5 | net_listening 6 | eth_protocolVersion|-1 7 | eth_syncing 8 | eth_coinbase 9 | eth_mining 10 | eth_hashrate|0|D 11 | eth_gasPrice|0|D 12 | eth_accounts 13 | eth_blockNumber|0|D 14 | eth_getBalance|1|D|$NAME|address, block = "latest"|$NAME|[address, block] 15 | eth_getStorageAt|1|$NAME|storage_address, position, block = "latest"|$NAME|[storage_address, to_hex(position), block] 16 | eth_getTransactionCount|1|D|$NAME|address, block = "latest"|$NAME|[address, block] 17 | eth_getBlockTransactionCountByHash|1|D|$NAME|data|$NAME|[data] 18 | eth_getBlockTransactionCountByNumber|1|D|$NAME|block = "latest"|$NAME|[block] 19 | eth_getUncleCountByBlockHash|1|D|$NAME|data|$NAME|[data] 20 | eth_getUncleCountByBlockNumber|1|D|$NAME|data|$NAME|[data] 21 | eth_getCode|1|$NAME|address, block = "latest"|$NAME|[address, block] 22 | eth_sign|1|$NAME|address, data|$NAME|[address, data] 23 | eth_sendTransaction|1|$NAME|trans_object|$NAME|[trans_object] 24 | eth_resendTransaction|1|$NAME|trans_object|$NAME|[trans_object] 25 | eth_sendRawTransaction|1|$NAME|data|$NAME|[data] 26 | eth_call|1|$NAME|trans_object,block|$NAME|[trans_object, block] 27 | eth_estimateGas|1|$NAME|trans_object|$NAME|[trans_object] 28 | eth_getBlockByHash|1|$NAME|hash, full_transactions = true|$NAME|[hash, full_transactions] 29 | eth_getBlockByNumber|1|$NAME|number, full_transactions = true|$NAME|[number, full_transactions] 30 | eth_getTransactionByHash|1|$NAME|hash|$NAME|[hash] 31 | eth_getTransactionByBlockHashAndIndex|1|$NAME|hash, index|$NAME|[hash, index] 32 | eth_getTransactionByBlockNumberAndIndex|1|$NAME|number, index|$NAME|[number, index] 33 | eth_getTransactionReceipt|1|$NAME|hash|$NAME|[hash] 34 | eth_getUncleByBlockHashAndIndex|1|$NAME|hash, index|$NAME|[hash, index] 35 | eth_getUncleByBlockNumberAndIndex|1|$NAME|number, index|$NAME|[number, index] 36 | eth_getCompilers 37 | eth_compileLLL|1|$NAME|code|$NAME|[code] 38 | eth_compileSolidity|1|$NAME|code|$NAME|[code] 39 | eth_compileSerpent|1|$NAME|code|$NAME|[code] 40 | eth_newFilter|1|D|$NAME|fromBlock, toBlock, address, topics|$CODE|[fromBlock, toBlock, address, topics] 41 | eth_newBlockFilter|0|D 42 | eth_newPendingTransactionFilter|0|D 43 | eth_uninstallFilter|1|$NAME|id|$NAME|[id] 44 | eth_getFilterChanges|1|$NAME|id|$NAME|[id] 45 | eth_getFilterLogs|1|$NAME|id|$NAME|[id] 46 | eth_getLogs|1|$NAME|filter_obj|$NAME|[filter_obj] 47 | eth_getWork 48 | eth_submitWork|1|$NAME|nonce, powHash, mixDigest|$NAME|[nonce, powHash, mixDigest] 49 | eth_submitHashrate|1|$NAME|hashrate, id|$NAME|[hashrate, id] 50 | shh_version 51 | shh_post|1|$NAME|post_object|$NAME|[post_object] 52 | shh_newIdentity 53 | shh_hasIdentity|1|$NAME|address|$NAME|[address] 54 | shh_newGroup 55 | shh_addToGroup|1|$NAME|address|$NAME|[address] 56 | shh_newFilter|1|D|$NAME|filter_object|$NAME|[filter_object] 57 | shh_uninstallFilter|1|$NAME|id|$NAME|[id] 58 | shh_getFilterChanges|1|$NAME|id|$NAME|[id] 59 | shh_getMessages|1|$NAME|id|$NAME|[id] 60 | personal_listAccounts 61 | personal_importRawKey|1|$NAME|key, passphrase|$NAME|[key, passphrase] 62 | personal_newAccount|1|$NAME|password|$NAME|[password] 63 | personal_signAndSendTransaction|1|$NAME|transaction, passphrase|$NAME|[transaction, passphrase] 64 | personal_lockAccount|1|$NAME|account|$NAME|[account] 65 | personal_unlockAccount|1|$NAME|account, passphrase, duration|$NAME|[account, passphrase, duration] 66 | personal_sign|1|$NAME|message, account, password|$NAME|[message, account, password] 67 | personal_ecRecover|1|$NAME|message, signature|$NAME|[message, signature] 68 | txpool_status 69 | -------------------------------------------------------------------------------- /docs/test_abi.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | test.abi - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 71 | 72 |
73 | 74 |
KeyValueStore.sol:KeyValueStore =======
75 | 76 |

Contract JSON ABI [{“constant”:false,

77 | 78 |
  "inputs":[{"name":"_key","type":"bytes32"}],
 79 |   "name":"get",
 80 |   "outputs":[{"name":"","type":"string"}],
 81 |   "payable":false,
 82 |   "type":"function"},
 83 | {"constant":false,
 84 |   "inputs":[
 85 |     {"name":"_key","type":"bytes32"},
 86 |     {"name":"_value","type":"string"}],
 87 |   "name":"put",
 88 |   "outputs":[{"name":"","type":"bool"}],
 89 |   "payable":false,
 90 |   "type":"function"}]
91 |
92 | 93 | 94 | 95 | 100 | 101 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 104 | 105 |
106 |

This is the API documentation for RDoc Documentation. 107 |

108 | 109 | 110 | 111 | 116 | 117 | -------------------------------------------------------------------------------- /docs/classes/Web3/Web3Calls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web3::Web3Calls 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

module 27 | Web3::Web3Calls 28 |

29 |
    30 |
  1. 31 | web3_calls.rb 32 |
  2. 33 |
34 |
35 |
36 |
37 |
38 |
39 |

Methods

40 |

Public Instance

41 |
    42 |
  1. web3_clientVersion
  2. 43 |
  3. web3_sha3
  4. 44 |
45 |
46 |
47 |
48 |
49 |
50 |

Public Instance methods

51 |
52 | 53 |
54 | web3_clientVersion 55 | () 56 | 57 |
58 | 64 |
65 | 66 | [show source] 67 | 68 |
# File web3_calls.rb, line 4
def web3_clientVersion()
response = do_request("web3_clientVersion")
response["result"]
end
69 |
70 |
71 |
72 | 73 |
74 | web3_sha3 75 | (data) 76 | 77 |
78 | 84 |
85 | 86 | [show source] 87 | 88 |
# File web3_calls.rb, line 10
def web3_sha3(data)
response = do_request("web3_sha3",[data])
response["result"]
end
89 |
90 |
91 |
92 |
93 | 94 |
95 |
96 | 97 | 98 |
99 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /docs/js/navigation.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Navigation allows movement using the arrow keys through the search results. 3 | * 4 | * When using this library you will need to set scrollIntoView to the 5 | * appropriate function for your layout. Use scrollInWindow if the container 6 | * is not scrollable and scrollInElement if the container is a separate 7 | * scrolling region. 8 | */ 9 | Navigation = new function() { 10 | this.initNavigation = function() { 11 | var _this = this; 12 | 13 | $(document).keydown(function(e) { 14 | _this.onkeydown(e); 15 | }).keyup(function(e) { 16 | _this.onkeyup(e); 17 | }); 18 | 19 | this.navigationActive = true; 20 | } 21 | 22 | this.setNavigationActive = function(state) { 23 | this.navigationActive = state; 24 | this.clearMoveTimeout(); 25 | } 26 | 27 | this.onkeyup = function(e) { 28 | if (!this.navigationActive) return; 29 | 30 | switch(e.keyCode) { 31 | case 37: //Event.KEY_LEFT: 32 | case 38: //Event.KEY_UP: 33 | case 39: //Event.KEY_RIGHT: 34 | case 40: //Event.KEY_DOWN: 35 | this.clearMoveTimeout(); 36 | break; 37 | } 38 | } 39 | 40 | this.onkeydown = function(e) { 41 | if (!this.navigationActive) return; 42 | switch(e.keyCode) { 43 | case 37: //Event.KEY_LEFT: 44 | if (this.moveLeft()) e.preventDefault(); 45 | break; 46 | case 38: //Event.KEY_UP: 47 | if (e.keyCode == 38 || e.ctrlKey) { 48 | if (this.moveUp()) e.preventDefault(); 49 | this.startMoveTimeout(false); 50 | } 51 | break; 52 | case 39: //Event.KEY_RIGHT: 53 | if (this.moveRight()) e.preventDefault(); 54 | break; 55 | case 40: //Event.KEY_DOWN: 56 | if (e.keyCode == 40 || e.ctrlKey) { 57 | if (this.moveDown()) e.preventDefault(); 58 | this.startMoveTimeout(true); 59 | } 60 | break; 61 | case 13: //Event.KEY_RETURN: 62 | if (this.$current) 63 | e.preventDefault(); 64 | this.select(this.$current); 65 | break; 66 | } 67 | if (e.ctrlKey && e.shiftKey) this.select(this.$current); 68 | } 69 | 70 | this.clearMoveTimeout = function() { 71 | clearTimeout(this.moveTimeout); 72 | this.moveTimeout = null; 73 | } 74 | 75 | this.startMoveTimeout = function(isDown) { 76 | if (!$.browser.mozilla && !$.browser.opera) return; 77 | if (this.moveTimeout) this.clearMoveTimeout(); 78 | var _this = this; 79 | 80 | var go = function() { 81 | if (!_this.moveTimeout) return; 82 | _this[isDown ? 'moveDown' : 'moveUp'](); 83 | _this.moveTimout = setTimeout(go, 100); 84 | } 85 | this.moveTimeout = setTimeout(go, 200); 86 | } 87 | 88 | this.moveRight = function() { 89 | } 90 | 91 | this.moveLeft = function() { 92 | } 93 | 94 | this.move = function(isDown) { 95 | } 96 | 97 | this.moveUp = function() { 98 | return this.move(false); 99 | } 100 | 101 | this.moveDown = function() { 102 | return this.move(true); 103 | } 104 | 105 | /* 106 | * Scrolls to the given element in the scrollable element view. 107 | */ 108 | this.scrollInElement = function(element, view) { 109 | var offset, viewHeight, viewScroll, height; 110 | offset = element.offsetTop; 111 | height = element.offsetHeight; 112 | viewHeight = view.offsetHeight; 113 | viewScroll = view.scrollTop; 114 | 115 | if (offset - viewScroll + height > viewHeight) { 116 | view.scrollTop = offset - viewHeight + height; 117 | } 118 | if (offset < viewScroll) { 119 | view.scrollTop = offset; 120 | } 121 | } 122 | 123 | /* 124 | * Scrolls to the given element in the window. The second argument is 125 | * ignored 126 | */ 127 | this.scrollInWindow = function(element, ignored) { 128 | var offset, viewHeight, viewScroll, height; 129 | offset = element.offsetTop; 130 | height = element.offsetHeight; 131 | viewHeight = window.innerHeight; 132 | viewScroll = window.scrollY; 133 | 134 | if (offset - viewScroll + height > viewHeight) { 135 | window.scrollTo(window.scrollX, offset - viewHeight + height); 136 | } 137 | if (offset < viewScroll) { 138 | window.scrollTo(window.scrollX, offset); 139 | } 140 | } 141 | } 142 | 143 | -------------------------------------------------------------------------------- /docs/Integer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | class Integer - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 81 | 82 |
83 |

84 | class Integer 85 |

86 | 87 |
88 | 89 |
90 | 91 | 92 | 93 | 94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 |
105 |
106 |

Public Instance Methods

107 |
108 | 109 | 110 |
111 | 112 |
113 | to_padded_hex_string() 115 | 116 | click to toggle source 117 | 118 |
119 | 120 | 121 |
122 | 123 | 124 | 125 | 126 | 127 | 128 |
129 |
# File abi_tools.rb, line 6
130 | def to_padded_hex_string
131 |   sprintf("%032X",self)
132 | end
133 |
134 | 135 |
136 | 137 | 138 | 139 | 140 |
141 | 142 | 143 |
144 | 145 |
146 |
147 | 148 | 149 | 154 | 155 | -------------------------------------------------------------------------------- /docs/Web3/TxpoolCalls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module Web3::TxpoolCalls - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 74 | 75 |
76 |

77 | module Web3::TxpoolCalls 78 |

79 | 80 |
81 | 82 |
83 | 84 | 85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 |
98 |
99 |

Public Instance Methods

100 |
101 | 102 | 103 |
104 | 105 |
106 | txpool_status() 108 | 109 | click to toggle source 110 | 111 |
112 | 113 | 114 |
115 | 116 |

See github.com/ethereum/wiki/wiki/JSON-RPC#txpool_status

118 | 119 | 120 | 121 | 122 |
123 |
# File txpool_calls.rb, line 4
124 | def txpool_status()
125 | response = do_request("txpool_status")
126 | response["result"]
127 | end
128 |
129 | 130 |
131 | 132 | 133 | 134 | 135 |
136 | 137 | 138 |
139 | 140 |
141 |
142 | 143 | 144 | 149 | 150 | -------------------------------------------------------------------------------- /docs/String.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | class String - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 81 | 82 |
83 |

84 | class String 85 |

86 | 87 |
88 | 89 |
90 | 91 | 92 | 93 | 94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
103 |
104 |

Attributes

105 |
106 | 107 | 108 |
109 |
110 | datatype[RW] 112 |
113 | 114 |
115 | 116 | 117 | 118 |
119 |
120 | 121 |
122 | 123 | 124 | 125 |
126 |
127 |

Public Instance Methods

128 |
129 | 130 | 131 |
132 | 133 |
134 | signature() 136 | 137 | click to toggle source 138 | 139 |
140 | 141 | 142 |
143 | 144 | 145 | 146 | 147 | 148 | 149 |
150 |
# File abi_tools.rb, line 15
151 | def signature
152 |   Digest::SHA3.hexdigest(self, 256) [0..7]
153 | end
154 |
155 | 156 |
157 | 158 | 159 | 160 | 161 |
162 | 163 | 164 |
165 | 166 |
167 |
168 | 169 | 170 | 175 | 176 | -------------------------------------------------------------------------------- /docs/Object.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | class Object - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 81 | 82 |
83 |

84 | class Object 85 |

86 | 87 |
88 | 89 |
90 | 91 | 92 | 93 | 94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 |
105 |
106 |

Public Instance Methods

107 |
108 | 109 | 110 |
111 | 112 |
113 | loadAbiFile(path) 115 | 116 | click to toggle source 117 | 118 |
119 | 120 | 121 |
122 | 123 | 124 | 125 | 126 | 127 | 128 |
129 |
# File abi_tools.rb, line 40
130 | def loadAbiFile(path)
131 |   lines = open(path, &:read).split("\n")
132 |   abi = JSON.parse lines[2]
133 |   model = ContractModel.new abi
134 |   model.call("put(bytes32,string)",["0xAAAAAA","This is a test"])
135 | end
136 |
137 | 138 |
139 | 140 | 141 | 142 | 143 |
144 | 145 | 146 |
147 | 148 |
149 |
150 | 151 | 152 | 157 | 158 | -------------------------------------------------------------------------------- /lib/abi_tools.rb: -------------------------------------------------------------------------------- 1 | require "digest/sha3" 2 | require "JSON" 3 | require "set" 4 | 5 | class Integer 6 | def to_padded_hex_string(padding = 64) 7 | out = sprintf("%0" + String(padding) + "x",self) 8 | # HACK: For negative numbers, the above command sets "out" to something out like "..fffffff8a432eb" 9 | # No idea why the "..", seems to be a Ruby thing. For now, just swapping the .'s for f's. #TODO.BW 10 | out.gsub(".","f") # /HACK 11 | end 12 | end 13 | 14 | class String 15 | 16 | attr_accessor :datatype 17 | 18 | def signature 19 | Digest::SHA3.hexdigest(self, 256) [0..7] 20 | end 21 | end 22 | 23 | class ContractModel 24 | attr_reader :contractMethods 25 | def initialize(abi) 26 | @contractMethods = Set.new 27 | abi.each do |obj| 28 | if obj["type"] == "function" then 29 | inputs = obj["inputs"].map {|input| input["type"]} 30 | method = obj["name"] + "(" + inputs.join(",") + ")" 31 | @contractMethods.add method 32 | end 33 | end 34 | end 35 | 36 | def self.encode_byte_arrays(bytes) 37 | data = [bytes.length.to_padded_hex_string] 38 | z = 64 #used to ensure proper zero padding 39 | bytes.each do |b| 40 | data << sprintf("%0x", b) 41 | z = z - 2 42 | if z < 0 then 43 | z = 64 44 | end 45 | end 46 | data << sprintf("%0" + String(z) + "x", 0) 47 | data.join 48 | end 49 | 50 | 51 | def self.encode_strings(strings) 52 | data = [] 53 | if strings.length > 1 then 54 | data << [strings.length.to_padded_hex_string] 55 | end 56 | for str in strings do 57 | data << [encode_byte_arrays([str.bytes])[:data]] 58 | end 59 | # return {:arg_type => "STATIC", 60 | # :data = > data } 61 | data.join 62 | end 63 | #encode_bytes 64 | #encode_address 65 | #encode_function 66 | #encode_uint 67 | #encode_int 68 | #encode_fixed 69 | #encode_ufixed 70 | #encode_bool 71 | 72 | def encode_single(arg, value) 73 | len = arg.scan(/\d/).join 74 | length = len.empty? ? 32 : Integer(len) 75 | 76 | if arg.start_with "string" then 77 | raise "not yet implemented" 78 | elsif arg.start_with "bytes" then 79 | if len.empty? then #if there are no digets in the arg strin 80 | raise "not yet implemented" 81 | end 82 | elsif arg.start_with "address" then 83 | tailParts << Integer(value).to_padded_hex_string 160 84 | elsif arg.start_with "function" then 85 | raise "not yet implemented" 86 | elsif arg.start_with "uint" then 87 | tailParts << Integer(value).to_padded_hex_string length 88 | elsif arg.start_with "int" then 89 | tailParts << Integer(value).to_padded_hex_string length 90 | elsif arg.start_with "fixed" then 91 | raise "not yet implemented" 92 | elsif arg.start_with "ufixed" then 93 | raise "not yet implemented" 94 | elsif arg.start_with "bool" then 95 | if value then 96 | headParts << 1.to_padded_hex_string 97 | else 98 | headParts << 1.to_padded_hex_string 99 | end 100 | end 101 | end 102 | 103 | def encode_multiple(arg, value) 104 | headParts = [] 105 | tailParts = [] 106 | end 107 | 108 | #methodstr looks something like "put(bytes32,string)" 109 | # see https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#types for possible types 110 | def call(methodstr, arguments) 111 | if @contractMethods.include? methodstr then 112 | encodedCallParts = ["0x",methodstr.signature] 113 | openParen = methodstr.index("(") 114 | closeParen = methodstr.index(")") 115 | args = methodstr[openParen, closeParen].split(",") 116 | 117 | arg.zip arguments do |arg, value| #go through arguments and add them to the encoded transaction call 118 | isTypeArray = arg.end_with? "[]" 119 | if !isTypeArray then 120 | if value.kind_of? Array then 121 | raise ArgumentError, "Was not expecting " + arg + " paramater to be an array." 122 | end 123 | encodedCallParts += encode_single(arg,value) 124 | elsif !value.kind_of? Array then 125 | raise ArgumentError, "Was expecting " + arg + " parameter to be an array." 126 | else 127 | encodedCallParts += encode_multiple(arg,value) 128 | end 129 | end 130 | puts encodedCall 131 | else 132 | raise "No method signature " + methodstr + " found" 133 | end 134 | end 135 | end 136 | 137 | def loadJSONFile(path) 138 | file = File.read(path) 139 | parsed = JSON.parse file 140 | abi = parsed["abi"] 141 | ContractModel.new abi 142 | #model = ContractModel.new abi 143 | #model.call("put(bytes32,string)",["0xAAAAAA","This is a test"]) 144 | end 145 | 146 | def loadAbiFile(path) 147 | lines = open(path, &:read).split("\n") 148 | lines = lines.drop(2) 149 | jsonStr = lines.join("\n") 150 | abi = JSON.parse jsonStr 151 | ContractModel.new abi 152 | end 153 | 154 | #Keccak hash 155 | 156 | #loadAbiFile "KeyValueStore.abi" 157 | 158 | #sprintf("%02X", 10) 159 | #puts(44.to_padded_hex_string()) 160 | #puts("baz(uint32,bool)".signature()) 161 | -------------------------------------------------------------------------------- /docs/classes/Web3/NetCalls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web3::NetCalls 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

module 27 | Web3::NetCalls 28 |

29 |
    30 |
  1. 31 | net_calls.rb 32 |
  2. 33 |
34 |
35 |
36 |
37 |
38 |
39 |

Methods

40 |

Public Instance

41 |
    42 |
  1. net_listening
  2. 43 |
  3. net_peerCount
  4. 44 |
  5. net_version
  6. 45 |
46 |
47 |
48 |
49 |
50 |
51 |

Public Instance methods

52 |
53 | 54 |
55 | net_listening 56 | () 57 | 58 |
59 | 65 |
66 | 67 | [show source] 68 | 69 |
# File net_calls.rb, line 16
def net_listening()
response = do_request("net_listening")
response["result"]
end
70 |
71 |
72 |
73 | 74 |
75 | net_peerCount 76 | () 77 | 78 |
79 | 85 |
86 | 87 | [show source] 88 | 89 |
# File net_calls.rb, line 10
def net_peerCount()
response = do_request("net_peerCount")
to_decimal response["result"]
end
90 |
91 |
92 |
93 | 94 |
95 | net_version 96 | () 97 | 98 |
99 | 105 |
106 | 107 | [show source] 108 | 109 |
# File net_calls.rb, line 4
def net_version()
response = do_request("net_version")
response["result"]
end
110 |
111 |
112 |
113 |
114 | 115 |
116 |
117 | 118 | 119 |
120 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /docs/js/darkfish.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Darkfish Page Functions 4 | * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ 5 | * 6 | * Author: Michael Granger 7 | * 8 | */ 9 | 10 | /* Provide console simulation for firebug-less environments */ 11 | if (!("console" in window) || !("firebug" in console)) { 12 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", 13 | "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; 14 | 15 | window.console = {}; 16 | for (var i = 0; i < names.length; ++i) 17 | window.console[names[i]] = function() {}; 18 | }; 19 | 20 | 21 | /** 22 | * Unwrap the first element that matches the given @expr@ from the targets and return them. 23 | */ 24 | $.fn.unwrap = function( expr ) { 25 | return this.each( function() { 26 | $(this).parents( expr ).eq( 0 ).after( this ).remove(); 27 | }); 28 | }; 29 | 30 | 31 | function showSource( e ) { 32 | var target = e.target; 33 | var codeSections = $(target). 34 | parents('.method-detail'). 35 | find('.method-source-code'); 36 | 37 | $(target). 38 | parents('.method-detail'). 39 | find('.method-source-code'). 40 | slideToggle(); 41 | }; 42 | 43 | function hookSourceViews() { 44 | $('.method-heading').click( showSource ); 45 | }; 46 | 47 | function hookSearch() { 48 | var input = $('#search-field').eq(0); 49 | var result = $('#search-results').eq(0); 50 | $(result).show(); 51 | 52 | var search_section = $('#search-section').get(0); 53 | $(search_section).show(); 54 | 55 | var search = new Search(search_data, input, result); 56 | 57 | search.renderItem = function(result) { 58 | var li = document.createElement('li'); 59 | var html = ''; 60 | 61 | // TODO add relative path to 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 76 | 77 |
78 |

79 | module Web3::Web3Calls 80 |

81 | 82 |
83 | 84 |
85 | 86 | 87 | 88 | 89 |
90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 |
100 |
101 |

Public Instance Methods

102 |
103 | 104 | 105 |
106 | 107 |
108 | web3_clientVersion() 110 | 111 | click to toggle source 112 | 113 |
114 | 115 | 116 |
117 | 118 |

See github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion

120 | 121 | 122 | 123 | 124 |
125 |
# File web3_calls.rb, line 4
126 | def web3_clientVersion()
127 | response = do_request("web3_clientVersion")
128 | response["result"]
129 | end
130 |
131 | 132 |
133 | 134 | 135 | 136 | 137 |
138 | 139 | 140 |
141 | 142 |
143 | web3_sha3(data) 145 | 146 | click to toggle source 147 | 148 |
149 | 150 | 151 |
152 | 153 |

See github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3

155 | 156 | 157 | 158 | 159 |
160 |
# File web3_calls.rb, line 10
161 | def web3_sha3(data)
162 | response = do_request("web3_sha3",[data])
163 | response["result"]
164 | end
165 |
166 | 167 |
168 | 169 | 170 | 171 | 172 |
173 | 174 | 175 |
176 | 177 |
178 |
179 | 180 | 181 | 186 | 187 | -------------------------------------------------------------------------------- /docs/css/fonts.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), 3 | * with Reserved Font Name "Source". All Rights Reserved. Source is a 4 | * trademark of Adobe Systems Incorporated in the United States and/or other 5 | * countries. 6 | * 7 | * This Font Software is licensed under the SIL Open Font License, Version 8 | * 1.1. 9 | * 10 | * This license is copied below, and is also available with a FAQ at: 11 | * http://scripts.sil.org/OFL 12 | */ 13 | 14 | @font-face { 15 | font-family: "Source Code Pro"; 16 | font-style: normal; 17 | font-weight: 400; 18 | src: local("Source Code Pro"), 19 | local("SourceCodePro-Regular"), 20 | url("../fonts/SourceCodePro-Regular.ttf") format("truetype"); 21 | } 22 | 23 | @font-face { 24 | font-family: "Source Code Pro"; 25 | font-style: normal; 26 | font-weight: 700; 27 | src: local("Source Code Pro Bold"), 28 | local("SourceCodePro-Bold"), 29 | url("../fonts/SourceCodePro-Bold.ttf") format("truetype"); 30 | } 31 | 32 | /* 33 | * Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com), 34 | * with Reserved Font Name Lato. 35 | * 36 | * This Font Software is licensed under the SIL Open Font License, Version 37 | * 1.1. 38 | * 39 | * This license is copied below, and is also available with a FAQ at: 40 | * http://scripts.sil.org/OFL 41 | */ 42 | 43 | @font-face { 44 | font-family: "Lato"; 45 | font-style: normal; 46 | font-weight: 300; 47 | src: local("Lato Light"), 48 | local("Lato-Light"), 49 | url("../fonts/Lato-Light.ttf") format("truetype"); 50 | } 51 | 52 | @font-face { 53 | font-family: "Lato"; 54 | font-style: italic; 55 | font-weight: 300; 56 | src: local("Lato Light Italic"), 57 | local("Lato-LightItalic"), 58 | url("../fonts/Lato-LightItalic.ttf") format("truetype"); 59 | } 60 | 61 | @font-face { 62 | font-family: "Lato"; 63 | font-style: normal; 64 | font-weight: 700; 65 | src: local("Lato Regular"), 66 | local("Lato-Regular"), 67 | url("../fonts/Lato-Regular.ttf") format("truetype"); 68 | } 69 | 70 | @font-face { 71 | font-family: "Lato"; 72 | font-style: italic; 73 | font-weight: 700; 74 | src: local("Lato Italic"), 75 | local("Lato-Italic"), 76 | url("../fonts/Lato-RegularItalic.ttf") format("truetype"); 77 | } 78 | 79 | /* 80 | * ----------------------------------------------------------- 81 | * SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 82 | * ----------------------------------------------------------- 83 | * 84 | * PREAMBLE 85 | * The goals of the Open Font License (OFL) are to stimulate worldwide 86 | * development of collaborative font projects, to support the font creation 87 | * efforts of academic and linguistic communities, and to provide a free and 88 | * open framework in which fonts may be shared and improved in partnership 89 | * with others. 90 | * 91 | * The OFL allows the licensed fonts to be used, studied, modified and 92 | * redistributed freely as long as they are not sold by themselves. The 93 | * fonts, including any derivative works, can be bundled, embedded, 94 | * redistributed and/or sold with any software provided that any reserved 95 | * names are not used by derivative works. The fonts and derivatives, 96 | * however, cannot be released under any other type of license. The 97 | * requirement for fonts to remain under this license does not apply 98 | * to any document created using the fonts or their derivatives. 99 | * 100 | * DEFINITIONS 101 | * "Font Software" refers to the set of files released by the Copyright 102 | * Holder(s) under this license and clearly marked as such. This may 103 | * include source files, build scripts and documentation. 104 | * 105 | * "Reserved Font Name" refers to any names specified as such after the 106 | * copyright statement(s). 107 | * 108 | * "Original Version" refers to the collection of Font Software components as 109 | * distributed by the Copyright Holder(s). 110 | * 111 | * "Modified Version" refers to any derivative made by adding to, deleting, 112 | * or substituting -- in part or in whole -- any of the components of the 113 | * Original Version, by changing formats or by porting the Font Software to a 114 | * new environment. 115 | * 116 | * "Author" refers to any designer, engineer, programmer, technical 117 | * writer or other person who contributed to the Font Software. 118 | * 119 | * PERMISSION & CONDITIONS 120 | * Permission is hereby granted, free of charge, to any person obtaining 121 | * a copy of the Font Software, to use, study, copy, merge, embed, modify, 122 | * redistribute, and sell modified and unmodified copies of the Font 123 | * Software, subject to the following conditions: 124 | * 125 | * 1) Neither the Font Software nor any of its individual components, 126 | * in Original or Modified Versions, may be sold by itself. 127 | * 128 | * 2) Original or Modified Versions of the Font Software may be bundled, 129 | * redistributed and/or sold with any software, provided that each copy 130 | * contains the above copyright notice and this license. These can be 131 | * included either as stand-alone text files, human-readable headers or 132 | * in the appropriate machine-readable metadata fields within text or 133 | * binary files as long as those fields can be easily viewed by the user. 134 | * 135 | * 3) No Modified Version of the Font Software may use the Reserved Font 136 | * Name(s) unless explicit written permission is granted by the corresponding 137 | * Copyright Holder. This restriction only applies to the primary font name as 138 | * presented to the users. 139 | * 140 | * 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 141 | * Software shall not be used to promote, endorse or advertise any 142 | * Modified Version, except to acknowledge the contribution(s) of the 143 | * Copyright Holder(s) and the Author(s) or with their explicit written 144 | * permission. 145 | * 146 | * 5) The Font Software, modified or unmodified, in part or in whole, 147 | * must be distributed entirely under this license, and must not be 148 | * distributed under any other license. The requirement for fonts to 149 | * remain under this license does not apply to any document created 150 | * using the Font Software. 151 | * 152 | * TERMINATION 153 | * This license becomes null and void if any of the above conditions are 154 | * not met. 155 | * 156 | * DISCLAIMER 157 | * THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 158 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 159 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 160 | * OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 161 | * COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 162 | * INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 163 | * DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 164 | * FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 165 | * OTHER DEALINGS IN THE FONT SOFTWARE. 166 | */ 167 | 168 | -------------------------------------------------------------------------------- /docs/Web3/NetCalls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module Web3::NetCalls - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 78 | 79 |
80 |

81 | module Web3::NetCalls 82 |

83 | 84 |
85 | 86 |
87 | 88 | 89 | 90 | 91 |
92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 |
102 |
103 |

Public Instance Methods

104 |
105 | 106 | 107 |
108 | 109 |
110 | net_listening() 112 | 113 | click to toggle source 114 | 115 |
116 | 117 | 118 |
119 | 120 |

See github.com/ethereum/wiki/wiki/JSON-RPC#net_listening

122 | 123 | 124 | 125 | 126 |
127 |
# File net_calls.rb, line 16
128 | def net_listening()
129 | response = do_request("net_listening")
130 | response["result"]
131 | end
132 |
133 | 134 |
135 | 136 | 137 | 138 | 139 |
140 | 141 | 142 |
143 | 144 |
145 | net_peerCount() 147 | 148 | click to toggle source 149 | 150 |
151 | 152 | 153 |
154 | 155 |

See github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount

157 | 158 | 159 | 160 | 161 |
162 |
# File net_calls.rb, line 10
163 | def net_peerCount()
164 | response = do_request("net_peerCount")
165 | to_decimal response["result"]
166 | end
167 |
168 | 169 |
170 | 171 | 172 | 173 | 174 |
175 | 176 | 177 |
178 | 179 |
180 | net_version() 182 | 183 | click to toggle source 184 | 185 |
186 | 187 | 188 |
189 | 190 |

See github.com/ethereum/wiki/wiki/JSON-RPC#net_version

192 | 193 | 194 | 195 | 196 |
197 |
# File net_calls.rb, line 4
198 | def net_version()
199 | response = do_request("net_version")
200 | response["result"]
201 | end
202 |
203 | 204 |
205 | 206 | 207 | 208 | 209 |
210 | 211 | 212 |
213 | 214 |
215 |
216 | 217 | 218 | 223 | 224 | -------------------------------------------------------------------------------- /docs/js/searcher.js: -------------------------------------------------------------------------------- 1 | Searcher = function(data) { 2 | this.data = data; 3 | this.handlers = []; 4 | } 5 | 6 | Searcher.prototype = new function() { 7 | // search is performed in chunks of 1000 for non-blocking user input 8 | var CHUNK_SIZE = 1000; 9 | // do not try to find more than 100 results 10 | var MAX_RESULTS = 100; 11 | var huid = 1; 12 | var suid = 1; 13 | var runs = 0; 14 | 15 | this.find = function(query) { 16 | var queries = splitQuery(query); 17 | var regexps = buildRegexps(queries); 18 | var highlighters = buildHilighters(queries); 19 | var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++}; 20 | var _this = this; 21 | 22 | this.currentSuid = state.n; 23 | 24 | if (!query) return; 25 | 26 | var run = function() { 27 | // stop current search thread if new search started 28 | if (state.n != _this.currentSuid) return; 29 | 30 | var results = 31 | performSearch(_this.data, regexps, queries, highlighters, state); 32 | var hasMore = (state.limit > 0 && state.pass < 4); 33 | 34 | triggerResults.call(_this, results, !hasMore); 35 | if (hasMore) { 36 | setTimeout(run, 2); 37 | } 38 | runs++; 39 | }; 40 | runs = 0; 41 | 42 | // start search thread 43 | run(); 44 | } 45 | 46 | /* ----- Events ------ */ 47 | this.ready = function(fn) { 48 | fn.huid = huid; 49 | this.handlers.push(fn); 50 | } 51 | 52 | /* ----- Utilities ------ */ 53 | function splitQuery(query) { 54 | return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) { 55 | return string.match(/\S/); 56 | }); 57 | } 58 | 59 | function buildRegexps(queries) { 60 | return jQuery.map(queries, function(query) { 61 | return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i'); 62 | }); 63 | } 64 | 65 | function buildHilighters(queries) { 66 | return jQuery.map(queries, function(query) { 67 | return jQuery.map(query.split(''), function(l, i) { 68 | return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2); 69 | }).join(''); 70 | }); 71 | } 72 | 73 | // function longMatchRegexp(index, longIndex, regexps) { 74 | // for (var i = regexps.length - 1; i >= 0; i--){ 75 | // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false; 76 | // }; 77 | // return true; 78 | // } 79 | 80 | 81 | /* ----- Mathchers ------ */ 82 | 83 | /* 84 | * This record matches if the index starts with queries[0] and the record 85 | * matches all of the regexps 86 | */ 87 | function matchPassBeginning(index, longIndex, queries, regexps) { 88 | if (index.indexOf(queries[0]) != 0) return false; 89 | for (var i=1, l = regexps.length; i < l; i++) { 90 | if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) 91 | return false; 92 | }; 93 | return true; 94 | } 95 | 96 | /* 97 | * This record matches if the longIndex starts with queries[0] and the 98 | * longIndex matches all of the regexps 99 | */ 100 | function matchPassLongIndex(index, longIndex, queries, regexps) { 101 | if (longIndex.indexOf(queries[0]) != 0) return false; 102 | for (var i=1, l = regexps.length; i < l; i++) { 103 | if (!longIndex.match(regexps[i])) 104 | return false; 105 | }; 106 | return true; 107 | } 108 | 109 | /* 110 | * This record matches if the index contains queries[0] and the record 111 | * matches all of the regexps 112 | */ 113 | function matchPassContains(index, longIndex, queries, regexps) { 114 | if (index.indexOf(queries[0]) == -1) return false; 115 | for (var i=1, l = regexps.length; i < l; i++) { 116 | if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) 117 | return false; 118 | }; 119 | return true; 120 | } 121 | 122 | /* 123 | * This record matches if regexps[0] matches the index and the record 124 | * matches all of the regexps 125 | */ 126 | function matchPassRegexp(index, longIndex, queries, regexps) { 127 | if (!index.match(regexps[0])) return false; 128 | for (var i=1, l = regexps.length; i < l; i++) { 129 | if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) 130 | return false; 131 | }; 132 | return true; 133 | } 134 | 135 | 136 | /* ----- Highlighters ------ */ 137 | function highlightRegexp(info, queries, regexps, highlighters) { 138 | var result = createResult(info); 139 | for (var i=0, l = regexps.length; i < l; i++) { 140 | result.title = result.title.replace(regexps[i], highlighters[i]); 141 | result.namespace = result.namespace.replace(regexps[i], highlighters[i]); 142 | }; 143 | return result; 144 | } 145 | 146 | function hltSubstring(string, pos, length) { 147 | return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length); 148 | } 149 | 150 | function highlightQuery(info, queries, regexps, highlighters) { 151 | var result = createResult(info); 152 | var pos = 0; 153 | var lcTitle = result.title.toLowerCase(); 154 | 155 | pos = lcTitle.indexOf(queries[0]); 156 | if (pos != -1) { 157 | result.title = hltSubstring(result.title, pos, queries[0].length); 158 | } 159 | 160 | result.namespace = result.namespace.replace(regexps[0], highlighters[0]); 161 | for (var i=1, l = regexps.length; i < l; i++) { 162 | result.title = result.title.replace(regexps[i], highlighters[i]); 163 | result.namespace = result.namespace.replace(regexps[i], highlighters[i]); 164 | }; 165 | return result; 166 | } 167 | 168 | function createResult(info) { 169 | var result = {}; 170 | result.title = info[0]; 171 | result.namespace = info[1]; 172 | result.path = info[2]; 173 | result.params = info[3]; 174 | result.snippet = info[4]; 175 | result.badge = info[6]; 176 | return result; 177 | } 178 | 179 | /* ----- Searching ------ */ 180 | function performSearch(data, regexps, queries, highlighters, state) { 181 | var searchIndex = data.searchIndex; 182 | var longSearchIndex = data.longSearchIndex; 183 | var info = data.info; 184 | var result = []; 185 | var i = state.from; 186 | var l = searchIndex.length; 187 | var togo = CHUNK_SIZE; 188 | var matchFunc, hltFunc; 189 | 190 | while (state.pass < 4 && state.limit > 0 && togo > 0) { 191 | if (state.pass == 0) { 192 | matchFunc = matchPassBeginning; 193 | hltFunc = highlightQuery; 194 | } else if (state.pass == 1) { 195 | matchFunc = matchPassLongIndex; 196 | hltFunc = highlightQuery; 197 | } else if (state.pass == 2) { 198 | matchFunc = matchPassContains; 199 | hltFunc = highlightQuery; 200 | } else if (state.pass == 3) { 201 | matchFunc = matchPassRegexp; 202 | hltFunc = highlightRegexp; 203 | } 204 | 205 | for (; togo > 0 && i < l && state.limit > 0; i++, togo--) { 206 | if (info[i].n == state.n) continue; 207 | if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) { 208 | info[i].n = state.n; 209 | result.push(hltFunc(info[i], queries, regexps, highlighters)); 210 | state.limit--; 211 | } 212 | }; 213 | if (searchIndex.length <= i) { 214 | state.pass++; 215 | i = state.from = 0; 216 | } else { 217 | state.from = i; 218 | } 219 | } 220 | return result; 221 | } 222 | 223 | function triggerResults(results, isLast) { 224 | jQuery.each(this.handlers, function(i, fn) { 225 | fn.call(this, results, isLast) 226 | }) 227 | } 228 | } 229 | 230 | -------------------------------------------------------------------------------- /docs/ContractModel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | class ContractModel - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 83 | 84 |
85 |

86 | class ContractModel 87 |

88 | 89 |
90 | 91 |
92 | 93 | 94 | 95 | 96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 |
105 |
106 |

Attributes

107 |
108 | 109 | 110 |
111 |
112 | contractMethods[R] 114 |
115 | 116 |
117 | 118 | 119 | 120 |
121 |
122 | 123 |
124 | 125 | 126 | 127 |
128 |
129 |

Public Class Methods

130 |
131 | 132 | 133 |
134 | 135 |
136 | new(abi) 138 | 139 | click to toggle source 140 | 141 |
142 | 143 | 144 |
145 | 146 | 147 | 148 | 149 | 150 | 151 |
152 |
# File abi_tools.rb, line 22
153 | def initialize(abi)
154 |   @contractMethods = Set.new
155 |   for obj in abi
156 |     if obj["type"] == "function" then
157 |       inputs = obj["inputs"].map {|input| input["type"]}
158 |       method = obj["name"] + "(" + inputs.join(",") + ")"
159 |       @contractMethods.add method
160 |     end
161 |   end
162 | end
163 |
164 | 165 |
166 | 167 | 168 | 169 | 170 |
171 | 172 | 173 |
174 | 175 |
176 |
177 |

Public Instance Methods

178 |
179 | 180 | 181 |
182 | 183 |
184 | call(method, arguments) 186 | 187 | click to toggle source 188 | 189 |
190 | 191 | 192 |
193 | 194 | 195 | 196 | 197 | 198 | 199 |
200 |
# File abi_tools.rb, line 33
201 | def call(method, arguments)
202 |   if @contractMethods.include? method then
203 |     puts method.signature
204 |   end
205 | end
206 |
207 | 208 |
209 | 210 | 211 | 212 | 213 |
214 | 215 | 216 |
217 | 218 |
219 |
220 | 221 | 222 | 227 | 228 | -------------------------------------------------------------------------------- /lib/eth_calls.rb: -------------------------------------------------------------------------------- 1 | module Web3::EthCalls 2 | 3 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion 4 | def eth_protocolVersion() 5 | raise NotImplementedError.new "JSON-RPC call to eth_protocolVersion is not currently supported" 6 | end 7 | 8 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing 9 | def eth_syncing() 10 | response = do_request("eth_syncing") 11 | response["result"] 12 | end 13 | 14 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase 15 | def eth_coinbase() 16 | response = do_request("eth_coinbase") 17 | response["result"] 18 | end 19 | 20 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining 21 | def eth_mining() 22 | response = do_request("eth_mining") 23 | response["result"] 24 | end 25 | 26 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate 27 | def eth_hashrate() 28 | response = do_request("eth_hashrate") 29 | to_decimal response["result"] 30 | end 31 | 32 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice 33 | def eth_gasPrice() 34 | response = do_request("eth_gasPrice") 35 | to_decimal response["result"] 36 | end 37 | 38 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts 39 | def eth_accounts() 40 | response = do_request("eth_accounts") 41 | response["result"] 42 | end 43 | 44 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber 45 | def eth_blockNumber() 46 | response = do_request("eth_blockNumber") 47 | to_decimal response["result"] 48 | end 49 | 50 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance 51 | def eth_getBalance(address, block = "latest") 52 | response = do_request("eth_getBalance",[address, block]) 53 | to_decimal response["result"] 54 | end 55 | 56 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat 57 | def eth_getStorageAt(storage_address, position, block = "latest") 58 | response = do_request("eth_getStorageAt",[storage_address, to_hex(position), block]) 59 | response["result"] 60 | end 61 | 62 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount 63 | def eth_getTransactionCount(address, block = "latest") 64 | response = do_request("eth_getTransactionCount",[address, block]) 65 | to_decimal response["result"] 66 | end 67 | 68 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash 69 | def eth_getBlockTransactionCountByHash(data) 70 | response = do_request("eth_getBlockTransactionCountByHash",[data]) 71 | to_decimal response["result"] 72 | end 73 | 74 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber 75 | def eth_getBlockTransactionCountByNumber(block = "latest") 76 | response = do_request("eth_getBlockTransactionCountByNumber",[block]) 77 | to_decimal response["result"] 78 | end 79 | 80 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash 81 | def eth_getUncleCountByBlockHash(data) 82 | response = do_request("eth_getUncleCountByBlockHash",[data]) 83 | to_decimal response["result"] 84 | end 85 | 86 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber 87 | def eth_getUncleCountByBlockNumber(data) 88 | response = do_request("eth_getUncleCountByBlockNumber",[data]) 89 | to_decimal response["result"] 90 | end 91 | 92 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode 93 | def eth_getCode(address, block = "latest") 94 | response = do_request("eth_getCode",[address, block]) 95 | response["result"] 96 | end 97 | 98 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign 99 | def eth_sign(address, data) 100 | response = do_request("eth_sign",[address, data]) 101 | response["result"] 102 | end 103 | 104 | # Sends a transaction for posting to the ethereum network. The transaction_object 105 | # that is sent should look something like this: 106 | # 107 | # {"from"=> accounts[0], "to" => accounts[1], "value" => w3.ether_to_0xwei(0.001)} 108 | # 109 | # Other 0x-fomatted attributes that can be included in the transaction_object are: 110 | # "data" : formatted as hex 111 | # "gas", "gasPrice", "value", and "nonce" : formatted as "0x" + hex 112 | # 113 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction 114 | def eth_sendTransaction(transaction_object) 115 | response = do_request("eth_sendTransaction",[transaction_object]) 116 | response["result"] 117 | end 118 | 119 | # Returns pending transactions that belong to any of the users accounts 120 | # See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console#ethpendingtransactions 121 | def eth_pendingTransactions() 122 | response = do_request("eth_pendingTransactions") 123 | response["result"] 124 | end 125 | 126 | # Resends a transaction. These can ge retrieved from eth_pendingTransactions(). 127 | # gasPrice and gasLimit can be included together if the gas settings are being changed from 128 | # their original settings in the pending_transaction object 129 | # See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console#ethresend 130 | def eth_resend(pending_transaction, gasPrice=nil, gasLimit=nil) 131 | package = [pending_transaction] 132 | if gasPrice != nil 133 | package += [gasPrice, gasLimit] 134 | end 135 | response = do_request("eth_resend", package) 136 | response["result"] 137 | end 138 | 139 | # This sends a transaction that looks something like this: 140 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction 141 | def eth_sendRawTransaction(data) 142 | response = do_request("eth_sendRawTransaction",[data]) 143 | response["result"] 144 | end 145 | 146 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call 147 | def eth_call(trans_object,block="latest") 148 | response = do_request("eth_call",[trans_object, block]) 149 | response["result"] 150 | end 151 | 152 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas 153 | def eth_estimateGas(trans_object) 154 | response = do_request("eth_estimateGas",[trans_object]) 155 | response["result"] 156 | end 157 | 158 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash 159 | def eth_getBlockByHash(hash, full_transactions = true) 160 | response = do_request("eth_getBlockByHash",[hash, full_transactions]) 161 | response["result"] 162 | end 163 | 164 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber 165 | def eth_getBlockByNumber(number, full_transactions = true) 166 | response = do_request("eth_getBlockByNumber",[number, full_transactions]) 167 | response["result"] 168 | end 169 | 170 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash 171 | def eth_getTransactionByHash(hash) 172 | response = do_request("eth_getTransactionByHash",[hash]) 173 | response["result"] 174 | end 175 | 176 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex 177 | def eth_getTransactionByBlockHashAndIndex(hash, index) 178 | response = do_request("eth_getTransactionByBlockHashAndIndex",[hash, index]) 179 | response["result"] 180 | end 181 | 182 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex 183 | def eth_getTransactionByBlockNumberAndIndex(number, index) 184 | response = do_request("eth_getTransactionByBlockNumberAndIndex",[number, index]) 185 | response["result"] 186 | end 187 | 188 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt 189 | def eth_getTransactionReceipt(hash) 190 | response = do_request("eth_getTransactionReceipt",[hash]) 191 | response["result"] 192 | end 193 | 194 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex 195 | def eth_getUncleByBlockHashAndIndex(hash, index) 196 | response = do_request("eth_getUncleByBlockHashAndIndex",[hash, index]) 197 | response["result"] 198 | end 199 | 200 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblocknumberandindex 201 | def eth_getUncleByBlockNumberAndIndex(number, index) 202 | response = do_request("eth_getUncleByBlockNumberAndIndex",[number, index]) 203 | response["result"] 204 | end 205 | 206 | # deprecated 207 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcompilers 208 | def eth_getCompilers() 209 | response = do_request("eth_getCompilers") 210 | response["result"] 211 | end 212 | 213 | #deprecated 214 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilelll 215 | def eth_compileLLL(code) 216 | response = do_request("eth_compileLLL",[code]) 217 | response["result"] 218 | end 219 | 220 | # deprecated 221 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity 222 | def eth_compileSolidity(code) 223 | response = do_request("eth_compileSolidity",[code]) 224 | response["result"] 225 | end 226 | 227 | # deprecated 228 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compileserpent 229 | def eth_compileSerpent(code) 230 | response = do_request("eth_compileSerpent",[code]) 231 | response["result"] 232 | end 233 | 234 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter 235 | def eth_newFilter(fromBlock, toBlock, address, topics) 236 | response = do_request("$CODE",[fromBlock, toBlock, address, topics]) 237 | to_decimal response["result"] 238 | end 239 | 240 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter 241 | def eth_newBlockFilter() 242 | response = do_request("eth_newBlockFilter") 243 | to_decimal response["result"] 244 | end 245 | 246 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter 247 | def eth_newPendingTransactionFilter() 248 | response = do_request("eth_newPendingTransactionFilter") 249 | to_decimal response["result"] 250 | end 251 | 252 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter 253 | def eth_uninstallFilter(id) 254 | response = do_request("eth_uninstallFilter",[id]) 255 | response["result"] 256 | end 257 | 258 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges 259 | def eth_getFilterChanges(id) 260 | response = do_request("eth_getFilterChanges",[id]) 261 | response["result"] 262 | end 263 | 264 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs 265 | def eth_getFilterLogs(id) 266 | response = do_request("eth_getFilterLogs",[id]) 267 | response["result"] 268 | end 269 | 270 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs 271 | def eth_getLogs(filter_obj) 272 | response = do_request("eth_getLogs",[filter_obj]) 273 | response["result"] 274 | end 275 | 276 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork 277 | def eth_getWork() 278 | response = do_request("eth_getWork") 279 | response["result"] 280 | end 281 | 282 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork 283 | def eth_submitWork(nonce, powHash, mixDigest) 284 | response = do_request("eth_submitWork",[nonce, powHash, mixDigest]) 285 | response["result"] 286 | end 287 | 288 | # See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate 289 | def eth_submitHashrate(hashrate, id) 290 | response = do_request("eth_submitHashrate",[hashrate, id]) 291 | response["result"] 292 | end 293 | end 294 | -------------------------------------------------------------------------------- /docs/css/style.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; } 3 | 4 | body { 5 | font-family: Lucida Grande, Verdana, Arial, Helvetica, sans-serif; 6 | font-size: 90%; 7 | margin: 0; 8 | padding: 0; 9 | background: white; 10 | color: black; } 11 | 12 | #wrapper { 13 | min-height: 100%; 14 | height: auto !important; 15 | height: 100%; 16 | margin: 0 auto -43px; } 17 | 18 | #footer-push { 19 | height: 43px; } 20 | 21 | div.header, #footer { 22 | background: #eeeeee; } 23 | 24 | #footer { 25 | border-top: 1px solid silver; 26 | margin-top: 12px; 27 | padding: 0 2em; 28 | line-height: 30px; 29 | text-align: center; 30 | font-variant: small-caps; 31 | font-size: 95%; } 32 | 33 | .clearing:after { 34 | content: "."; 35 | visibility: hidden; 36 | height: 0; 37 | display: block; 38 | clear: both; } 39 | * html .clearing { 40 | height: 1px; } 41 | .clearing *:first-child + html { 42 | overflow: hidden; } 43 | 44 | h1, h2, h3, h4, h5, h6 { 45 | margin: 0; 46 | font-weight: normal; } 47 | 48 | a { 49 | color: #0b3e71; } 50 | a:hover { 51 | background: #336699; 52 | text-decoration: none; 53 | color: #eeeeff; } 54 | 55 | #diagram img { 56 | border: 0; } 57 | 58 | #description a, .method .description a, .header a { 59 | color: #336699; } 60 | #description a:hover, .method .description a:hover, .header a:hover { 61 | color: #eeeeee; } 62 | #description h1 a, #description h2 a, #description h3 a, #description h4 a, #description h5 a, #description h6 a, .method .description h1 a, .method .description h2 a, .method .description h3 a, .method .description h4 a, .method .description h5 a, .method .description h6 a, .header h1 a, .header h2 a, .header h3 a, .header h4 a, .header h5 a, .header h6 a { 63 | color: #0b3e71; } 64 | 65 | ol { 66 | margin: 0; 67 | padding: 0; 68 | list-style: none; } 69 | ol li { 70 | margin-left: 0; 71 | white-space: nowrap; } 72 | ol li.other { 73 | display: none; } 74 | 75 | ol.expanded li.other { 76 | display: list-item; } 77 | 78 | table { 79 | margin-bottom: 1em; 80 | font-size: 1em; 81 | border-collapse: collapse; } 82 | table td, table th { 83 | padding: 0.4em 0.8em; } 84 | table thead { 85 | background-color: #e8e8e8; } 86 | table thead th { 87 | font-variant: small-caps; 88 | color: #666666; } 89 | table tr { 90 | border-bottom: 1px solid silver; } 91 | 92 | #index a.show, div.header a.show { 93 | text-decoration: underline; 94 | font-style: italic; 95 | color: #666666; } 96 | #index a.show:after, div.header a.show:after { 97 | content: " ..."; } 98 | #index a.show:hover, div.header a.show:hover { 99 | color: black; 100 | background: #ffffee; } 101 | 102 | #index { 103 | font: 85%/1.2 Arial, Helvetica, sans-serif; } 104 | #index a { 105 | text-decoration: none; } 106 | #index h1 { 107 | padding: 0.2em 0.5em 0.1em; 108 | background: #cccccc; 109 | font: small-caps 1.2em Georgia, serif; 110 | color: #333333; 111 | border-bottom: 1px solid gray; } 112 | #index form { 113 | margin: 0; 114 | padding: 0; } 115 | #index form input { 116 | margin: 0.4em 3px 0 0.4em; 117 | width: 80%; } 118 | #index form #search.untouched { 119 | color: #777777; } 120 | #index form .clear_button { 121 | -moz-border-radius: 7px; 122 | -webkit-border-radius: 7px; 123 | background: #aaaaaa; 124 | color: white; 125 | padding: 0 5px 1px 5px; 126 | cursor: pointer; } 127 | #index ol { 128 | padding: 0.4em 0.5em; } 129 | #index ol li { 130 | white-space: nowrap; } 131 | #index #index-entries li a { 132 | padding: 1px 2px; } 133 | #index #index-entries.classes { 134 | font-size: 1.1em; } 135 | #index #index-entries.classes ol { 136 | padding: 0; } 137 | #index #index-entries.classes span.nodoc { 138 | display: none; } 139 | #index #index-entries.classes span.nodoc, #index #index-entries.classes a { 140 | font-weight: bold; } 141 | #index #index-entries.classes .parent { 142 | font-weight: normal; } 143 | #index #index-entries.methods li, #index #search-results.methods li { 144 | margin-bottom: 0.2em; } 145 | #index #index-entries.methods li a .method_name, #index #search-results.methods li a .method_name { 146 | margin-right: 0.25em; } 147 | #index #index-entries.methods li a .module_name, #index #search-results.methods li a .module_name { 148 | color: #666666; } 149 | #index #index-entries.methods li a:hover .module_name, #index #search-results.methods li a:hover .module_name { 150 | color: #dddddd; } 151 | 152 | #attribute-list .context-item-name { 153 | font-weight: bold; } 154 | 155 | div.header { 156 | font-size: 80%; 157 | padding: 0.5em 2%; 158 | font-family: Arial, Helvetica, sans-serif; 159 | border-bottom: 1px solid silver; } 160 | div.header .name { 161 | font-size: 1.6em; 162 | font-family: Georgia, serif; } 163 | div.header .name .type { 164 | color: #666666; 165 | font-size: 80%; 166 | font-variant: small-caps; } 167 | div.header h1.name { 168 | font-size: 2.2em; } 169 | div.header .paths, div.header .last-update, div.header .parent { 170 | color: #666666; } 171 | div.header .last-update .datetime { 172 | color: #484848; } 173 | div.header .parent { 174 | margin-top: 0.3em; } 175 | div.header .parent strong { 176 | font-weight: normal; 177 | color: #484848; } 178 | 179 | #content { 180 | padding: 12px 2%; } 181 | div.class #content { 182 | position: relative; 183 | width: 72%; } 184 | #content pre, #content .method .synopsis { 185 | font: 14px Monaco, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace; } 186 | #content pre { 187 | color: black; 188 | background: #eeeeee; 189 | border: 1px solid silver; 190 | padding: 0.5em 0.8em; 191 | overflow: auto; } 192 | #content p code, #content p tt, #content li code, #content li tt, #content dl code, #content dl tt { 193 | font: 14px Monaco, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace; 194 | background: #ffffe3; 195 | padding: 2px 3px; 196 | line-height: 1.4; } 197 | #content h1 code, #content h1 tt, #content h2 code, #content h2 tt, #content h3 code, #content h3 tt, #content h4 code, #content h4 tt, #content h5 code, #content h5 tt, #content h6 code, #content h6 tt { 198 | font-size: 1.1em; } 199 | #content #text { 200 | position: relative; } 201 | #content #description p { 202 | margin-top: 0.5em; } 203 | #content #description h1, #content #description h2, #content #description h3, #content #description h4, #content #description h5, #content #description h6 { 204 | font-family: Georgia, serif; } 205 | #content #description h1 { 206 | font-size: 2.2em; 207 | margin-bottom: 0.2em; 208 | border-bottom: 3px double #d8d8d8; 209 | padding-bottom: 0.1em; } 210 | #content #description h2 { 211 | font-size: 1.8em; 212 | color: #0e3062; 213 | margin: 0.8em 0 0.3em 0; } 214 | #content #description h3 { 215 | font-size: 1.6em; 216 | margin: 0.8em 0 0.3em 0; 217 | color: #666666; } 218 | #content #description h4 { 219 | font-size: 1.4em; 220 | margin: 0.8em 0 0.3em 0; } 221 | #content #description h5 { 222 | font-size: 1.2em; 223 | margin: 0.8em 0 0.3em 0; 224 | color: #0e3062; } 225 | #content #description h6 { 226 | font-size: 1em; 227 | margin: 0.8em 0 0.3em 0; 228 | color: #666666; } 229 | #content #description ul, #content #description ol, #content .method .description ul, #content .method .description ol { 230 | margin: 0.8em 0; 231 | padding-left: 1.5em; } 232 | #content #description ol, #content .method .description ol { 233 | list-style: decimal; } 234 | #content #description ol li, #content .method .description ol li { 235 | white-space: normal; } 236 | #content table.rdoc-list { 237 | border-collapse: collapse; 238 | border-spacing: 0; } 239 | #content table.rdoc-list tr { 240 | background-color: white; } 241 | #content table.rdoc-list tr:nth-child(2n) { 242 | background-color: #f8f8f8; } 243 | #content table.rdoc-list td.label { 244 | font-weight: bold; } 245 | #content table.rdoc-list td { 246 | border: 1px solid #ddd; 247 | padding: 6px 13px; } 248 | 249 | #method-list { 250 | position: absolute; 251 | top: 0px; 252 | right: -33%; 253 | width: 28%; 254 | background: #eeeeee; 255 | border: 1px solid silver; 256 | padding: 0.4em 1%; 257 | overflow: hidden; } 258 | #method-list h2 { 259 | font-size: 1.3em; } 260 | #method-list h3 { 261 | font-variant: small-caps; 262 | text-transform: capitalize; 263 | font-family: Georgia, serif; 264 | color: #666666; 265 | font-size: 1.1em; } 266 | #method-list ol { 267 | padding: 0 0 0.5em 0.5em; } 268 | 269 | #context { 270 | border-top: 1px dashed silver; 271 | margin-top: 1em; 272 | margin-bottom: 1em; } 273 | 274 | #context h2, #section h2 { 275 | font: small-caps 1.2em Georgia, serif; 276 | color: #444444; 277 | margin: 1em 0 0.2em 0; } 278 | 279 | #methods .method { 280 | border: 1px solid silver; 281 | margin-top: 0.5em; 282 | background: #eeeeee; } 283 | #methods .method .synopsis { 284 | color: black; 285 | background: silver; 286 | padding: 0.2em 1em; } 287 | #methods .method .synopsis .name { 288 | font-weight: bold; } 289 | #methods .method .synopsis a { 290 | text-decoration: none; } 291 | #methods .method .description { 292 | padding: 0 1em; } 293 | #methods .method .description pre { 294 | background: #f8f8f8; } 295 | #methods .method .source { 296 | margin: 0.5em 0; } 297 | #methods .method .source-toggle { 298 | font-size: 85%; 299 | margin-left: 1em; } 300 | #methods .public-class { 301 | background: #ffffe4; } 302 | #methods .public-instance .synopsis { 303 | color: #eeeeee; 304 | background: #336699; } 305 | 306 | #content .method .source pre, #content pre.ruby, #methods .method .description pre.ruby { 307 | background: #262626; 308 | color: #ffdead; 309 | margin: 1em; 310 | padding: 0.5em; 311 | border: 1px dashed #999999; 312 | overflow: auto; } 313 | #content .method .source pre .ruby-constant, #content pre.ruby .ruby-constant, #methods .method .description pre.ruby .ruby-constant { 314 | color: #7fffd4; 315 | background: transparent; } 316 | #content .method .source pre .ruby-keyword, #content pre.ruby .ruby-keyword, #methods .method .description pre.ruby .ruby-keyword { 317 | color: aqua; 318 | background: transparent; } 319 | #content .method .source pre .ruby-ivar, #content pre.ruby .ruby-ivar, #methods .method .description pre.ruby .ruby-ivar { 320 | color: #eedd82; 321 | background: transparent; } 322 | #content .method .source pre .ruby-operator, #content pre.ruby .ruby-operator, #methods .method .description pre.ruby .ruby-operator { 323 | color: #00ffee; 324 | background: transparent; } 325 | #content .method .source pre .ruby-identifier, #content pre.ruby .ruby-identifier, #methods .method .description pre.ruby .ruby-identifier { 326 | color: #ffdead; 327 | background: transparent; } 328 | #content .method .source pre .ruby-string, #content pre.ruby .ruby-string, #methods .method .description pre.ruby .ruby-string { 329 | color: #faa; 330 | background: transparent; } 331 | #content .method .source pre .ruby-node, #content pre.ruby .ruby-node, #methods .method .description pre.ruby .ruby-node { 332 | color: #ffa07a; 333 | background: transparent; } 334 | #content .method .source pre .ruby-comment, #content pre.ruby .ruby-comment, #methods .method .description pre.ruby .ruby-comment { 335 | color: #fdf; 336 | font-weight: bold; 337 | background: transparent; } 338 | #content .method .source pre .ruby-regexp, #content pre.ruby .ruby-regexp, #methods .method .description pre.ruby .ruby-regexp { 339 | color: #ffa07a; 340 | background: transparent; } 341 | #content .method .source pre .ruby-value, #content pre.ruby .ruby-value, #methods .method .description pre.ruby .ruby-value { 342 | color: #7fffd4; 343 | background: transparent; } 344 | -------------------------------------------------------------------------------- /docs/css/rdoc.css: -------------------------------------------------------------------------------- 1 | /* 2 | * "Darkfish" Rdoc CSS 3 | * $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $ 4 | * 5 | * Author: Michael Granger 6 | * 7 | */ 8 | 9 | /* vim: ft=css et sw=2 ts=2 sts=2 */ 10 | /* Base Green is: #6C8C22 */ 11 | 12 | * { padding: 0; margin: 0; } 13 | 14 | body { 15 | background: #fafafa; 16 | font-family: Lato, sans-serif; 17 | font-weight: 300; 18 | } 19 | 20 | h1 span, 21 | h2 span, 22 | h3 span, 23 | h4 span, 24 | h5 span, 25 | h6 span { 26 | position: relative; 27 | 28 | display: none; 29 | padding-left: 1em; 30 | line-height: 0; 31 | vertical-align: baseline; 32 | font-size: 10px; 33 | } 34 | 35 | h1 span { top: -1.3em; } 36 | h2 span { top: -1.2em; } 37 | h3 span { top: -1.0em; } 38 | h4 span { top: -0.8em; } 39 | h5 span { top: -0.5em; } 40 | h6 span { top: -0.5em; } 41 | 42 | h1:hover span, 43 | h2:hover span, 44 | h3:hover span, 45 | h4:hover span, 46 | h5:hover span, 47 | h6:hover span { 48 | display: inline; 49 | } 50 | 51 | :link, 52 | :visited { 53 | color: #6C8C22; 54 | text-decoration: none; 55 | } 56 | 57 | :link:hover, 58 | :visited:hover { 59 | border-bottom: 1px dotted #6C8C22; 60 | } 61 | 62 | code, 63 | pre { 64 | font-family: "Source Code Pro", Monaco, monospace; 65 | } 66 | 67 | /* @group Generic Classes */ 68 | 69 | .initially-hidden { 70 | display: none; 71 | } 72 | 73 | #search-field { 74 | width: 98%; 75 | background: white; 76 | border: none; 77 | height: 1.5em; 78 | -webkit-border-radius: 4px; 79 | -moz-border-radius: 4px; 80 | border-radius: 4px; 81 | text-align: left; 82 | } 83 | #search-field:focus { 84 | background: #f1edba; 85 | } 86 | #search-field:-moz-placeholder, 87 | #search-field::-webkit-input-placeholder { 88 | font-weight: bold; 89 | color: #666; 90 | } 91 | 92 | .missing-docs { 93 | font-size: 120%; 94 | background: white url(images/wrench_orange.png) no-repeat 4px center; 95 | color: #ccc; 96 | line-height: 2em; 97 | border: 1px solid #d00; 98 | opacity: 1; 99 | padding-left: 20px; 100 | text-indent: 24px; 101 | letter-spacing: 3px; 102 | font-weight: bold; 103 | -webkit-border-radius: 5px; 104 | -moz-border-radius: 5px; 105 | } 106 | 107 | .target-section { 108 | border: 2px solid #dcce90; 109 | border-left-width: 8px; 110 | padding: 0 1em; 111 | background: #fff3c2; 112 | } 113 | 114 | /* @end */ 115 | 116 | /* @group Index Page, Standalone file pages */ 117 | .table-of-contents ul { 118 | margin: 1em; 119 | list-style: none; 120 | } 121 | 122 | .table-of-contents ul ul { 123 | margin-top: 0.25em; 124 | } 125 | 126 | .table-of-contents ul :link, 127 | .table-of-contents ul :visited { 128 | font-size: 16px; 129 | } 130 | 131 | .table-of-contents li { 132 | margin-bottom: 0.25em; 133 | } 134 | 135 | .table-of-contents li .toc-toggle { 136 | width: 16px; 137 | height: 16px; 138 | background: url(images/add.png) no-repeat; 139 | } 140 | 141 | .table-of-contents li .toc-toggle.open { 142 | background: url(images/delete.png) no-repeat; 143 | } 144 | 145 | /* @end */ 146 | 147 | /* @group Top-Level Structure */ 148 | 149 | nav { 150 | float: left; 151 | width: 260px; 152 | font-family: Helvetica, sans-serif; 153 | font-size: 14px; 154 | } 155 | 156 | main { 157 | display: block; 158 | margin: 0 2em 5em 260px; 159 | padding-left: 20px; 160 | min-width: 340px; 161 | font-size: 16px; 162 | } 163 | 164 | main h1, 165 | main h2, 166 | main h3, 167 | main h4, 168 | main h5, 169 | main h6 { 170 | font-family: Helvetica, sans-serif; 171 | } 172 | 173 | .table-of-contents main { 174 | margin-left: 2em; 175 | } 176 | 177 | #validator-badges { 178 | clear: both; 179 | margin: 1em 1em 2em; 180 | font-size: smaller; 181 | } 182 | 183 | /* @end */ 184 | 185 | /* @group navigation */ 186 | nav { 187 | margin-bottom: 1em; 188 | } 189 | 190 | nav .nav-section { 191 | margin-top: 2em; 192 | border-top: 2px solid #aaa; 193 | font-size: 90%; 194 | overflow: hidden; 195 | } 196 | 197 | nav h2 { 198 | margin: 0; 199 | padding: 2px 8px 2px 8px; 200 | background-color: #e8e8e8; 201 | color: #555; 202 | font-size: 125%; 203 | text-align: center; 204 | } 205 | 206 | nav h3, 207 | #table-of-contents-navigation { 208 | margin: 0; 209 | padding: 2px 8px 2px 8px; 210 | text-align: right; 211 | background-color: #e8e8e8; 212 | color: #555; 213 | } 214 | 215 | nav ul, 216 | nav dl, 217 | nav p { 218 | padding: 4px 8px 0; 219 | list-style: none; 220 | } 221 | 222 | #project-navigation .nav-section { 223 | margin: 0; 224 | border-top: 0; 225 | } 226 | 227 | #home-section h2 { 228 | text-align: center; 229 | } 230 | 231 | #table-of-contents-navigation { 232 | font-size: 1.2em; 233 | font-weight: bold; 234 | text-align: center; 235 | } 236 | 237 | #search-section { 238 | margin-top: 0; 239 | border-top: 0; 240 | } 241 | 242 | #search-field-wrapper { 243 | border-top: 1px solid #aaa; 244 | border-bottom: 1px solid #aaa; 245 | padding: 3px 8px; 246 | background-color: #e8e8e8; 247 | color: #555; 248 | } 249 | 250 | ul.link-list li { 251 | white-space: nowrap; 252 | line-height: 1.4em; 253 | } 254 | 255 | ul.link-list .type { 256 | font-size: 8px; 257 | text-transform: uppercase; 258 | color: white; 259 | background: #969696; 260 | padding: 2px 4px; 261 | -webkit-border-radius: 5px; 262 | } 263 | 264 | .calls-super { 265 | background: url(images/arrow_up.png) no-repeat right center; 266 | } 267 | 268 | /* @end */ 269 | 270 | /* @group Documentation Section */ 271 | main { 272 | color: #333; 273 | } 274 | 275 | main > h1:first-child, 276 | main > h2:first-child, 277 | main > h3:first-child, 278 | main > h4:first-child, 279 | main > h5:first-child, 280 | main > h6:first-child { 281 | margin-top: 0px; 282 | } 283 | 284 | main sup { 285 | vertical-align: super; 286 | font-size: 0.8em; 287 | } 288 | 289 | /* The heading with the class name */ 290 | main h1[class] { 291 | margin-top: 0; 292 | margin-bottom: 1em; 293 | font-size: 2em; 294 | color: #6C8C22; 295 | } 296 | 297 | main h1 { 298 | margin: 2em 0 0.5em; 299 | font-size: 1.7em; 300 | } 301 | 302 | main h2 { 303 | margin: 2em 0 0.5em; 304 | font-size: 1.5em; 305 | } 306 | 307 | main h3 { 308 | margin: 2em 0 0.5em; 309 | font-size: 1.2em; 310 | } 311 | 312 | main h4 { 313 | margin: 2em 0 0.5em; 314 | font-size: 1.1em; 315 | } 316 | 317 | main h5 { 318 | margin: 2em 0 0.5em; 319 | font-size: 1em; 320 | } 321 | 322 | main h6 { 323 | margin: 2em 0 0.5em; 324 | font-size: 1em; 325 | } 326 | 327 | main p { 328 | margin: 0 0 0.5em; 329 | line-height: 1.4em; 330 | } 331 | 332 | main pre { 333 | margin: 1.2em 0.5em; 334 | padding: 1em; 335 | font-size: 0.8em; 336 | } 337 | 338 | main hr { 339 | margin: 1.5em 1em; 340 | border: 2px solid #ddd; 341 | } 342 | 343 | main blockquote { 344 | margin: 0 2em 1.2em 1.2em; 345 | padding-left: 0.5em; 346 | border-left: 2px solid #ddd; 347 | } 348 | 349 | main ol, 350 | main ul { 351 | margin: 1em 2em; 352 | } 353 | 354 | main li > p { 355 | margin-bottom: 0.5em; 356 | } 357 | 358 | main dl { 359 | margin: 1em 0.5em; 360 | } 361 | 362 | main dt { 363 | margin-bottom: 0.5em; 364 | font-weight: bold; 365 | } 366 | 367 | main dd { 368 | margin: 0 1em 1em 0.5em; 369 | } 370 | 371 | main header h2 { 372 | margin-top: 2em; 373 | border-width: 0; 374 | border-top: 4px solid #bbb; 375 | font-size: 130%; 376 | } 377 | 378 | main header h3 { 379 | margin: 2em 0 1.5em; 380 | border-width: 0; 381 | border-top: 3px solid #bbb; 382 | font-size: 120%; 383 | } 384 | 385 | .documentation-section-title { 386 | position: relative; 387 | } 388 | .documentation-section-title .section-click-top { 389 | position: absolute; 390 | top: 6px; 391 | left: 12px; 392 | font-size: 10px; 393 | color: #9b9877; 394 | visibility: hidden; 395 | padding-left: 0.5px; 396 | } 397 | 398 | .documentation-section-title:hover .section-click-top { 399 | visibility: visible; 400 | } 401 | 402 | .constants-list > dl { 403 | margin: 1em 0 2em; 404 | border: 0; 405 | } 406 | 407 | .constants-list > dl dt { 408 | margin-bottom: 0.75em; 409 | padding-left: 0; 410 | font-family: "Source Code Pro", Monaco, monospace; 411 | font-size: 110%; 412 | } 413 | 414 | .constants-list > dl dt a { 415 | color: inherit; 416 | } 417 | 418 | .constants-list > dl dd { 419 | margin: 0 0 2em 0; 420 | padding: 0; 421 | color: #666; 422 | } 423 | 424 | .documentation-section h2 { 425 | position: relative; 426 | } 427 | 428 | .documentation-section h2 a { 429 | position: absolute; 430 | top: 8px; 431 | right: 10px; 432 | font-size: 12px; 433 | color: #9b9877; 434 | visibility: hidden; 435 | } 436 | 437 | .documentation-section h2:hover a { 438 | visibility: visible; 439 | } 440 | 441 | /* @group Method Details */ 442 | 443 | main .method-source-code { 444 | display: none; 445 | } 446 | 447 | main .method-description .method-calls-super { 448 | color: #333; 449 | font-weight: bold; 450 | } 451 | 452 | main .method-detail { 453 | margin-bottom: 2.5em; 454 | cursor: pointer; 455 | } 456 | 457 | main .method-detail:target { 458 | margin-left: -10px; 459 | border-left: 10px solid #f1edba; 460 | } 461 | 462 | main .method-heading { 463 | position: relative; 464 | font-family: "Source Code Pro", Monaco, monospace; 465 | font-size: 110%; 466 | font-weight: bold; 467 | color: #333; 468 | } 469 | main .method-heading :link, 470 | main .method-heading :visited { 471 | color: inherit; 472 | } 473 | main .method-click-advice { 474 | position: absolute; 475 | top: 2px; 476 | right: 5px; 477 | font-size: 12px; 478 | color: #9b9877; 479 | visibility: hidden; 480 | padding-right: 20px; 481 | line-height: 20px; 482 | background: url(images/zoom.png) no-repeat right top; 483 | } 484 | main .method-heading:hover .method-click-advice { 485 | visibility: visible; 486 | } 487 | 488 | main .method-alias .method-heading { 489 | color: #666; 490 | } 491 | 492 | main .method-description, 493 | main .aliases { 494 | margin-top: 0.75em; 495 | color: #333; 496 | } 497 | 498 | main .aliases { 499 | padding-top: 4px; 500 | font-style: italic; 501 | cursor: default; 502 | } 503 | main .method-description ul { 504 | margin-left: 1.5em; 505 | } 506 | 507 | main #attribute-method-details .method-detail:hover { 508 | background-color: transparent; 509 | cursor: default; 510 | } 511 | main .attribute-access-type { 512 | text-transform: uppercase; 513 | padding: 0 1em; 514 | } 515 | /* @end */ 516 | 517 | /* @end */ 518 | 519 | /* @group Source Code */ 520 | 521 | pre { 522 | margin: 0.5em 0; 523 | border: 1px dashed #999; 524 | padding: 0.5em; 525 | background: #262626; 526 | color: white; 527 | overflow: auto; 528 | } 529 | 530 | .ruby-constant { color: #7fffd4; background: transparent; } 531 | .ruby-keyword { color: #00ffff; background: transparent; } 532 | .ruby-ivar { color: #eedd82; background: transparent; } 533 | .ruby-operator { color: #00ffee; background: transparent; } 534 | .ruby-identifier { color: #ffdead; background: transparent; } 535 | .ruby-node { color: #ffa07a; background: transparent; } 536 | .ruby-comment { color: #dc0000; background: transparent; } 537 | .ruby-regexp { color: #ffa07a; background: transparent; } 538 | .ruby-value { color: #7fffd4; background: transparent; } 539 | 540 | /* @end */ 541 | 542 | 543 | /* @group search results */ 544 | #search-results { 545 | font-family: Lato, sans-serif; 546 | font-weight: 300; 547 | } 548 | 549 | #search-results .search-match { 550 | font-family: Helvetica, sans-serif; 551 | font-weight: normal; 552 | } 553 | 554 | #search-results .search-selected { 555 | background: #e8e8e8; 556 | border-bottom: 1px solid transparent; 557 | } 558 | 559 | #search-results li { 560 | list-style: none; 561 | border-bottom: 1px solid #aaa; 562 | margin-bottom: 0.5em; 563 | } 564 | 565 | #search-results li:last-child { 566 | border-bottom: none; 567 | margin-bottom: 0; 568 | } 569 | 570 | #search-results li p { 571 | padding: 0; 572 | margin: 0.5em; 573 | } 574 | 575 | #search-results .search-namespace { 576 | font-weight: bold; 577 | } 578 | 579 | #search-results li em { 580 | background: yellow; 581 | font-style: normal; 582 | } 583 | 584 | #search-results pre { 585 | margin: 0.5em; 586 | font-family: "Source Code Pro", Monaco, monospace; 587 | } 588 | 589 | /* @end */ 590 | 591 | -------------------------------------------------------------------------------- /docs/Web3/MinerCalls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | module Web3::MinerCalls - RDoc Documentation 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 86 | 87 |
88 |

89 | module Web3::MinerCalls 90 |

91 | 92 |
93 | 94 |
95 | 96 | 97 | 98 | 99 |
100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 |
111 |

Public Instance Methods

112 |
113 | 114 | 115 |
116 | 117 |
118 | miner_makeDAG(number) 120 | 121 | click to toggle source 122 | 123 |
124 | 125 | 126 |
127 | 128 |

See github.com/ethereum/wiki/wiki/JSON-RPC#miner_makedag

130 | 131 | 132 | 133 | 134 |
135 |
# File miner_calls.rb, line 4
136 | def miner_makeDAG(number)
137 | response = do_request("miner_makeDAG",[number])
138 | response["result"]
139 | end
140 |
141 | 142 |
143 | 144 | 145 | 146 | 147 |
148 | 149 | 150 |
151 | 152 |
153 | miner_setExtra(extra) 155 | 156 | click to toggle source 157 | 158 |
159 | 160 | 161 |
162 | 163 |

See github.com/ethereum/wiki/wiki/JSON-RPC#miner_setextra

165 | 166 | 167 | 168 | 169 |
170 |
# File miner_calls.rb, line 10
171 | def miner_setExtra(extra)
172 | response = do_request("miner_setExtra",[extra])
173 | response["result"]
174 | end
175 |
176 | 177 |
178 | 179 | 180 | 181 | 182 |
183 | 184 | 185 |
186 | 187 |
188 | miner_setGasPrice(gasPrice) 190 | 191 | click to toggle source 192 | 193 |
194 | 195 | 196 |
197 | 198 |

See github.com/ethereum/wiki/wiki/JSON-RPC#miner_setgasprice

200 | 201 | 202 | 203 | 204 |
205 |
# File miner_calls.rb, line 16
206 | def miner_setGasPrice(gasPrice)
207 | response = do_request("miner_setGasPrice",[gasPrice])
208 | response["result"]
209 | end
210 |
211 | 212 |
213 | 214 | 215 | 216 | 217 |
218 | 219 | 220 |
221 | 222 |
223 | miner_start(threads) 225 | 226 | click to toggle source 227 | 228 |
229 | 230 | 231 |
232 | 233 |

See github.com/ethereum/wiki/wiki/JSON-RPC#miner_start

235 | 236 | 237 | 238 | 239 |
240 |
# File miner_calls.rb, line 22
241 | def miner_start(threads)
242 | response = do_request("miner_start",[threads])
243 | response["result"]
244 | end
245 |
246 | 247 |
248 | 249 | 250 | 251 | 252 |
253 | 254 | 255 |
256 | 257 |
258 | miner_startAutoDAG(number) 260 | 261 | click to toggle source 262 | 263 |
264 | 265 | 266 |
267 | 268 |

See github.com/ethereum/wiki/wiki/JSON-RPC#miner_startautodag

270 | 271 | 272 | 273 | 274 |
275 |
# File miner_calls.rb, line 28
276 | def miner_startAutoDAG(number)
277 | response = do_request("miner_startAutoDAG",[number])
278 | response["result"]
279 | end
280 |
281 | 282 |
283 | 284 | 285 | 286 | 287 |
288 | 289 | 290 |
291 | 292 |
293 | miner_stop() 295 | 296 | click to toggle source 297 | 298 |
299 | 300 | 301 |
302 | 303 |

See github.com/ethereum/wiki/wiki/JSON-RPC#miner_stop

305 | 306 | 307 | 308 | 309 |
310 |
# File miner_calls.rb, line 34
311 | def miner_stop()
312 | response = do_request("miner_stop")
313 | response["result"]
314 | end
315 |
316 | 317 |
318 | 319 | 320 | 321 | 322 |
323 | 324 | 325 |
326 | 327 |
328 | miner_stopAutoDAG() 330 | 331 | click to toggle source 332 | 333 |
334 | 335 | 336 |
337 | 338 |

See github.com/ethereum/wiki/wiki/JSON-RPC#miner_stopautodag

340 | 341 | 342 | 343 | 344 |
345 |
# File miner_calls.rb, line 40
346 | def miner_stopAutoDAG()
347 | response = do_request("miner_stopAutoDAG")
348 | response["result"]
349 | end
350 |
351 | 352 |
353 | 354 | 355 | 356 | 357 |
358 | 359 | 360 |
361 | 362 |
363 |
364 | 365 | 366 | 371 | 372 | -------------------------------------------------------------------------------- /docs/classes/Web3/PersonalCalls.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web3::PersonalCalls 5 | 6 | 7 | 22 | 23 | 24 |
25 |
26 |

module 27 | Web3::PersonalCalls 28 |

29 |
    30 |
  1. 31 | personal_calls.rb 32 |
  2. 33 |
34 |
35 |
36 |
37 |
38 | 52 |
53 |
54 |
55 |
56 |

Public Instance methods

57 |
58 | 59 |
60 | personal_ecRecover 61 | (message, signature) 62 | 63 |
64 | 70 |
71 | 72 | [show source] 73 | 74 |
# File personal_calls.rb, line 50
def personal_ecRecover(message, signature)
response = do_request("personal_ecRecover",[message, signature])
response["result"]
end
75 |
76 |
77 |
78 | 79 |
80 | personal_importRawKey 81 | (key, passphrase) 82 | 83 |
84 | 90 |
91 | 92 | [show source] 93 | 94 |
# File personal_calls.rb, line 10
def personal_importRawKey(key, passphrase)
response = do_request("personal_importRawKey",[key, passphrase])
response["result"]
end
95 |
96 |
97 |
98 | 99 |
100 | personal_listAccounts 101 | () 102 | 103 |
104 | 110 |
111 | 112 | [show source] 113 | 114 |
# File personal_calls.rb, line 4
def personal_listAccounts()
response = do_request("personal_listAccounts")
response["result"]
end
115 |
116 |
117 |
118 | 119 |
120 | personal_lockAccount 121 | (account) 122 | 123 |
124 | 130 |
131 | 132 | [show source] 133 | 134 |
# File personal_calls.rb, line 28
def personal_lockAccount(account)
response = do_request("personal_lockAccount",[account])
response["result"]
end
135 |
136 |
137 |
138 | 139 |
140 | personal_newAccount 141 | (password) 142 | 143 |
144 | 150 |
151 | 152 | [show source] 153 | 154 |
# File personal_calls.rb, line 16
def personal_newAccount(password)
response = do_request("personal_newAccount",[password])
response["result"]
end
155 |
156 |
157 |
158 | 159 |
160 | personal_sign 161 | (message, account, password) 162 | 163 |
164 | 170 |
171 | 172 | [show source] 173 | 174 |
# File personal_calls.rb, line 44
def personal_sign(message, account, password)
response = do_request("personal_sign",[message, account, password])
response["result"]
end
175 |
176 |
177 |
178 | 179 |
180 | personal_signAndSendTransaction 181 | (transaction, passphrase) 182 | 183 |
184 | 190 |
191 | 192 | [show source] 193 | 194 |
# File personal_calls.rb, line 22
def personal_signAndSendTransaction(transaction, passphrase)
response = do_request("personal_signAndSendTransaction",[transaction, passphrase])
response["result"]
end
195 |
196 |
197 |
198 | 199 |
200 | personal_unlockAccount 201 | (account, passphrase, duration) 202 | 203 |
204 |
205 | 206 |

Be careful with this method. Do not leave an account unlocked, as that 207 | creates an opportunity for an attacker to make transactions from that 208 | account. In general #personal_signAndSendTransaction 210 | is a better option than unlock -> send -> lock See github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_unlockaccount

212 | 213 |
214 |
215 | 216 | [show source] 217 | 218 |
# File personal_calls.rb, line 38
def personal_unlockAccount(account, passphrase, duration)
response = do_request("personal_unlockAccount",[account, passphrase, duration])
response["result"]
end
219 |
220 |
221 |
222 |
223 | 224 |
225 |
226 | 227 | 228 |
229 | 232 | 233 | 234 | --------------------------------------------------------------------------------