I am trying to mint a token in cardano mainnet. I have built a block and staking pool. I am working to mint a token and i am running into an error "unexpected '2', expecting space, "+" or end of input.
Here is the linux code I'm running:
cardano-cli transaction build-raw --shelley-era --fee $fee --tx-in $txhash#$txix --tx-out $address+$output+"$tokenamount $policyid.$tokenname1" --mint="$tokenamount $policyid.$tokenname1" --minting-script-file policy/policy.script --out-file matx.raw
Here is the error:
option --tx-out:
unexpected '2'
expecting space, "+" or end of input
Inputs:
I have tried different outputs of 10000000, 5000000, and 0.
$tokenamount="10000000"
$address=$(cat payment.addr)
$tokenname1="CpoolTest"
https://developers.cardano.org/docs/native-tokens/minting/
Please help
I guess i found the error.
Check $policyid whats inside. It should contain only 1x adress.
Try echo $policyid. It should only display 1 address
If its not the case, yo can try:
to delete your policyID:
rm -rf policy/policyID
After deleting create a brand new one:
cardano-cli transaction policyid --scriptfile ./policy/policy.script >> policy/policyID
Now set the variable:
policyid=$(cat policy/policyID)
Echo it
echo $policyid
There should be exactly 1 address displayed. Your code should work now
Related
I am having a hard time using an environment variable with a space in a properties file read by WildFly (24) in Linux using Oracle 19 in RDS. One like:
SELECT 1 FROM DUAL
The issue is that wildfly won't even parse the file if the spaces are in there with the normal quoting methods.
I have it setup so that variable is in a file called datasource.properties that gets read from standalone.conf where this variable sits:
JAVA_OPTS="$JAVA_OPTS -DDATABASE_CONNECTION_CHECK=${DATABASE_CONNECTION_CHECK}"
It's read in with the following in standalone.conf:
set -a
. /opt/wildfly_config/datasource.properties
set +a
That in turn gets populated in standalone.xml with:
<connection-url>${env.DATABASE_JDBC_URL}</connection-url>
I try putting it in quotes and oddly enough it doesn’t start at all. Standalone.sh is no longer able to parse it:
Error: Could not find or load main class 1 Caused by: java.lang.ClassNotFoundException: 1
I have tried many things such as:
DATABASE_CONNECTION_CHECK="SELECT{ }1{ }FROM{ }DUAL"
DATABASE_CONNECTION_CHECK="'SELECT 1 FROM DUAL'"
DATABASE_CONNECTION_CHECK='SELECT 1 FROM DUAL'
DATABASE_CONNECTION_CHECK="SELECT+1+FROM+DUAL"
DATABASE_CONNECTION_CHECK="SELECT\ 1\ FROM\ DUAL"
DATABASE_CONNECTION_CHECK="\"SELECT 1 FROM DUAL\""
DATABASE_CONNECTION_CHECK="\"'SELECT 1 FROM DUAL'\""
DATABASE_CONNECTION_CHECK="SELECT%201%20FROM%20DUAL"
DATABASE_CONNECTION_CHECK="SELECT\{ }1\{ }FROM\{ }DUAL"
DATABASE_CONNECTION_CHECK='SELECT{ }1{ }FROM{ }DUAL'
DATABASE_CONNECTION_CHECK="'SELECT{ }1{ }FROM{ }DUAL'"
DATABASE_CONNECTION_CHECK="''SELECT{ }1{ }FROM{ }DUAL''"
DATABASE_CONNECTION_CHECK="SELECT%1%FROM%DUAL"
(I realize some of these don't make sense but I was looking for anything different.)
Startup looks good in the log output this with some of these, but then java doesn’t like it, for some reason it sees the escape usage:
Caused by: Error : 936, Position : 9, Sql = SELECT+1+FROM+DUAL, OriginalSql = SELECT+1+FROM+DUAL, Error Msg = ORA-00936: missing expression
or
Caused by: Error : 911, Position : 6, Sql = SELECT%1%FROM%DUAL, OriginalSql = SELECT%1%FROM%DUAL, Error Msg = ORA-00911: invalid character
or
WARN [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (ServerService Thread Pool -- 46) IJ030027: Destroying connection that is not valid, due to the following exception: oracle.jdbc.driver.T4CConnection#2c1456f8: java.sql.SQLException: Non supported SQL92 token at position: 7
This last one is the only one that really netted anything different. I got that with:
DATABASE_CONNECTION_CHECK="SELECT{}1{}FROM{}DUAL"
I can use sed to change the value in the standalone.xml, but all of the other properties I am doing work fine with the exception of this one. I had a hard time with a semicolon in the jdbc string with MSSQL and putting the semicolon in braces like "{;}" fixed that. This DB apparently does not follow the same syntax.
Is there an encoding type that will help this with Oracle and keeps wildfly happy?
EDIT: More tests:
DATABASE_CONNECTION_CHECK=\"SELECT' '1' 'FROM' 'DUAL\"
gets
Caused by: Error : 900, Position : 0, Sql = "SELECT 1 FROM DUAL", OriginalSql = "SELECT 1 FROM DUAL", Error Msg = ORA-00900: invalid SQL statement'
(doesn't seem to like the quotes)
But without the escaping of the quotes I get:
Caused by: Error : 923, Position : 9, Sql = SELECT' '1' 'FROM' 'DUAL, OriginalSql = SELECT' '1' 'FROM' 'DUAL, Error Msg = ORA-00923: FROM keyword not found where expected
A better solution was to change the sourcing of the file from:
set +a
. /opt/PrimeKey/wildfly_config/datasource.properties
set -a
to
. /opt/PrimeKey/wildfly_config/datasource.properties
and make it so all the variables brought in were variables and not properties:
export DATABASE_CONNECTION_CHECK="SELECT 1 FROM DUAL"
I got a working sequence of commands within yubihsm-shell, but cannot get the same result when calling the shell non-interactively from the command line.
In the shell I got:
yubihsm> connect
yubihsm> session open 2 MyPassword
yubihsm> set informat base64
yubihsm> set outformat hex
yubihsm> decrypt oaep 0 0x1ddd rsa-oaep-sha1 wrapped_ephemeral.txt
On the command line I have currently this (I unfortunately need to be on Windows for that, so this cmd syntax)
set YUBISHELL="c:\Program Files\Yubico\YubiHSM Shell\bin\yubihsm-shell.exe"
type wrapped_ephemeral.txt | %YUBISHELL% ^
--authkey=2 ^
--password=MyPassword ^
--algorithm=rsa-oaep-sha1 ^
--informat=base64 ^
--outformat=hex ^
--object-id=7645 ^
--action=decrypt-oaep
All I'll get is
Session keepalive set up to run every 15 seconds
Created session 0
Command not implemented: Generic error
However, connecting and authenticating works ...
%YUBISHELL% ^
--authkey=2 ^
--password=MyPassword ^
--action=get-device-info
... as I get this
Using default connector URL: http://127.0.0.1:12345
Session keepalive set up to run every 15 seconds
Version number: 2.2.0
Serial number: ........
Log used: 62/62
Supported algorithms: rsa-pkcs1-sha1, rsa-pkcs1-sha256, rsa-pkcs1-sha384,
rsa-pkcs1-sha512, rsa-pss-sha1, rsa-pss-sha256,
rsa-pss-sha384, rsa-pss-sha512, rsa2048,
rsa3072, rsa4096, ecp256,
ecp384, ecp521, eck256,
ecbp256, ecbp384, ecbp512,
hmac-sha1, hmac-sha256, hmac-sha384,
hmac-sha512, ecdsa-sha1, ecdh,
rsa-oaep-sha1, rsa-oaep-sha256, rsa-oaep-sha384,
rsa-oaep-sha512, aes128-ccm-wrap, opaque-data,
opaque-x509-certificate, mgf1-sha1, mgf1-sha256,
mgf1-sha384, mgf1-sha512, template-ssh,
aes128-yubico-otp, aes128-yubico-authentication, aes192-yubico-otp,
aes256-yubico-otp, aes192-ccm-wrap, aes256-ccm-wrap,
ecdsa-sha256, ecdsa-sha384, ecdsa-sha512,
ed25519, ecp224, rsa-pkcs1-decrypt,
The error message "Command not implemented: Generic error" is meant seriously and is not due an mistake by me.
Incomprehensibly, some commands are only available in the interactive mode of the shell.
Known Issues and Limitations
Unimplemented Commands When Invoked in Command-Line Mode
...
decrypt-oaep
...
(https://developers.yubico.com/YubiHSM2/Releases/Known_issues.html)
after upgrading ruby from 2.7 to 3.0 to 3.1 I am facing fowling issue while running the cucumber test
Given a local mode chef repo with nodes 'one,two,three' # features/step_definitions/chef-repo.rb:2
Expected `knife client create admin -c config.rb -f admin.pem` to succeed but got non-zero exit status and the following output:
ERROR: ArgumentError: wrong number of arguments (given 3, expected 2)
(RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/chef-repo.rb:66:in `create_client'
./features/step_definitions/chef-repo.rb:58:in `create_admin'
./features/step_definitions/chef-repo.rb:20:in `block (2 levels) in <top (required)>'
./features/step_definitions/chef-repo.rb:19:in `each'
./features/step_definitions/chef-repo.rb:19:in `/^a local mode chef repo with nodes '(.+?)'(?: with admins '(.+?)')?$/'
features/clean.feature:11:in `a local mode chef repo with nodes 'one,two,three''
And I create a vault item 'test/item' containing the JSON '{"foo": "bar"}' encrypted for 'one,two' # features/step_definitions/chef-vault.rb:4
Then the vault item 'test/item' should be encrypted for 'one,two' # features/step_definitions/chef-vault.rb:48
And I update the vault item 'test/item' to be encrypted for 'two,three' # features/step_definitions/chef-vault.rb:14
Then the vault item 'test/item' should be encrypted for 'one,two,three'
It's failing under Auba SpawnProcess start command. Tried upgrading and downgrading arbua version 'aruba', '~> 2.0' & gem 'aruba', '0.5.4' nothing working can someone please help me with this?
in chef-repo.rb its failing on run_command_and_stop
def create_client(name, args = nil)
command = "knife client create #{name} -c config.rb -f #{name}.pem"
run_command_and_stop(command, fail_on_error: true)
write_file("#{name}.pem", last_command_started.stdout)
end
here if we step in run_command_and_stop its fails on command.start following code in aruba
def start_command(command)
259: aruba.config.run_before_hook(:command, self, command)
260:
261: in_current_directory do
262: command.start
263: end
264:
=> 265: stop_signal = command.stop_signal
266: aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal
267:
268: aruba.config.run_after_hook(:command, self, command)
269: end
On Ubuntu I can print a list of addresses in a specific range (given a base address) like the following:
seq -s " " -f "1.1.1.%g" 1 255
How can I achieve the same task on Alpine? seq provided by BusyBox is very limited in comparison and doesn't give me a format option.
I've found a more straight forward solution using bash inside alpine:
apk add bash
echo 1.1.1.{1..255}
If you have Python 3, you can generate the addresses in a network with the ipaddress module which may actually be better for your needs because it fully understands the masking (for example here it does not include .255 because it's the broadcast address)
You can also change the separator from " " to "\n" if you want them on each line or something else
% python3 -c 'import ipaddress;print(" ".join(str(x) for x in ipaddress.ip_network("1.1.1.0/24").hosts()))'
1.1.1.1 1.1.1.2 1.1.1.3 1.1.1.4 1.1.1.5 1.1.1.6 1.1.1.7 1.1.1.8 1.1.1.9 1.1.1.10 1.1.1.11 1.1.1.12 1.1.1.13 1.1.1.14 1.1.1.15 1.1.1.16 1.1.1.17 1.1.1.18 1.1.1.19 1.1.1.20 1.1.1.21 1.1.1.22 1.1.1.23 1.1.1.24 1.1.1.25 1.1.1.26 1.1.1.27 1.1.1.28 1.1.1.29 1.1.1.30 1.1.1.31 1.1.1.32 1.1.1.33 1.1.1.34 1.1.1.35 1.1.1.36 1.1.1.37 1.1.1.38 1.1.1.39 1.1.1.40 1.1.1.41 1.1.1.42 1.1.1.43 1.1.1.44 1.1.1.45 1.1.1.46 1.1.1.47 1.1.1.48 1.1.1.49 1.1.1.50 1.1.1.51 1.1.1.52 1.1.1.53 1.1.1.54 1.1.1.55 1.1.1.56 1.1.1.57 1.1.1.58 1.1.1.59 1.1.1.60 1.1.1.61 1.1.1.62 1.1.1.63 1.1.1.64 1.1.1.65 1.1.1.66 1.1.1.67 1.1.1.68 1.1.1.69 1.1.1.70 1.1.1.71 1.1.1.72 1.1.1.73 1.1.1.74 1.1.1.75 1.1.1.76 1.1.1.77 1.1.1.78 1.1.1.79 1.1.1.80 1.1.1.81 1.1.1.82 1.1.1.83 1.1.1.84 1.1.1.85 1.1.1.86 1.1.1.87 1.1.1.88 1.1.1.89 1.1.1.90 1.1.1.91 1.1.1.92 1.1.1.93 1.1.1.94 1.1.1.95 1.1.1.96 1.1.1.97 1.1.1.98 1.1.1.99 1.1.1.100 1.1.1.101 1.1.1.102 1.1.1.103 1.1.1.104 1.1.1.105 1.1.1.106 1.1.1.107 1.1.1.108 1.1.1.109 1.1.1.110 1.1.1.111 1.1.1.112 1.1.1.113 1.1.1.114 1.1.1.115 1.1.1.116 1.1.1.117 1.1.1.118 1.1.1.119 1.1.1.120 1.1.1.121 1.1.1.122 1.1.1.123 1.1.1.124 1.1.1.125 1.1.1.126 1.1.1.127 1.1.1.128 1.1.1.129 1.1.1.130 1.1.1.131 1.1.1.132 1.1.1.133 1.1.1.134 1.1.1.135 1.1.1.136 1.1.1.137 1.1.1.138 1.1.1.139 1.1.1.140 1.1.1.141 1.1.1.142 1.1.1.143 1.1.1.144 1.1.1.145 1.1.1.146 1.1.1.147 1.1.1.148 1.1.1.149 1.1.1.150 1.1.1.151 1.1.1.152 1.1.1.153 1.1.1.154 1.1.1.155 1.1.1.156 1.1.1.157 1.1.1.158 1.1.1.159 1.1.1.160 1.1.1.161 1.1.1.162 1.1.1.163 1.1.1.164 1.1.1.165 1.1.1.166 1.1.1.167 1.1.1.168 1.1.1.169 1.1.1.170 1.1.1.171 1.1.1.172 1.1.1.173 1.1.1.174 1.1.1.175 1.1.1.176 1.1.1.177 1.1.1.178 1.1.1.179 1.1.1.180 1.1.1.181 1.1.1.182 1.1.1.183 1.1.1.184 1.1.1.185 1.1.1.186 1.1.1.187 1.1.1.188 1.1.1.189 1.1.1.190 1.1.1.191 1.1.1.192 1.1.1.193 1.1.1.194 1.1.1.195 1.1.1.196 1.1.1.197 1.1.1.198 1.1.1.199 1.1.1.200 1.1.1.201 1.1.1.202 1.1.1.203 1.1.1.204 1.1.1.205 1.1.1.206 1.1.1.207 1.1.1.208 1.1.1.209 1.1.1.210 1.1.1.211 1.1.1.212 1.1.1.213 1.1.1.214 1.1.1.215 1.1.1.216 1.1.1.217 1.1.1.218 1.1.1.219 1.1.1.220 1.1.1.221 1.1.1.222 1.1.1.223 1.1.1.224 1.1.1.225 1.1.1.226 1.1.1.227 1.1.1.228 1.1.1.229 1.1.1.230 1.1.1.231 1.1.1.232 1.1.1.233 1.1.1.234 1.1.1.235 1.1.1.236 1.1.1.237 1.1.1.238 1.1.1.239 1.1.1.240 1.1.1.241 1.1.1.242 1.1.1.243 1.1.1.244 1.1.1.245 1.1.1.246 1.1.1.247 1.1.1.248 1.1.1.249 1.1.1.250 1.1.1.251 1.1.1.252 1.1.1.253 1.1.1.254
When I use the finger command, it displays Login, Name, Tty, Idle, Login Time, Office, Office Phone, and Host. I just need the information in the Login, Name, Idle, and Login Time columns.
I tried using awk and sed, but they resulted in chart being all over the place (example below).
$ finger | sed -r 's/\S+//3'
Login Name Idle Login Time Office Office Phone Host
user1 Full Name pts/1 20 Feb 3 19:34 (--------------------)
user2 FirstName LastName pts/2 Feb 3 17:04 (--------------)
user3 Name NameName pts/3 1:11 Feb 2 11:37 (-------------------------------)
user4 F Last pts/4 1:09 Feb 13 18:14 (-------------------)
How do I go about removing specific columns while keeping the structure intact?
The problem here is that you cannot extract particular fields based on whitespace separator, because on certain rows the columns might be blank and contain only whitespace, especially the Idle column, which will be blank for sessions with limited idle time. (An additional problem is that the real name field may contain a variable number of spaces.)
So you may have to resort to cut -b ... using hard-coded byte offsets. The following seems to work on my system, as finger seems to use a fixed format output, truncating real names etc as needed, so the byte offsets do not change if the length of the GECOS (real name) field of logged in users is changed.
finger | cut -b 1-20,30-48
Note that it will be inherently fragile if the format of the finger command output were to change in future. You might be able to produce something slightly more robust using regular expression parsing, for example parsing the column headings (first line of finger output) to obtain the byte offsets rather than hard-coding them, but it will still be somewhat fragile. A more robust solution would involve writing your own code to obtain information from the same sources that finger uses, and use that in place of finger. The existing code of an open-source implementation of finger might be a suitable starting point, and then you can adapt it to remove the columns that are not of interest.
Update: building a patched version of finger.
Save this patch as /tmp/patch. It it just a quick-and-dirty patch to suppress certain fields from being printed; they are still calculated.
--- sprint.c~ 2020-06-13 12:27:12.000000000 +0100
+++ sprint.c 2020-06-13 12:32:23.363138500 +0100
## -89,7 +89,7 ##
if (maxlname + maxrname < space-2) { maxlname++; maxrname++; }
(void)xprintf("%-*s %-*s %s\n", maxlname, "Login", maxrname,
- "Name", " Tty Idle Login Time Office Office Phone");
+ "Name", " Idle Login Time");
for (cnt = 0; cnt < entries; ++cnt) {
pn = list[cnt];
for (w = pn->whead; w != NULL; w = w->next) {
## -100,12 +100,6 ##
(void)xprintf(" * * No logins ");
goto office;
}
- (void)xputc(w->info == LOGGEDIN && !w->writable ?
- '*' : ' ');
- if (*w->tty)
- (void)xprintf("%-7.7s ", w->tty);
- else
- (void)xprintf(" ");
if (w->info == LOGGEDIN) {
stimeprint(w);
(void)xprintf(" ");
## -118,17 +112,6 ##
else
(void)xprintf(" %.5s", p + 11);
office:
- if (w->host[0] != '\0') {
- xprintf(" (%s)", w->host);
- } else {
- if (pn->office)
- (void)xprintf(" %-10.10s", pn->office);
- else if (pn->officephone)
- (void)xprintf(" %-10.10s", " ");
- if (pn->officephone)
- (void)xprintf(" %-.14s",
- prphone(pn->officephone));
- }
xputc('\n');
}
}
Then obtain the source code, patch it and build it. (Change destdir as required.)
apt-get source finger
cd bsd-finger-0.17/
pushd finger
patch -p0 < /tmp/patch
popd
destdir=/tmp/finger
mkdir -p $destdir/man/man8 $destdir/sbin $destdir/bin
./configure --prefix=$destdir
make
make install
And run it...
$destdir/bin/finger
Basically, to treat columns, awk is the way to go,
ex: remove third column
finger | awk '{$3="";print}'
Another way: If you found this informations, they have to be wrote somewhere in the system. Using who, awk and cut :
The informations can be gathered by getent passwd.
Created a test user with adduser :
# adduser foobar
Adding user `foobar' ...
Adding new group `foobar' (1001) ...
Adding new user `foobar' (1001) with group `foobar' ...
Creating home directory `/home/foobar' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for foobar
Enter the new value, or press ENTER for the default
Full Name []: Jean-Charles De la tour
Room Number []: 42
Work Phone []: +33140000000
Home Phone []: +33141000000
Other []: sysadmin
Is the information correct? [Y/n] Y
And the new line in /etc/passwd file:
foobar:x:1001:1001:Jean-Charles De la tour,42,+33140000000,+33141000000,sysadmin:/home/foobar:/bin/bash
So it's easy to retrieve in formations from this:
for u in $(who | cut -d' ' -f1); do # iterate over connected users
getent passwd | awk -F'[:,]' -v OFS='\n' -v u="$u" '$1==u{print "user: "$1, "full name: "$5, "room: "$6, "work phone : "$7, "home phone: "$8, "other: "$9}'
done
Just make sure you have , in $5 column.
Output
user: foobar
full name: Jean-Charles De la tour
room: 42
work phone : +33140000000
home phone: +33141000000
other: sysadmin