How do I force set the user context without a key value store or wallet?

atkayla

For testing purposes, I already have the public key + private key + certificate on hand (can just hardcode it), and I can set up the CA through the connection profile, but how would I invoke a transaction without setting up the filesystem key value store/wallet?

Paul O'Mahony

Use the InMemoryWallet class - see https://fabric-sdk-node.github.io/master/module-fabric-network.InMemoryWallet.html

example:

 const credPath = '/home/demo/mynetwork/crypto-material/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp';
 const cert = fs.readFileSync(credPath + '/cert.pem').toString();
 const key = fs.readFileSync(credPath + '/key.pem').toString();
 const inMemoryWallet = new InMemoryWallet();
 await inMemoryWallet.import('admin', X509WalletMixin.createIdentity('Org1MSP', cert, key));

or check out the integration test scripts for Fabric Node SDK

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I store a current user context in AngularJS?

How do I store the key and value into hashmap and print it out accordingly?

How do I set up Electrum Tor Wallet (for XVG) right?

How do I create one user without key authentication?

How can I set a value for the key "homepage" without using the API?

How do I find the value of the key that I set with argument in Ruby?

How do I set a value to its default user agent value?

How to set the User field value from context?

How do I query DynamoDB without specifying a partition key value?

In Clojure, how do I sort a set of maps by a key within a value?

Django - How Do I Set A Default Value In A Form To Be The Current User?

How do I set the value of ${user} in Netbeans 7.1.2?

How do I force yum to install without prompting the user, using bash?

How do i set slider value without 'update' firering?

How do I set a default value in a model without having a column for it?

How do I set a value for a <select> with React without using onChange?

How do I force to open a specific activity after a user set the alarm?

How can I store the respective key and value for a given set of attributes in a JSON file in a List

How do i store user input in an array?

How do you use force adb to backup without user confirmation?

Rails 4 How do I set custom set of parameters to a user without update function?

please how do I add new key - value pairs to a dictionary without overriding the existing key?

How do I smoothly store user input data with EditText and RadioButtons (with a color set as well)?

Redis store key without a value

I get this error when I user dictionary `set value for key`

How do I add a new key/value pairing within an object in Redux state store?

How do I sweep a Polkadot wallet?

How do I store a user prompt(input) into an array and retrieve it's max and min value?

How do I store Either (Key a) (Key b)?