Commit graph

110 commits

Author SHA1 Message Date
DataHoarder 910450c4a5
Added binary request for GetOIndexes 2023-04-10 03:12:08 +02:00
DataHoarder 031b77423d
Added BulletproofPlus to transaction JSON response 2023-04-08 20:51:55 +02:00
DataHoarder f9cc428f9e
Added BoostSerializeTypeBool to levin portable storage 2023-03-20 21:26:21 +01:00
DataHoarder d8d87587c8
Added error to submit_block call 2023-03-05 01:40:01 +01:00
DataHoarder f6a7735b8c
Added SubmitBlock RPC method 2023-03-05 01:35:45 +01:00
DataHoarder 16f8644e01
Fix GetMinerDataResult difficulty type 2023-03-04 08:32:40 +01:00
DataHoarder 0adf4de11a
Added GetMinerData rpc call 2023-03-03 10:53:08 +01:00
DataHoarder b6ca970f30
Change project name 2022-10-05 09:40:23 +02:00
DataHoarder 0c66c0fe65
Light project renovation 2022-10-05 09:37:13 +02:00
Ciro S. Costa 48852069f5 cmd: add set-log-categories
example:

	$ monero daemon set-log-categories \
		--categories=net.http:4,net.dns:2

	Status: OK

	CATEGORY        LEVEL
	net.http        4
	net.dns         2

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-09-19 14:11:16 +00:00
Ciro S. Costa 17445423a6 cmd: add set/get limit (net throttling)
example:

	monero daemon set-limit --up 10
	Status:         OK
	Limit Up:       10 kB/s
	Limit Down:     1.0 GB/s

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-09-18 11:53:02 +00:00
Ciro S. Costa 74a9dfbdca cmd: add address generation
here a new subcommand is added: `address`.

the idea here is to provide an example of how address-related
funcionality from `pkg/monero` can be used.

at the moment, the only available action is "generate", which
instantiates a new seed based on `crypto/rand` and then displaying on
stdout the result

	WARNING: DO NOT USE THIS FOR ANYTHING MEANINGFUL.
	you've been advised.

example:

	$ monero address generate

	Mnemonic:  dawn      repent   towel    taxi
		   cucumber  muzzle   romance  awesome
		   losing    yeti     dogs     biplane
		   foyer     hotel    tattoo   dilute
		   gearbox   later    afloat   purged
		   software  ashtray  cell     dangerous
		   biplane

	Primary Address:        49MYaXwy8K177bw9i1bBDvPuM...
	Private Spend Key:      455f1c286ff8db620e61ca6c6...
	Private View Key:       b5d26a403c6cec29c3ecc8d2f...
	Public Spend Key:       cc06a0f6e6c6b0248d5e2c3fd...
	Public View Key:        bcb8d3dc372efb9071c120b72...

	(output truncated to fit the commit message).

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-08-26 07:46:52 -04:00
Ciro S. Costa c0cee1b176 cmd/get-info: add missing fields
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-08-03 17:44:33 -04:00
Ciro S. Costa 0094b0481e pmg/rpc: make freespace and height u64
when using a restricted port, freespace gives back u64's max value[1]:

	std::numeric_limits<uint64_t>::max()

[1]: ed506006d2/src/rpc/core_rpc_server.cpp (L511)

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-08-03 17:12:08 -04:00
Ciro S. Costa 07bb1726bd get-block: total fees; reuse blockheader printer
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-31 07:00:29 -04:00
Ciro S. Costa ad498be8f1 cmd: minor unit and flag improvements
- `get-transaction` on miner tx's now reveal the outputs in `m`
- `get-block` now includes a `--last` to allow one to easily say "get me
the last block", or "get me the last-1 block" ...
- `get-last-block-header` now shows rewards in precise `m`

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-31 06:42:08 -04:00
Ciro S. Costa ac58bd1fd1 add zmq support
here i add `pkg/zmq`, a package aimed at providing one with the ability
of subscribing to zmq topics that the monero daemon published messages
to.

