mirror of
				https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
				synced 2025-10-31 02:17:24 +00:00 
			
		
		
		
	fixed seed creation & printing
This commit is contained in:
		
							parent
							
								
									c78ac9a06f
								
							
						
					
					
						commit
						f016801309
					
				| @ -37,7 +37,7 @@ int main(void) { | ||||
|    | ||||
|   printf("Mnemonic: %s\n",mnem); | ||||
| 
 | ||||
|   /* 4. Validate the Mnemonic */ | ||||
|   /* 4. Validate a Mnemonic */ | ||||
| 
 | ||||
|   lw_response = bip39_mnemonic_validate(NULL,mnem); | ||||
|    | ||||
| @ -54,8 +54,8 @@ int main(void) { | ||||
|        | ||||
|   /* 5. Translate into Seed */ | ||||
| 
 | ||||
|   unsigned char seed[BIP39_SEED_LEN_512]; | ||||
|   size_t seed_len; | ||||
|   unsigned char *seed; | ||||
|    | ||||
|   lw_response = bip39_mnemonic_to_seed(mnem,NULL,seed,BIP39_SEED_LEN_512,&seed_len); | ||||
| 
 | ||||
| @ -66,6 +66,16 @@ int main(void) { | ||||
|      | ||||
|   } | ||||
| 
 | ||||
|   /* 6. Print the Seed */ | ||||
| 
 | ||||
|   char *seed_hex; | ||||
|   wally_hex_from_bytes(seed,sizeof(seed),&seed_hex); | ||||
|   printf("Seed: %s\n",seed_hex); | ||||
| 
 | ||||
|   /* Always cleanup: the docs clearly tell us what to free */ | ||||
|    | ||||
|   wally_free_string(mnem); | ||||
|   wally_free_string(seed_hex);   | ||||
|   wally_cleanup(0); | ||||
|      | ||||
| }  | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user