#mocking #signatures #operations #construct #cross-chain #ren-vm #lock-and-mint

renvm-sig

A library to construct mock RenVM signatures for cross-chain lock-and-mint operations

2 releases

0.1.1 Jun 10, 2021
0.1.0 May 18, 2021

#5 in #cross-chain


Used in 3 crates

GPL-3.0 license

11KB
194 lines

RenVm Signatures

A library to construct mock RenVm signatures for cross-chain lock-and-mint operations.

Setup

$ cargo build

Usage

  • Random RenVm secret key and message
let renvm = RenVm::random();
let renvm_msg = RenVmMsgBuilder::default().build().unwrap();
let _renvm_sig = renvm.sign(&renvm_msg).unwrap();
  • RenVm secret key from bytes
let sk_bytes = [0u8; 32];
let _renvm = RenVm::from_bytes(&sk_bytes).unwrap();
  • RenVm secret key from hex string
let sk = "0x0000000000000000000000000000000000000000000000000000000000000000";
let _renvm = RenVm::from_str(sk).unwrap();
  • Builder pattern for RenVm message
// RenVm message structure
// | p_hash | amount | s_hash | to | n_hash |
// |   32   |   8    |   32   | 32 |   32   |
// random `to` and `n_hash`
let (p_hash, amount, s_hash) = ([0u8; 32], 0u64, [0u8; 32]);
let _renvm_msg = RenVmMsgBuilder::default()
  .p_hash(p_hash)
  .amount(amount)
  .s_hash(s_hash)
  .build()
  .unwrap();

Dependencies

~5.5MB
~94K SLoC