as exaplined under [1], there are four topics that one can subscribe to:

	-  json-minimal-txpool_add
	-  json-full-txpool_add
	-  json-minimal-chain_main
	-  json-full-chain_main

in the implementation provided here, one goes about listening to these
by:

	1. creating a client aiming at a topic
	2. telling the client to listen
	3. consuming typed objects from a "stream" object

e.g.:

	client := zmq.NewClient(endpoint, zmq.TopicMinimalTxPoolAdd)
	defer client.Close()

	stream, _ := client.Listen(ctx)
	for {
		select {
		case err := <-stream.ErrC:
			panic(err)
		case tx := <-stream.MinimalTxPoolAddC:
			fmt.Println(tx)
		}
	}

CLI users can also make use of it via `monero daemon zmq`:

	$ monero daemon zmq \
		--topic json-minimal-chain_main  \
		--endpoint tcp://127.0.0.1:18085

[1]: https://github.com/monero-project/monero/blob/master/docs/ZMQ.md

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-28 07:37:23 -04:00
Ciro S. Costa 680c4ce417 add get-accounts; add addr shortener
$ monero wallet get-accounts
Total Balance:          390.31 ɱ
Total Unlocked Balance: 390.31 ɱ

        LABEL           TAG     ADDR            BALANCE         UNLOCKED BALANCE
0       Primary account         53G25..A91AX    389.31 ɱ        389.31 ɱ
1       test                    72vD5..43SXV    1.00 ɱ          1.00 ɱ

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-22 07:49:15 -04:00
Ciro S. Costa bc7c6484cd wallet: get-address
~ $ monero wallet get-address
        ADDRESS                                                                                         LABEL           USED
0       53G25UfvJkvKZpJk3LgKTebdLwcxVQxSrWcwLHJUtWYHPZX6PrwggUN1PisbZG81YkJNVEgpCUMBKE8Dkaqn4CpsPUA91AX Primary account true
1       75M29Zm9i3HPxTTgp3iHY2LS93eAWWBuoKDjd1L6kMmL2JYcdWoxfSnhf717WdNEZtMKGZaGEsoVnaCWVVp1PbqaBhXSKHx                 false
2       72nBssuF3a7ZVdiRuDHJZncDDf7y9WF9FTgBcixxymqVM1BAcr2q93de6nBcNAuqK21rUqB6amxSo8QWWKA7Apt7T7svKyE                 false
3       72ae7h9jYLxSmW3KHjPGPXUdg5VfM1ncscy6mDJc6ANx8xX9Usq9vGWMJoydAeqUiJ3ibpGkdtd67a6nuEtu1zWdHVU5p6r                 false
4       7A4nDhtPYTgQVGQ1tYtgzCBYw35E75ajAV6T56Px5cn6dokG53xETFHfHoL2QYeL417P1w8VAdKLoGdWvjnDpfi9LPApooa                 false
5       7BmLuTWBhzCYJbespeFTWFKRyDr66ng4TBnmUVuWYa2b6CEp8MujC5D9Gct2YAn9AK6HhhnVCBFM63Qe1Hj9qxWd5GW7EVN                 false
6       7BvGs82sgpLUSbsXPm3KgeZq4hnZJxHwgLQ3davwgPbEUkir91pLPrCcSXfGQWtuGb4N55eNCXe4BYi7L7yYdcPo548z5NF                 false
7       7AFNdb1sG6c1Mro27774PEegFbWr5bF1125SB8kHwSXe8WCokX1yTE46EqMtPviyZfSHyoPYCYB2yK6R755usqFo5ph8KWJ                 false
8       77DaGHUchBfR6hG2MokYgY4xv23iCRJxfUPZ1ZttFWz71JnLK7MtHtyYQJ2S9MYkb2QjYshcbxki34vYuQj8ioEyHErnKJw                 false
9       76dmK6eqNPagoLB5xQLyJk3cFeKWnCpRyRkC95ncRBGhKhcTiciDLzgaEqVRDd7ABe3azB1T1i5r2cftnLwngCDu7cKWAUy                 false

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-21 18:30:55 -04:00
Ciro S. Costa 78745598d8 wallet: refresh,auto-refresh,get-height
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-21 07:27:10 -04:00
Ciro S. Costa 26588fa4f0 wallet: add create-add
monero wallet -a http://localhost:18082 create-address --count 2
0       Address:        77GBiFupp2mbqik7wyMrz39yQZ5giJJewjbNCZE1hmkDbANhC1v2paG8R6P51rge1qaqWcVoYmDTG292D4Ri6onGNAyvhe7
~       Address Index:  12

1       Address:        72z24bJDeuyEZPQSBDezQEGzuaEuVPthZfnPWHAj1gakje2VyNECQvG1b4wa4g2eF9Z2BFeR4XHxh8vypemhQfZFVrfwmTE
~       Address Index:  13

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-20 19:32:57 -04:00
Ciro S. Costa da578aee01 wallet: improve wallet balance output
eg.

Total Balance:  241.848409 XMR

0       Address 53G25UfvJkvKZpJk3LgKTebdLwcxVQxSrWcwLHJUtWYHPZX6PrwggUN1PisbZG81YkJNVEgpCUMBKE8Dkaqn4CpsPUA91AX
~       Label:          Primary account
~       UTXOs           35
~       Balance:        241.848409 XMR

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-20 19:06:15 -04:00
Ciro S. Costa 02dd7d551f cmd: get-blk-headers-range and mining-status
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-20 07:54:43 -04:00
Ciro S. Costa 45b42a1fae source formatting
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 17:22:57 -04:00
Ciro S. Costa 87083cf533 remove unecessary status code println
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 17:15:29 -04:00
Ciro S. Costa 564d426f3a source formatting
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 16:48:09 -04:00
Ciro S. Costa 2136abc313 fix non-verbose auth-based requests
it turns out that the server implementation relies on the clients doing
the whole auth flow over the same connection, but `go` will only let you
reuse a given tcp connection if you've completely drained the response's
body (which `--verbose` ends up doing, despite copying everythign back
to a new reader).

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 16:46:40 -04:00
Ciro S. Costa 7012486a16 source formatting
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 15:56:51 -04:00
Ciro S. Costa 9536d945b0 pkg/http: remove non-monero auth details
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 08:38:58 -04:00
Ciro S. Costa e78b200d02 add support for rpc auth
example:

	monerod --rpc-login foo:foo  (...)
	monero daemon -u foo -p foo get-version

new flags
	  -p, --password string    password to supply for rpc auth
	  -u, --username string    name of the user to use during rpc auth

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 08:27:44 -04:00
Ciro S. Costa 096ad758c2 source formatting
no behavior changes

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-18 06:51:24 -04:00
Ciro S. Costa e94f6ae0dd address lint cases
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 20:54:50 -04:00
Ciro S. Costa dc4973801c source formatting
- restrict width to 80

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 20:18:59 -04:00
Ciro S. Costa 2f4faf8d0e cmd: add support for tls
well, `pkg/rpc` in theory already supported tls given that it relies on
an `http.Client` which could already be making use of such proxy, but at
least now we make it configurable to the CLI in a nice way

very command under `monero daemon|wallet` now takes:

	Flags:
	  -a, --address string             full address of the monero node to reach out to (default "http://localhost:18081")
	  -h, --help                       help for daemon
	      --request-timeout duration   how long to wait until considering the request a failure (default 1m0s)
	      --tls-ca-cert string         certificate authority to load
	      --tls-client-cert string     tls client certificate to use when connecting
	      --tls-client-key string      tls client key to use when connecting
	  -k, --tls-skip-verify            skip verification of certificate chain and host name
	  -v, --verbose                    dump http requests and responses to stderr

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 19:59:47 -04:00
Ciro S. Costa 099386b765 fix small lint issues
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 12:04:11 -04:00
Ciro S. Costa 58a7fd031d cmd: add set-bans
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 08:48:58 -04:00
Ciro S. Costa e05d673547 cmd: fix ring members retrieval; fill age column
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 08:24:03 -04:00
Ciro S. Costa 2bb2257534 cmd: retrieve block header by height
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 07:41:50 -04:00
Ciro S. Costa 4a56e5e00a cmd: display ring members in get-transaction
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-17 07:01:41 -04:00
Ciro S. Costa 964cca2eeb cmd: add get-outs
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-16 18:56:10 -04:00
Ciro S. Costa 9cf4665b88 cmd: improve pretty-printing, add get-version
- update get-height's description
- update some fields to prefer uint64 rather than `int`

	all those fields would never take negative values and should be
	able to grow quite a lot

- switch commands from display to humanize

	`humanize` gives us some pretty handy human readable
	conversions, so let's just go with it rather than rolling our
	own

- add get-version command

- prettify get-transaction pool

	example out (hash reduced in size):

	AGE             HASH                FEE (µɱ)        FEE (µɱ per-kB) SIZE    in/out
	1 minute ago    1a053e4058839b21c4  9                6.4            1.5 kB  1/2
	1 minute ago    fb61680a1584ca1ec3  9                6.4            1.5 kB  1/2
	1 minute ago    a58de0d2747cdd6a5d  12               6.4            2.0 kB  2/2
	1 minute ago    c54f4b33ed81335f78  308             160.6           2.0 kB  2/2
	57 seconds ago  ab210c55bd9c3efe09  12               6.4            2.0 kB  2/2
	55 seconds ago  88df3311e19b1280b5  9                6.4            1.5 kB  1/2
	51 seconds ago  a3aa674ed3d4eb56c6  127             32.5            4.0 kB  6/2
	51 seconds ago  e896abe686d2f816fc  9                6.4            1.5 kB  1/2
	31 seconds ago  eb6ea6662ce754d025  9                6.4            1.5 kB  1/2
	31 seconds ago  592204223e607cc5d9  9                6.4            1.5 kB  1/2
	24 seconds ago  ba8d52f90fd45dd32d  12               6.4            2.0 kB  2/2
	24 seconds ago  792e68ded7805037c9  12               6.4            2.0 kB  2/2

- move response types to a single file
- rework pretty-printing of txn-based cmds

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-16 07:48:30 -04:00
Ciro S. Costa 425893dd54 pkg/rpc: use uint64 for height
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-11 07:25:05 -04:00
Ciro S. Costa edb7e1b79f improve documentation
- update readme so that it's up to date when it comes to package
structure

- add a badge that points at godoc so that one can quickly recognize
where docs can be found

- add an example that can be referenced via godoc (using `_test.go`
example)

- update sync-info to include a little description

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-10 21:32:09 -04:00
Ciro S. Costa e6bc54f872 use cobra for cmds; refactor rpc to support wallet
- using `cobra` for sake of better organization when it comes to command
hierarchy

- splitting `rpc` into `daemon` and `wallet` so we can start thinking of
monero-wallet-rpc support

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-10 20:29:16 -04:00
Ciro S. Costa 56dcb6b176 pkg/rpc: docs
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-03 15:46:37 -04:00
Ciro S. Costa eb365cb4f5 cmd: get-public-nodes
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-06-13 18:04:10 -04:00
Ciro S. Costa f3e71d5e6e cmd: get-block-header-by-hash
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-06-13 07:50:06 -04:00
Ciro S. Costa 1d4fff5e03 cmd: allow passing hash to get-block
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-06-12 16:13:58 -04:00
Ciro S. Costa 56034d55bd add pkg/pointer package
some of the methods will now start taking pointer-based values, so lets
bring a utility to help passing those.

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-06-12 16:13:23 -04:00
Ciro S. Costa 412e77f10a cmd: present get-bans time left as duration
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-06-12 15:34:35 -04:00